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.
Related
I'm using RStudio 1.4.1106 for MacOS.
I'm continuing with writing my package functions. Some of them are quite long and involve branching methods depending on the nature of the input data. The branching involves if loops, and there are sub-if loops as well.
I comment the close brackets so I can back track to the start line of the loop (I don't use line numbers because I am frequently modifying code and the line numbers change). My current method to verify I have the correct loop selected is to go to the left of the close bracket and then identify the open bracket by the fact it is highlighted.
Is there a method of highlighting an entire loop code block? In particular, this would make it easier for me to comment out an entire block of code without worrying I have commented out too much or too little.
There are a few things that will make your life easier:
There are arrows next to the line numbers that will collapse a code block (I think determined by the braces {}). You can collapse from the top (e.g. line 109 in the screenshot attached) or the bottom (line 125 in the screenshot).
The other thing that can help if you want to examine code within a block is that double clicking just before or after the opening or closing brace will highlight all the code enclosed by the matching braces. See second screenshot below: .
Edit: Just noticed the comment - as mentioned you can also highlight code while the section is collapsed, and it will stay highlighted when expanded.
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.
Basically, I want to write a program to transform R code into Latex formulas. For example, I want to build some sort of converter where, when I have, as input, mean(x) it will return $\frac{1}{n}\sum_{i=1}^{n} x_{i}$ - latex code for the formula. I would to this for a group of formulas I have to basically make my job easier.
Although this might be some work, I would still like to do it. Basically I would tell the program to return $\frac{1}{n}\sum_{i=1}^{n} everytime he finds the word mean; to, by default, transform x into x_{i}, this type of thing.
What language should I use to build such a program? Or does this already exist? I've looked online and found nothing of the sort... Would you say this is extremely difficult to do?
Thanks everyone!
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)
This sounds like a silly question, but I really can't find an answer around.
I'm using Scilab to evaluate two methods in terms of performace. However, every time I tell Scilab to calculate anything, it will print the results. Since I'm using large matrices, it spends much more time printing the results than doing the calculations, so I'm having a hard time telling how long is each method actually taking.
Can I get Scilab to compute something without printing the result?
That is, instead of
-->B = A'*A
A =
1. 2. 3.
2. 4. 6.
3. 6. 9.
-->
I'd like it to do
-->B = A'*A
-->
Also simply adding a semicolon works
-->B = A'*A;
-->
Well, I finally found the right query. When I searched for 'scilab silent', one of the results (not the first) was this:
http://help.scilab.org/docs/5.3.3/en_US/mode.html
Function mode(k) lets you choose how Scilab will behave in terms of variable display. The following call will temporarily hide results:
mode(-1)
Whereas this will get you back to the default option:
mode(2)
The documentation is confusing, though.
Please notices that mode does not used at prompt, only in an exec-file or a scilab function.
Aside from the awful English, this notice seems to be outdated. This function worked perfectly for me on the prompt.