Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.4k views
in Technique[技术] by (71.8m points)

julia - Problem with updating R code inserts in Pluto.jl

I have some amount of code in R left over from my past research. It's not very fast, but it works. Julia generously allows to postpone the full migration process for later, using this R code via Rcall, this is very convenient. Recently I decided to prepare one interactive demo using Pluto and among other things in one place used the insertion of R code via Rcall. At the first launch, if only open notebook, everything works, but if change anything in this code block and recalculate it, Pluto returns an error like this:

cannot assign a value to variable workspace407.b from module workspace408

This error occurs even when using the simplest code, so the problem is not an error in the R code, but in the relationship between the environments when updating cell with this code. If run this code directly from Julia, without Pluto, there is no such problem. Here is a completely primitive example that demonstrates the problem:

begin
    a = 2
    @rput a
    R"""
    b = a*2
    """
    @rget b
    b
end

For this to work, using Rcall must be called somewhere before and R must be installed and configured for external startup. On the first run of Pluto notebook with this code, everything works as it should. But if change for example b = a*2 to b = a*3 and update cell with this code, Pluto will give an error. How to solve this problem?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...