I use R and MATLAB from the command line and edit files with external editors. In MATLAB, the command workspace opens a graphical window with a list of all variables and the current values. If I double click on a complex object, like a matrix, MATLAB automatically opens another window with a table containing the values.
Is there any similar way to do so in R?
In this link, in the end of the first "box", it is listed the command browse.workspace, which seems what I am looking for. Unfortunately I cannot invoke it.
I tried with commands which prints output in the terminal (like str(as.list(.GlobalEnv))) but I do not like the result. When I have got a lot of variables it is a big mess.
Related
I am interested in using Wolframscript to perform certain operations in R but am a bit new to programming at a level beyond data analytics.
It is rather easy to start a terminal running wolframscript:
rstudioapi::terminalExecute("wolframscript")
will open it in a terminal tab. Indeed, one can also run lines of code via CTRL+ALT+ENTER. My question, then, is how would one attempt to run commands toward the mathematica terminal and retrieve results thereafter?
My main goal is to create some loop to send code and receive output- here's an example of the general idea:
X <- rweibull(100,1.5)
A <- vector(length=100)
for (a in 1:length(A)){
send_code_to_Wolfram(Integrate[(E^(TX[a]u))*(E^(Bu)),{u,0,X[a]}])
A[a]<-Output_from_wolfram }
Where T and B are matrices, send_code_to_Wolfram and Output_from_wolfram are undefined functions. Here, the obvious use of wolframscript would be to utilize its numerical integration and matrix exponentiation capabilities which are mostly unavailable in R.
Would anyone know how this might be possible to implement?
EDIT:
It seems that I can send code via naming the terminal and then using the TerminalSend command, though it does not submit (it merely enters it into the input line)
There are numerous Jupyter Kernels available. I'm also aware of some projects for running one language embedded in another e.g. rpy2. However, i'm interested to know if it's possible (or if there are plans) to combine different kernels together in a single notebook?
So say I would have one cell in python code, and another in scala code, the same way that I currently can have a code cell (press y on a cell) as well as a markdown cell m.
Ideally one should be able to pass variables back and forth, but for this question I'd just be looking to be able to have two different 'code cell' types, without them being aware of each other (so I could have for example a python variable assignment x = 1 and a scala val x : Int = 2 and they wouldn't be aware of one another).
Is is possible to manually switch kernels from cell to cell. I've tested going from Python to Julia to R. Works fine. HOWEVER, the namespaces are wiped clean so you would have to maintain state externally if you wanted to switch back and forth.
Wouldn't guarantee sane behavior though. Don't know how you would automate the kernel switch
Is there an R editor that looks similar to Mathematica?
In Mathematica, we have cells, where we can write our code. We can then run that code, and the output shows in another cell below. The cells are independent, and in a way I can run all the functions I want independently, and if the output is too much, I just double click on the right side, and the output cell hides all info, but the first line. Also, there's this pretty colour matching so that we do not forget to which '(' matches ')' and so on.
Any help would be appreciated.
I am inspecting research data from NIR spectroscopy. Unfortunately, the output is too big (2048 rows with 15 columns).
Very often, when I try to check a variable like mymodel$loadings my results get truncated.
I understand that I can increase the max output of my terminal, but it's really a hassle to scroll my mouse up from my terminal window. Is there a way I can tell R to pipe the output from my last statement to less or more so I can just scroll using the keyboard?
Are you using a version of RStudio? I would generally look at tables like this in the Data Viewer pane, it allows you to see all data in tables like yours a lot easier.
Access by clicking on the data frame name in top right, or using below in console:
View(dataframe_name)
Cells in MS-Excel are always actives. Formulas update automatically when any value is modified. In R-Excel, I put data into R array/Dataframe and use it in a formula, and get the output.
When I change any data, I have to do all steps again to get the modified result. I want to do it automatically without writing any macros as excel does. I may do it to create an excel macro, but I don't want to.
Or how to keep data into R-Excel in active cell, so R may take the current value of every variable for every run/execution of R-commands.
Can anyone tell me the solution?
RApply should do what you want.