Compatibility of source function in R - r

I am trying to execute together two lines above together but, on this way (when I selected both) is not working. When I select and run separately this code is works.
SIMULATION<-data_edit(SIMULATION)
source(file=paste(path1,"/Simulation-Module.R",sep=""),local=TRUE)
When I selected this line together, this last line was not executed, while they worked when I selected it separately.
The first line with data_edit command comes from the library DataEditR. That command enables some editing of data.
So any can anybody help me how to solve this problem ? Do I need to set some additional argument ?

Related

Solve conflict between DataEditR and source function

I selected around 100 lines of code in the R script, including the last two rows that are shown below.
SIMULATION<-data_edit(SIMULATION)
source(file=paste(path1,"/Simulation-Module.R",sep=""),local=TRUE)
When I selected this line together, this last line was not executed, while they worked when I selected it separately.
The first line with data_edit command comes from the library DataEditR. That command enables some editing of data.
So any can anybody help me how to solve this problem ?

Variables used in Test Package in R Studio

I am trying to fix an issue in an R project (that I'm not too familiar with). The test script that is executed when running "Test Package" in R-Studio uses a variable, let's call it x. From the result of the test I can tell that the data assigned to this variable is outdated and I want to update it.
Problem is, I just cannot figure out where this variable is actually defined. I have used grep for the entire source code of the package, and I only find the instance from the test script but no declaration. It is not defined in the script itself nor anywhere else in the source code.
When I just load the package, the variable is not defined. Somehow it is defined however when running the test, because only when I change the name in the test script into some dummy I get the error that it isn't defined.
Is there a specific place where I could look, or may be a simple trick how I could figure out where and how the variable is defined?
Thanks
Edit: the actual variable name is a bit complicated, it is not x
The find in files option in RStudio may help.
You can search through multiple files within a folder.
If you get too many matches to sort through (I'm really hoping your variable is not actually called x!), you can try using a regular expression.
enter image description here
Follow the pictures and you could solve the problem.

Hiding JupyterLab cell's output by default

I am using JupyterLab to build a bioinformatics pipeline that uses both bash and python scripts.
The first bash script results gives a lot of feedback on every step of the process. However, this feedback is not helpful (unless there was an error) and makes the document less readable.
I would like to be able to hide this cell's output by default, but also to be able to open it when necessary to troubleshoot. I know it's possible to click 3 times on the output to collapse it; I was just wondering whether there is a way to do so by default.
I tried to add the tag specified on here (https://jupyterbook.org/features/hiding.html#Hiding-outputs) to the cell, but it does not seem to work for me.
Thanks for your help.
You may just want to suppress the output using %%capture cell magic as illustrated here. Then you simply remove that magic command from the first line of the cell for times you want to see the output, such as when troubleshooting.
If you want to make it so every time you run the cell, you can later decide to review what was captured you can use the %%capture magic command more as it was meant to be used. By assigning what is captured you can also do something like what the %%bash cell magic allows with handling output streams (see here), too. As described and illustrated here using the utils object you can easily get the stdout and/or stderr as a string, see http://ipython.readthedocs.io/en/stable/api/generated/IPython.utils.capture.html.
So say you put the following at the top of you cell to assign what was captured to out:
%%capture out
You can review the stdout stream later with the following:
print(out.stdout)
Or if you just want part of it, something like print(out.stdout[1:500]). I have some fancier handling illustrated in some blocks of code here.

How to send commands to R in ESS

I, an R user, decided recently to try using Emacs-ESS combo. So far I have been work in a single-window mode (C-x 1) just for text highlighting.
Now I am trying split it in two windows (C-x 3) to work on an .R file in the left window, and have R execute the commands in the right window. Something like this:
After selecting sections of code on the left, how can I "send" it as a command to the right? Essentially, I want the input to remain on on the left (so that I can incrementally build the code up) and the actual R output on (including error messages) the right.
Two good options:
ess-eval-region-or-function-or-paragraph vis
(C-M-x): Sends the current selected region or function or paragraph.
ess-eval-region-or-function-or-paragraph-and-step (C-c C-c): Like ess-eval-region-or-function-or-paragraph but steps to next line of code.
Source: ESS manual.
You can also use:
C-c-p to send a paragraph or region between two empty lines
C-c-r to send a region that has been selected and is highlighted
I prefer this way because you only need to press the Ctrl key
there are normally many ways to send code to the R console. It will take you time to realize what is best for you, or you may eventually change the key bindings.

Execute a block of code but show all results in Julia/Juno

I have Julia code edited in Juno, which contains a very simple code block with a calculation at each line. When I select it all and execute it, only the result for the last line is displayed:
I'd like to execute the block, but have the results for each line, like this (image obtained executing line by line):
Is it possible (via some shortcut or option)?
There's no way to do this yet, although it's something we'd like to see in future. I opened an issue to track the feature.
One thing that might help is the Shift-Enter command, which is the same as C-Enter but skips to the next code block. If you repeatedly Shift-Enter from the beginning of that block of code you'll get all of the results very quickly, if not quite instantaneously.

Resources