diff --git a/previews/PR542/.documenter-siteinfo.json b/previews/PR542/.documenter-siteinfo.json index 9b5f42ad..fd3d0409 100644 --- a/previews/PR542/.documenter-siteinfo.json +++ b/previews/PR542/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-24T01:35:04","documenter_version":"1.5.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.10.4","generation_timestamp":"2024-07-24T01:40:43","documenter_version":"1.5.0"}} \ No newline at end of file diff --git a/previews/PR542/conversions/index.html b/previews/PR542/conversions/index.html index 51e24438..283c36d7 100644 --- a/previews/PR542/conversions/index.html +++ b/previews/PR542/conversions/index.html @@ -53,4 +53,4 @@ And data, a 3-element Vector{Int64}: 1 2 - 3 + 3 diff --git a/previews/PR542/custom/index.html b/previews/PR542/custom/index.html index c13dd7ad..1ea36210 100644 --- a/previews/PR542/custom/index.html +++ b/previews/PR542/custom/index.html @@ -62,4 +62,4 @@
rcopy(l)
OrderedCollections.OrderedDict{Symbol, Any} with 2 entries:
   :foo2 => Foo(3.0, "hello")
-  :bar  => Foo(1.0, "hello")
+ :bar => Foo(1.0, "hello") diff --git a/previews/PR542/eventloop/index.html b/previews/PR542/eventloop/index.html index d71dab9a..f826ed27 100644 --- a/previews/PR542/eventloop/index.html +++ b/previews/PR542/eventloop/index.html @@ -1,2 +1,2 @@ -Eventloop · RCall.jl

Eventloop

In a non-IJulia interactive session, by R will by default open a new window to display the plot. In order to enable interactive features, such as plot-resizing, the R eventlopp will be started automatically.

You could start manually the R event loop via

RCall.rgui_start()

This runs frequent calls to R to check if the plot has changed, and redraw if necessary. It can be stopped with

RCall.rgui_stop()
+Eventloop · RCall.jl

Eventloop

In a non-IJulia interactive session, by R will by default open a new window to display the plot. In order to enable interactive features, such as plot-resizing, the R eventlopp will be started automatically.

You could start manually the R event loop via

RCall.rgui_start()

This runs frequent calls to R to check if the plot has changed, and redraw if necessary. It can be stopped with

RCall.rgui_stop()
diff --git a/previews/PR542/gettingstarted/index.html b/previews/PR542/gettingstarted/index.html index 3b93d5f3..9989bac6 100644 --- a/previews/PR542/gettingstarted/index.html +++ b/previews/PR542/gettingstarted/index.html @@ -34,29 +34,29 @@ R> foo + bar [1] 6

@R_str string macro

Another way to use RCall is the R"" string macro, it is especially useful in script files.

julia> R"rnorm(10)"RObject{RealSxp}
- [1]  2.6019414  1.5107165  0.6706808 -0.6856523 -0.8239150  0.5923568
- [7] -1.0548238  0.1926580 -1.1414189  1.5697542

This evaluates the expression inside the string in R, and returns the result as an RObject, which is a Julia wrapper type around an R object.

The R"" string macro supports variable substitution of Julia objects via the $ symbol, whenever it is not valid R syntax (i.e. when not directly following a symbol or completed expression such as aa$bb):

julia> x = randn(10)10-element Vector{Float64}:
- -1.9845169367598778
-  1.1082273738180328
- -0.21628971302452862
-  0.8405308719418223
-  0.6370727798959639
-  1.7426745276916824
- -0.36692935184972064
- -0.6884196945900488
- -1.4551667997506332
-  1.7795064542448928
julia> R"t.test($x)"RObject{VecSxp} + [1] -0.9535522 -0.5100862 0.7564901 0.8012316 -2.2984606 1.0228712 + [7] 0.2570878 0.8028643 -0.1897431 -1.3157553

This evaluates the expression inside the string in R, and returns the result as an RObject, which is a Julia wrapper type around an R object.

The R"" string macro supports variable substitution of Julia objects via the $ symbol, whenever it is not valid R syntax (i.e. when not directly following a symbol or completed expression such as aa$bb):

