nuget server logo nuget api documents
↑

API Docs / REnv / Imports

Imports

Full name SMRUCC.Rsharp.Interpreter.ExecuteEngine.ExpressionSymbols.Imports Assembly REnv Members 17

A syntax from imports new package namespace from the external module assembly.

 imports [namespace] from [module.dll]
 imports "script.R"

if the module file is missing file extension name, then the file extension name dll will be used as default.

00 Remarks

imports关键词的功能除了可以导入dll模块之中的包模块以外,也可以导入R脚本。 导入R脚本的功能和source函数保持一致,但是存在一些行为上的区别:

  • source函数要求脚本文件必须是一个正确的绝对路径或者相对路径
  • imports关键词则无此要求,因为imports关键词会自动进行脚本文件的搜索操作

为了兼容javascript的调用,在导入模块成功的时候还会在全局环境中生成模块的变量

01 Syntax

SMRUCC.Rsharp.Interpreter.ExecuteEngine.ExpressionSymbols.Imports

02 Methods

NameOverloadsSummary
.ctor 2 imports package from library
importsLibrary 1 js import "library-name"
importsPackages 1 js import packages from "dll-file"
GetExternalScriptFile 1
GetDllFile 1 the clr dll assembly file name(full name)
LoadLibrary 1 Load packages from a given dll module file
ToString 1
Evaluate 1
hook_jsEnv 1

03 Properties

NameOverloadsSummary
library 1 .dll/*.R file name
isImportsScript 1 当前的语句是否是用于导入其他的脚本文件模块?
packages 1
type 1
expressionName 1
scriptSource 1

04 Fields

NameOverloadsSummary
attach_lib_dir 1

05 Members

method .ctor #
#ctor(Expression, Expression, String)

imports package from library

Parameters
NameTypeDescription
packagesExpression

-

libraryExpression

-

sourceString

The file path of the source R# script file

method .ctor overload 2 #
#ctor(String, String)

imports package from library

Parameters
NameTypeDescription
packageString

-

libraryString

-

method importsLibrary #
importsLibrary(Environment)
 import "library-name"
Parameters
NameTypeDescription
envEnvironment

-

method importsPackages #
importsPackages(Environment)
 import packages from "dll-file"
Parameters
NameTypeDescription
envEnvironment

-

method GetExternalScriptFile #
GetExternalScriptFile(String, String, Environment)
Parameters
NameTypeDescription
libFileString

-

sourceString
  • 如果源文件存在值,则会在source脚本所处的文件夹,其中的R文件夹,当前文件夹进行搜索
  • 如果源文件是空值,则会在当前文件夹以及当前文件夹中的R文件夹进行搜索
envEnvironment

-

method GetDllFile #
GetDllFile(String, Environment)

the clr dll assembly file name(full name)

Parameters
NameTypeDescription
libDllString

the file name of the dll file, example like: file.dll

envEnvironment

-

method LoadLibrary #
LoadLibrary(String, Environment, Index(Of String))

Load packages from a given dll module file

Parameters
NameTypeDescription
libDllString

A given dll module file its file path

envirEnvironment

-

namesIndex(Of String)

a list of package module in target assembly file libDll

property library #
library

*.dll/*.R file name

Remarks

dll file path may be affected by the attach_lib_dir in options, attach_lib_dir is defined based on the --attach argument value from the commandline.

property isImportsScript #
isImportsScript

当前的语句是否是用于导入其他的脚本文件模块?

field attach_lib_dir #
attach_lib_dir
property packages #
packages
property type #
type
property expressionName #
expressionName
property scriptSource #
scriptSource
method ToString #
ToString()
method Evaluate #
Evaluate(Environment)
method hook_jsEnv #
hook_jsEnv(GlobalEnvironment, String, Type())