From 7f59101218fb2e15b70a427bd97860e902e6b124 Mon Sep 17 00:00:00 2001 From: musvaage <112724366+musvaage@users.noreply.github.com> Date: Thu, 20 Jul 2023 03:47:27 -0500 Subject: [PATCH 1/2] typos (#494) --- docs/src/installation.md | 2 +- src/convert/default.jl | 2 +- src/ijulia.jl | 2 +- src/language.jl | 2 +- src/methods.jl | 6 +++--- src/render.jl | 2 +- src/types.jl | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/src/installation.md b/docs/src/installation.md index e8d67905..399a202a 100644 --- a/docs/src/installation.md +++ b/docs/src/installation.md @@ -72,7 +72,7 @@ This problem doesn't affect Julia ≥ 1.6! ### 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 requries 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. +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` ```sh diff --git a/src/convert/default.jl b/src/convert/default.jl index 8fb14ec7..e929e174 100644 --- a/src/convert/default.jl +++ b/src/convert/default.jl @@ -202,7 +202,7 @@ rcopy(r) = r # logic of default sexp """ -`robject(x)` converts a Julia object `x` to a corresponding RObject implictly. Explict conversions +`robject(x)` converts a Julia object `x` to a corresponding RObject implicitly. Explicit conversions could be called with `robject(, x)`. """ robject(s) = RObject(s) diff --git a/src/ijulia.jl b/src/ijulia.jl index 10cb3925..1554f234 100644 --- a/src/ijulia.jl +++ b/src/ijulia.jl @@ -1,6 +1,6 @@ # IJulia hooks for displaying plots with RCall -# TODO: create a special graphics device. This would allow us to not accidently close devices opened by users, and display plots immediately as they appear. +# TODO: create a special graphics device. This would allow us to not accidentally close devices opened by users, and display plots immediately as they appear. ijulia_mime = nothing diff --git a/src/language.jl b/src/language.jl index dbefbd7a..813f165f 100644 --- a/src/language.jl +++ b/src/language.jl @@ -19,7 +19,7 @@ function rlang_p(f, args...; kwargs...) l end -"Create a function call from a function pointer and a list of arguments and return it as an RObject, which can then be evaulated" +"Create a function call from a function pointer and a list of arguments and return it as an RObject, which can then be evaluated" rlang(f, args...; kwargs...) = RObject(rlang_p(f,args...; kwargs...)) diff --git a/src/methods.jl b/src/methods.jl index bddafd95..2b5fbfab 100644 --- a/src/methods.jl +++ b/src/methods.jl @@ -459,13 +459,13 @@ isNA(x::Float64) = is_ieee_na(x) isNA(x::Int32) = x == Const.NaInt isNA(s::Ptr{CharSxp}) = s === sexp(Const.NaString) isNA(s::Ptr{S}) where S<:VectorSxp = length(s) == 1 ? isNA(s[1]) : false -# all other values are consided as non-NA. +# all other values are considered as non-NA. isNA(s::Any) = false isna(s::Ptr{S}, i::Integer) where S<:VectorSxp = isNA(s[i]) isna(s::Ptr{S}) where S<:VectorSxp = reshape(BitArray([isNA(a) for a in s]), size(s)) """ -Check if the ith member of s coorespond to R's NA values. +Check if the ith member of s correspond to R's NA values. """ isna(r::RObject, i::Integer) = isna(r.p, i) """ @@ -544,7 +544,7 @@ getindex(e::RObject{EnvSxp},s) = RObject(getindex(sexp(e),s)) function setindex!(e::Ptr{EnvSxp},v::Ptr{S},s::Ptr{StrSxp}) where S<:Sxp # `Rf_defineVar` is unsafe to use if the binding is locked. # However, `setVarInFrame` is not exported. `base::assign` is - # an avaliable alternative. + # an available alternative. rcall_p(Const.BaseNamespace["assign"], s, v, envir = e) end function setindex!(e::Ptr{EnvSxp},v,s) diff --git a/src/render.jl b/src/render.jl index d944cc75..c7849f7f 100644 --- a/src/render.jl +++ b/src/render.jl @@ -98,7 +98,7 @@ function render(script::String) end """ -Prepare code for evaluating the julia expressions. When the code is execulated, +Prepare code for evaluating the julia expressions. When the code is evaluated, the results are stored in the R environment `#JL`. """ function prepare_inline_julia_code(symdict, escape::Bool=false) diff --git a/src/types.jl b/src/types.jl index 55a9a7fc..d6a38e17 100644 --- a/src/types.jl +++ b/src/types.jl @@ -298,7 +298,7 @@ end """ -Convert a `Ptr{UnknownSxp}` to an approptiate `Ptr{S<:Sxp}`. +Convert a `Ptr{UnknownSxp}` to an appropriate `Ptr{S<:Sxp}`. """ function sexp(p::Ptr{UnknownSxp}) typ = sexpnum(p) From 305efff4cf31d89b79f1943f26e1ccd9658928a8 Mon Sep 17 00:00:00 2001 From: Phillip Alday Date: Wed, 9 Aug 2023 19:44:27 +0000 Subject: [PATCH 2/2] fix datetime to character conversion (#495) * fix datetime to character conversion * patch bump * try other julia versions on windows * more extensive R testing, only test windows on Julia latest --- .github/workflows/ci.yml | 9 ++++++++- Project.toml | 2 +- test/convert/datetime.jl | 12 +++++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d38e1abd..4944a31a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ on: pull_request: jobs: test: - name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} + name: Julia ${{ matrix.version }} - R ${{ matrix.R }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.experimental }} strategy: @@ -19,6 +19,10 @@ jobs: - '1.6' - '1' - nightly + R: + - 'release' + - '4.0' + - '3.4' os: [ubuntu-latest] arch: [x64] experimental: [false] @@ -28,10 +32,12 @@ jobs: arch: x64 version: 1 experimental: false + R: 'release' - os: windows-latest arch: x64 version: 1 experimental: false + R: 'release' steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 @@ -42,6 +48,7 @@ jobs: - uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true + r-version: ${{ matrix.R }} - run: echo "LD_LIBRARY_PATH=$(R RHOME)/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV if: matrix.os == 'ubuntu-latest' - uses: julia-actions/julia-buildpkg@v1 diff --git a/Project.toml b/Project.toml index f1359f35..880ead20 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "RCall" uuid = "6f49c342-dc21-5d91-9882-a32aef131414" authors = ["Douglas Bates ", "Randy Lai ", "Simon Byrne "] -version = "0.13.15" +version = "0.13.16" [deps] CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597" diff --git a/test/convert/datetime.jl b/test/convert/datetime.jl index c72d7a15..a1b150e4 100644 --- a/test/convert/datetime.jl +++ b/test/convert/datetime.jl @@ -73,7 +73,13 @@ r = RObject(d) @test rcopy(r) === d @test rcopy(DateTime, r) === d @test rcopy(R"as.POSIXct($s, 'UTC', '%Y-%m-%dT%H:%M:%S')") == d -@test rcopy(R"identical(as.character($d, '%Y-%m-%dT%H:%M:%S'), $s)") +# previously the second argument to as.character.POSIXt was `format``, now it defaults +# to `digits`. Using `format` as a named argument gives a deprecation warning +# this changed in R 4.3.0 but is listed as a bugfix +# > as.character() now behaves more in line with the methods for atomic vectors such as numbers, +# > and is no longer influenced by options(). Ditto for as.character(). The as.character() method +# > gets arguments digits and OutDec with defaults not depending on options(). Use of as.character(*, format = .) now warns. +@test rcopy(R"identical(format($d, '%Y-%m-%dT%H:%M:%S'), $s)") s = ["2001-01-01T01:01:01", "1111-11-11T11:11:00", "2012-12-12T12:12:12"] @@ -88,7 +94,7 @@ r = RObject(d) @test rcopy(r) == d @test rcopy(Array{DateTime}, r) == d @test rcopy(R"as.POSIXct($s, 'UTC', '%Y-%m-%dT%H:%M:%S')") == d -@test rcopy(R"identical(as.character($d, '%Y-%m-%dT%H:%M:%S'), $s)") +@test rcopy(R"identical(format($d, '%Y-%m-%dT%H:%M:%S'), $s)") # SubArray @@ -103,7 +109,7 @@ r = RObject(d) @test rcopy(r) == d @test rcopy(Array{DateTime}, r) == d @test rcopy(R"as.POSIXct($s[1:2], 'UTC', '%Y-%m-%dT%H:%M:%S')") == d -@test rcopy(R"identical(as.character($d, '%Y-%m-%dT%H:%M:%S'), $s[1:2])") +@test rcopy(R"identical(format($d, '%Y-%m-%dT%H:%M:%S'), $s[1:2])") d = DateTime[]