julia> x = randn(10)10-element Vector{Float64}:
+ -1.1770183990618954
+ -2.002300807796996
+ -0.5325484846338473
+  1.5674913366008678
+ -1.217144433833981
+  0.5853933543516161
+ -1.3815073139525649
+ -0.6214378817497981
+ -1.1887462987335264
+  1.4800471069049463
julia> R"t.test($x)"RObject{VecSxp} One Sample t-test data: `#JL`$x -t = 0.34143, df = 9, p-value = 0.7406 +t = -1.1443, df = 9, p-value = 0.282 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: - -0.7857031 1.0650410 + -1.3359908 0.4384365 sample estimates: -mean of x - 0.139669

It is also possible to pass Julia expressions which are evaluated before being passed to R: these should be included in parentheses

julia> R"optim(0, $(x -> x-cos(x)), method='BFGS')"RObject{VecSxp}
+ mean of x
+-0.4487772

It is also possible to pass Julia expressions which are evaluated before being passed to R: these should be included in parentheses

julia> R"optim(0, $(x -> x-cos(x)), method='BFGS')"RObject{VecSxp}
 $par
 [1] -1.56343
 
@@ -86,7 +86,7 @@
  :vs
  :am
  :gear
- :carb
julia> jmtcars[:mpg]Ptr{RealSxp} @0x0000000007ab0e10
julia> typeof(jmtcars)RObject{VecSxp}

The rcall function is used to construct function calls.

julia> rcall(:dim, jmtcars)RObject{IntSxp}
+ :carb
julia> jmtcars[:mpg]Ptr{RealSxp} @0x00000000059a6540
julia> typeof(jmtcars)RObject{VecSxp}

The rcall function is used to construct function calls.

julia> rcall(:dim, jmtcars)RObject{IntSxp}
 [1] 32 11

The arguments will be implicitly converted to RObject upon evaluation.

julia> rcall(:sum, Float64[1.0, 4.0, 6.0])RObject{RealSxp}
 [1] 11

The rcopy function converts RObjects to Julia objects. It uses a variety of heuristics to pick the most appropriate Julia type:

julia> rcopy(R"c(1)")1.0
julia> rcopy(R"c(1, 2)")2-element Vector{Float64}: 1.0 @@ -114,10 +114,10 @@ 9 │ 30.0 111.0 10 │ 2.0 50.0
julia> ratio(d, w) = sum(d[!, :x] .* w)/sum(d[!, :u] .* w)ratio (generic function with 1 method)
julia> b = boot(city, ratio, R = 100, stype = "w");
julia> rcall(:summary, b[:t])RObject{StrSxp} V1 - Min. :1.201 - 1st Qu.:1.393 - Median :1.508 - Mean :1.546 - 3rd Qu.:1.628 - Max. :2.765

Of course, it is highly inefficient, because the data are copying multiple times between R and Julia. The R"" string macro is more recommended for efficiency.

Some R functions may have keyword arguments which contain dots. RCall provides a string macro to escape those keywords, e.g,

julia> @rimport base as rbase
julia> rbase.sum([1, 2, 3], var"rm.na" = true)RObject{IntSxp} -[1] 7
+ Min. :1.203 + 1st Qu.:1.427 + Median :1.517 + Mean :1.559 + 3rd Qu.:1.659 + Max. :2.242

Of course, it is highly inefficient, because the data are copying multiple times between R and Julia. The R"" string macro is more recommended for efficiency.

Some R functions may have keyword arguments which contain dots. RCall provides a string macro to escape those keywords, e.g,

julia> @rimport base as rbase
julia> rbase.sum([1, 2, 3], var"rm.na" = true)RObject{IntSxp} +[1] 7
diff --git a/previews/PR542/index.html b/previews/PR542/index.html index 4fed0689..04f28678 100644 --- a/previews/PR542/index.html +++ b/previews/PR542/index.html @@ -1,2 +1,2 @@ -Introduction · RCall.jl

RCall.jl

R is a language for statistical computing and graphics that has been around for couple of decades and it has one of the most impressive collections of scientific and statistical packages of any environment. Recently, the Julia language has become an attractive alternative because it provides the remarkable performance of a low-level language without sacrificing the readability and ease-of-use of high-level languages. However, Julia still lacks the depth and scale of the R package environment.

This package, RCall, facilitates communication between these two languages and allows the user to call R packages from within Julia, providing the best of both worlds. Additionally, this is a pure Julia package so it is portable and easy to use.

+Introduction · RCall.jl

RCall.jl

R is a language for statistical computing and graphics that has been around for couple of decades and it has one of the most impressive collections of scientific and statistical packages of any environment. Recently, the Julia language has become an attractive alternative because it provides the remarkable performance of a low-level language without sacrificing the readability and ease-of-use of high-level languages. However, Julia still lacks the depth and scale of the R package environment.

This package, RCall, facilitates communication between these two languages and allows the user to call R packages from within Julia, providing the best of both worlds. Additionally, this is a pure Julia package so it is portable and easy to use.

diff --git a/previews/PR542/installation/index.html b/previews/PR542/installation/index.html index 777b7968..6b4914a4 100644 --- a/previews/PR542/installation/index.html +++ b/previews/PR542/installation/index.html @@ -27,4 +27,4 @@ unable to load shared object '/home/user/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/libs/Rcpp.so': /home/user/julia-1.3.1/bin/../lib/julia/libstdc++.so.6: version `GLIBCXX_3.4.26' not found (required by /home/user/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/libs/Rcpp.so)

This issue was fixed in Julia 1.9 (see https://github.com/JuliaLang/julia/issues/34276) but a workaround for older Julia versions is to replace Julia's libstdc++ with the one of your OS:

# works for Ubuntu 19.10 64-bit - match your locations accordingly!
-cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 $JULIA_HOME/lib/julia/

This problem doesn't affect Julia ≥ 1.9!

Other methods

If you have installed R by some other method (e.g. building from scratch, or files copied but not installed in the usual manner), which often happens on cluster installations, then you may need to set R_HOME or your PATH as described above before running Pkg.build("RCall") in order for the build script to find your R installation. RCall requires R to be installed with its shared library. It could be done with the flag --enable-R-shlib, consult your server administrator to see if it was the case.

For some environments, you might also need to specify LD_LIBRARY_PATH

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:`R RHOME`/lib"

Updating R

If you have updated your R installation, you may need to re-run Pkg.build("RCall") as described above, possibly changing the R_HOME environment variable first.

+cp /usr/lib/x86_64-linux-gnu/libstdc++.so.6 $JULIA_HOME/lib/julia/

This problem doesn't affect Julia ≥ 1.9!

Other methods

If you have installed R by some other method (e.g. building from scratch, or files copied but not installed in the usual manner), which often happens on cluster installations, then you may need to set R_HOME or your PATH as described above before running Pkg.build("RCall") in order for the build script to find your R installation. RCall requires R to be installed with its shared library. It could be done with the flag --enable-R-shlib, consult your server administrator to see if it was the case.

For some environments, you might also need to specify LD_LIBRARY_PATH

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:`R RHOME`/lib"

Updating R

If you have updated your R installation, you may need to re-run Pkg.build("RCall") as described above, possibly changing the R_HOME environment variable first.

diff --git a/previews/PR542/internal/index.html b/previews/PR542/internal/index.html index e1b68a4b..c86abe0e 100644 --- a/previews/PR542/internal/index.html +++ b/previews/PR542/internal/index.html @@ -1,5 +1,5 @@ -Internal · RCall.jl

Internal API

Types

RCall.RObjectType

An RObject is a Julia wrapper for an R object (known as an "S-expression" or "SEXP"). It is stored as a pointer which is protected from the R garbage collector, until the RObject itself is finalized by Julia. The parameter is the type of the S-expression.

When called with a Julia object as an argument, a corresponding R object is constructed.

julia> RObject(1)
+Internal · RCall.jl

Internal API

Types

RCall.RObjectType

An RObject is a Julia wrapper for an R object (known as an "S-expression" or "SEXP"). It is stored as a pointer which is protected from the R garbage collector, until the RObject itself is finalized by Julia. The parameter is the type of the S-expression.

When called with a Julia object as an argument, a corresponding R object is constructed.

julia> RObject(1)
 RObject{IntSxp}
 [1] 1
 
@@ -9,9 +9,9 @@
 
 julia> RObject(1.0:3.0)
 RObject{RealSxp}
-[1] 1 2 3
source
RCall.SxpType

RCall.jl's type Sxp mirrors the R symbolic expression record SEXPREC in R API. These are represented by a pointer Ptr{S<:Sxp} (which is called SEXP in R API).

source

Methods

Base.isasciiMethod

Determines the encoding of the CharSxp. This is determined by the 'gp' part of the sxpinfo (this is the middle 16 bits).

  • 0x00000200 (bit 1): set of bytes (no known encoding)
  • 0x00000400 (bit 2): Latin-1
  • 0x00000800 (bit 3): UTF-8
  • 0x00004000 (bit 6): ASCII

We only support ASCII and UTF-8.

source
Base.lengthMethod

Sxp methods for length return the R length.

Rf_xlength handles Sxps that are not vector-like and R's "long vectors", which have a negative value for the length member.

source
Base.namesMethod

Returns the names of an R vector, the result is converted to a Julia symbol array.

source
RCall.boundMethod

The R NAMED property, represented by 2 bits in the info field. This can take values 0,1 or 2, corresponding to whether it is bound to 0,1 or 2 or more symbols. See http://cran.r-project.org/doc/manuals/r-patched/R-exts.html#Named-objects-and-copying

source
RCall.getNamespaceMethod

get namespace by name of the namespace. It is safer to be used than findNamespace as it checks bound.

source
RCall.ijulia_displayfileMethod
ijulia_displayfile(m::MIME, f)

Display a graphics file in IJulia.

This function generally should not be called by the user, but is instead by the appropriate display hook.

See also ijulia_setdevice.

source
RCall.ijulia_displayplotsMethod
ijulia_displayplots()

Closes graphics device and displays files in notebook.

This is a postexecution hook called by IJulia after cell evaluation and should generally not be called by the user.

source
RCall.SxpType

RCall.jl's type Sxp mirrors the R symbolic expression record SEXPREC in R API. These are represented by a pointer Ptr{S<:Sxp} (which is called SEXP in R API).

source

Methods

Base.isasciiMethod

Determines the encoding of the CharSxp. This is determined by the 'gp' part of the sxpinfo (this is the middle 16 bits).

  • 0x00000200 (bit 1): set of bytes (no known encoding)
  • 0x00000400 (bit 2): Latin-1
  • 0x00000800 (bit 3): UTF-8
  • 0x00004000 (bit 6): ASCII

We only support ASCII and UTF-8.

source
Base.lengthMethod

Sxp methods for length return the R length.

Rf_xlength handles Sxps that are not vector-like and R's "long vectors", which have a negative value for the length member.

source
Base.namesMethod

Returns the names of an R vector, the result is converted to a Julia symbol array.

source
RCall.boundMethod

The R NAMED property, represented by 2 bits in the info field. This can take values 0,1 or 2, corresponding to whether it is bound to 0,1 or 2 or more symbols. See http://cran.r-project.org/doc/manuals/r-patched/R-exts.html#Named-objects-and-copying

source
RCall.getNamespaceMethod

get namespace by name of the namespace. It is safer to be used than findNamespace as it checks bound.

source
RCall.ijulia_displayfileMethod
ijulia_displayfile(m::MIME, f)

Display a graphics file in IJulia.

This function generally should not be called by the user, but is instead by the appropriate display hook.

See also ijulia_setdevice.

source
RCall.ijulia_displayplotsMethod
ijulia_displayplots()

Closes graphics device and displays files in notebook.

This is a postexecution hook called by IJulia after cell evaluation and should generally not be called by the user.

source
RCall.ijulia_setdeviceMethod
ijulia_setdevice(m::MIME; kwargs...)
 ijulia_setdevice(m::MIME"image/png"; width=6*72, height=5*72)
-ijulia_setdevice(m::MIME"image/svg+xml"; width=6, height=5)

Set options for R plotting with IJulia.

The first argument should be a MIME object: currently supported are

  • MIME("image/png") [default]
  • MIME("image/svg+xml")

The keyword arguments are forwarded to the appropriate R graphics device: see the relevant R help for details.

source
RCall.initEmbeddedRMethod
initEmbeddedR()

This initializes an embedded R session. It should only be called when R is not already running (e.g. if Julia is running inside an R session)

source
RCall.isNAMethod

Check if a value corresponds to R's sentinel NA values. These function should not be exported.

source
RCall.isnaMethod

Check if the ith member of s correspond to R's NA values.

source
RCall.isnaMethod

Check if the members of a vector are NA values. Always return a BitArray.

source
RCall.julia_extptr_callbackMethod

The function called by R .External for Julia callbacks.

It receives a Ptr{ListSxp} containing

  • a pointer to the function itself (Ptr{ExtPtrSxp})
  • a pointer to the Julia function (Ptr{ExtPtrSxp})
  • any arguments (as Ptr{S<:Sxp})
source
RCall.makeNativeSymbolRefMethod

Register a function pointer as an R NativeSymbol. We technically are supposed to use RregisterRoutines. Starting from R 3.4, `RMakeExternalPtrFn` is a part of R API in R 3.4. It is probably safe to such to make the external pointer.

source
RCall.newEnvironmentMethod
newEnvironment([env])

Create a new environment which extends environment env (globalEnv by default).

source
RCall.preserveMethod

Prevent garbage collection of an R object. Object can be released via release.

This is slower than protect, as it requires searching an internal list, but more flexible.

source
RCall.protectMethod

Stack-based protection of garbage collection of R objects. Objects are released via unprotect. Returns the same pointer, allowing inline use.

This is faster than preserve, but more restrictive. Really only useful inside functions.

source
RCall.rcallMethod

Evaluate a function in the global environment. The first argument corresponds to the function to be called. It can be either a FunctionSxp type, a SymSxp or a Symbol.

source
RCall.rcall_pMethod

Evaluate a function in the global environment. The first argument corresponds to the function to be called. It can be either a FunctionSxp type, a SymSxp or a Symbol.

source
RCall.rcopyMethod

rcopy(r) copies the contents of an R object into a corresponding canonical Julia type.

source
RCall.renderMethod

Render an inline R script, substituting invalid dollar signs ($) for Julia symbols

source
RCall.revalFunction

Evaluate an R symbol or language object (i.e. a function call) in an R try/catch block, returning an RObject.

source
RCall.reval_pMethod

Evaluate an R expression array iteratively. If throw_error is false, the error message and warning will be thrown to stderr.

source
RCall.reval_pMethod

Evaluate an R symbol or language object (i.e. a function call) in an R try/catch block, returning a Sxp pointer.

source
RCall.rimportFunction

Import an R package as a julia module. Sanitizes the imported symbols by default, because otherwise certain symbols cannot be used.

E.g.: PerformanceAnalytics::charts.Bar in R becomes PerformanceAnalytics.charts_Bar in Julia

gg = rimport("ggplot2")

normalization is passed directly to replace via splatting.

source
RCall.rlangMethod

Create a function call from a function pointer and a list of arguments and return it as an RObject, which can then be evaluated

source
RCall.robjectMethod

robject(x) converts a Julia object x to a corresponding RObject implicitly. Explicit conversions could be called with robject(<R Class>, x).

source
RCall.sexpMethod

sexp(x) converts a Julia object x to a pointer to a corresponding Sxp Object.

source
RCall.sexpMethod

Convert a Ptr{UnknownSxp} to an appropriate Ptr{S<:Sxp}.

source
RCall.sexpMethod

Wrap a Julia object an a R Ptr{ExtPtrSxp}.

We store the pointer and the object in a const Dict to prevent it being removed by the Julia GC.

source
RCall.sexpMethod

Wrap a callable Julia object f an a R ClosSxpPtr.

Constructs the following R code

function(...) .External(juliaCallback, fExPtr, ...)
source
RCall.sexpnumMethod

The SEXPTYPE number of a Sxp

Determined from the trailing 5 bits of the first 32-bit word. Is a 0-based index into the info field of a SxpHead.

source
RCall.unsafe_vecMethod

Represent the contents of a VectorSxp type as a Vector.

This does not copy the contents. If the argument is not named (in R) or otherwise protected from R's garbage collection (e.g. by keeping the containing RObject in scope) the contents of this vector can be modified or could cause a memory error when accessed.

The contents are as stored in R. Missing values (NA's) are represented in R by sentinels. Missing data values in RealSxp and CplxSxp show up as NaN and NaN + NaNim, respectively. Missing data in IntSxp show up as -2147483648, the minimum 32-bit integer value. Internally a LglSxp is represented as Vector{Int32}. The convention is that 0 is false, -2147483648 is NA and all other values represent true.

source
RCall.validate_libRMethod
validate_libR(libR)

Checks that the R library libR can be loaded and is satisfies version requirements.

source

Macros

RCall.@R_strMacro
R"..."

An inline R expression, the result of which is evaluated and returned as an RObject.

It supports substitution of Julia variables and expressions via prefix with $ whenever not valid R syntax (i.e. when not immediately following another completed R expression):

R"glm(Sepal.Length ~ Sepal.Width, data=$iris)"

It is also possible to pass Julia expressions:

R"plot(#55)"

All such Julia expressions are evaluated once, before the R expression is evaluated.

The expression does not support assigning to Julia variables, so the only way to retrieve values from R is via the return value.

source
RCall.@rgetMacro
@rget(args...)

Copy variable(s) from R to Julia using the same name.

source
RCall.@rimportMacro

Import an R Package as a Julia module. For example,

@rimport ggplot2

is equivalent to ggplot2 = rimport("ggplot2") with error checking.

You can also use classic Python syntax to make an alias: @rimport *package-name* as *shorthand*

@rimport ggplot2 as gg

which is equivalent to gg = rimport("ggplot2").

source
RCall.@rlibraryMacro

Load all exported functions/objects of an R package to the current module. Almost equivalent to

__temp__ = rimport("ggplot2")
-using .__temp__
source
RCall.@rputMacro
@rput(args...)

Copy variable(s) from Julia to R using the same name.

source

Constants

RCall.jtypExtPtrsConstant

Julia types (typically functions) which are wrapped in Ptr{ExtPtrSxp} are stored here to prevent garbage collection by Julia.

source
+ijulia_setdevice(m::MIME"image/svg+xml"; width=6, height=5)

Set options for R plotting with IJulia.

The first argument should be a MIME object: currently supported are

  • MIME("image/png") [default]
  • MIME("image/svg+xml")

The keyword arguments are forwarded to the appropriate R graphics device: see the relevant R help for details.

source
RCall.initEmbeddedRMethod
initEmbeddedR()

This initializes an embedded R session. It should only be called when R is not already running (e.g. if Julia is running inside an R session)

source
RCall.isNAMethod

Check if a value corresponds to R's sentinel NA values. These function should not be exported.

source
RCall.isnaMethod

Check if the ith member of s correspond to R's NA values.

source
RCall.isnaMethod

Check if the members of a vector are NA values. Always return a BitArray.

source
RCall.julia_extptr_callbackMethod

The function called by R .External for Julia callbacks.

It receives a Ptr{ListSxp} containing

  • a pointer to the function itself (Ptr{ExtPtrSxp})
  • a pointer to the Julia function (Ptr{ExtPtrSxp})
  • any arguments (as Ptr{S<:Sxp})
source
RCall.makeNativeSymbolRefMethod

Register a function pointer as an R NativeSymbol. We technically are supposed to use RregisterRoutines. Starting from R 3.4, `RMakeExternalPtrFn` is a part of R API in R 3.4. It is probably safe to such to make the external pointer.

source
RCall.newEnvironmentMethod
newEnvironment([env])

Create a new environment which extends environment env (globalEnv by default).

source
RCall.preserveMethod

Prevent garbage collection of an R object. Object can be released via release.

This is slower than protect, as it requires searching an internal list, but more flexible.

source
RCall.protectMethod

Stack-based protection of garbage collection of R objects. Objects are released via unprotect. Returns the same pointer, allowing inline use.

This is faster than preserve, but more restrictive. Really only useful inside functions.

source
RCall.rcallMethod

Evaluate a function in the global environment. The first argument corresponds to the function to be called. It can be either a FunctionSxp type, a SymSxp or a Symbol.

source
RCall.rcall_pMethod

Evaluate a function in the global environment. The first argument corresponds to the function to be called. It can be either a FunctionSxp type, a SymSxp or a Symbol.

source
RCall.rcopyMethod

rcopy(r) copies the contents of an R object into a corresponding canonical Julia type.

source
RCall.renderMethod

Render an inline R script, substituting invalid dollar signs ($) for Julia symbols

source
RCall.revalFunction

Evaluate an R symbol or language object (i.e. a function call) in an R try/catch block, returning an RObject.

source
RCall.reval_pMethod

Evaluate an R expression array iteratively. If throw_error is false, the error message and warning will be thrown to stderr.

source
RCall.reval_pMethod

Evaluate an R symbol or language object (i.e. a function call) in an R try/catch block, returning a Sxp pointer.

source
RCall.rimportFunction

Import an R package as a julia module. Sanitizes the imported symbols by default, because otherwise certain symbols cannot be used.

E.g.: PerformanceAnalytics::charts.Bar in R becomes PerformanceAnalytics.charts_Bar in Julia

gg = rimport("ggplot2")

normalization is passed directly to replace via splatting.

source
RCall.rlangMethod

Create a function call from a function pointer and a list of arguments and return it as an RObject, which can then be evaluated

source
RCall.robjectMethod

robject(x) converts a Julia object x to a corresponding RObject implicitly. Explicit conversions could be called with robject(<R Class>, x).

source
RCall.sexpMethod

sexp(x) converts a Julia object x to a pointer to a corresponding Sxp Object.

source
RCall.sexpMethod

Convert a Ptr{UnknownSxp} to an appropriate Ptr{S<:Sxp}.

source
RCall.sexpMethod

Wrap a Julia object an a R Ptr{ExtPtrSxp}.

We store the pointer and the object in a const Dict to prevent it being removed by the Julia GC.

source
RCall.sexpMethod

Wrap a callable Julia object f an a R ClosSxpPtr.

Constructs the following R code

function(...) .External(juliaCallback, fExPtr, ...)
source
RCall.sexpnumMethod

The SEXPTYPE number of a Sxp

Determined from the trailing 5 bits of the first 32-bit word. Is a 0-based index into the info field of a SxpHead.

source
RCall.unsafe_vecMethod

Represent the contents of a VectorSxp type as a Vector.

This does not copy the contents. If the argument is not named (in R) or otherwise protected from R's garbage collection (e.g. by keeping the containing RObject in scope) the contents of this vector can be modified or could cause a memory error when accessed.

The contents are as stored in R. Missing values (NA's) are represented in R by sentinels. Missing data values in RealSxp and CplxSxp show up as NaN and NaN + NaNim, respectively. Missing data in IntSxp show up as -2147483648, the minimum 32-bit integer value. Internally a LglSxp is represented as Vector{Int32}. The convention is that 0 is false, -2147483648 is NA and all other values represent true.

source
RCall.validate_libRMethod
validate_libR(libR)

Checks that the R library libR can be loaded and is satisfies version requirements.

source

Macros

RCall.@R_strMacro
R"..."

An inline R expression, the result of which is evaluated and returned as an RObject.

It supports substitution of Julia variables and expressions via prefix with $ whenever not valid R syntax (i.e. when not immediately following another completed R expression):

R"glm(Sepal.Length ~ Sepal.Width, data=$iris)"

It is also possible to pass Julia expressions:

R"plot(#55)"

All such Julia expressions are evaluated once, before the R expression is evaluated.

The expression does not support assigning to Julia variables, so the only way to retrieve values from R is via the return value.

source
RCall.@rgetMacro
@rget(args...)

Copy variable(s) from R to Julia using the same name.

source
RCall.@rimportMacro

Import an R Package as a Julia module. For example,

@rimport ggplot2

is equivalent to ggplot2 = rimport("ggplot2") with error checking.

You can also use classic Python syntax to make an alias: @rimport *package-name* as *shorthand*

@rimport ggplot2 as gg

which is equivalent to gg = rimport("ggplot2").

source
RCall.@rlibraryMacro

Load all exported functions/objects of an R package to the current module. Almost equivalent to

__temp__ = rimport("ggplot2")
+using .__temp__
source
RCall.@rputMacro
@rput(args...)

Copy variable(s) from Julia to R using the same name.

source

Constants

RCall.jtypExtPtrsConstant

Julia types (typically functions) which are wrapped in Ptr{ExtPtrSxp} are stored here to prevent garbage collection by Julia.

source
diff --git a/previews/PR542/known-issues/index.html b/previews/PR542/known-issues/index.html index 9098868f..e8fee731 100644 --- a/previews/PR542/known-issues/index.html +++ b/previews/PR542/known-issues/index.html @@ -1,2 +1,2 @@ -Known issues · RCall.jl

Installing packages via Conda

When using the Conda environment, installing packages via install.packages or devtools will result in installation failures such as "x86_64-conda-linux-gnu-cc: not found". Instead, use Conda to install packages. For example, Conda.add("r-ggplot2").

+Known issues · RCall.jl

Installing packages via Conda

When using the Conda environment, installing packages via install.packages or devtools will result in installation failures such as "x86_64-conda-linux-gnu-cc: not found". Instead, use Conda to install packages. For example, Conda.add("r-ggplot2").