The problem is that when I run the code, there's no return in the console; I mean it does run the code, but does not return any output.
For example, if I write
v <- c(1, 2, 3, 4, 5) v
I would expect in return
[1] 1 2 3 4 5
But it's not working.
I have version RStudio Version 0.98.1079 and R Version 3.1.1
By default, the RStudio IDE opens a preview window to display the output of your . Rmd file. However, you can choose to display the output in a dedicated viewer pane. To do this, select “View in Pane” for m the drop down menu that appears when you click on the “Run Document” button (or “Knit HTML” button).
Interacting with RThe console window (in RStudio, the bottom left panel) is the place where R is waiting for you to tell it what to do, and where it will show the results of a command. You can type commands directly into the console, but they will be forgotten when you close the session.
Start R by double-clicking on the R icon on the desktop, or by clicking on the R icon in the start menu. The R graphical user interface (GUI) will open, containing a single window called the command or console window. The greater-than sign ( > ) is R's "prompt;" it indicates that R is ready for you to enter commands.
To execute the line of source code where the cursor currently resides you press the Ctrl+Enter key (or use the Run toolbar button): After executing the line of code, RStudio automatically advances the cursor to the next line. This enables you to single-step through a sequence of lines.
I was wondering if you had been doing a tutorial where they were demonstrating the sink
function and you hadn't gotten to the point where it was reversed.
> sink('out.txt') # diverts all output to a disk file > v <- c(1,2) > v # output went to file > sink() # sets the output back to the console > v [1] 1 2
Another way would be to call closeAllConnections
:
> sink('out.txt') > v > v > closeAllConnections() > v [1] 1 2
To address the lack of response with a "+" showing at the Rstudio console ... that is a sign that the R parser "thinks" the entered text has not completed a full R command. It may indicate that you haven't typed a closing bracket or parenthesis. If typing one or two of those is unsuccessful and you keep getting mor +
's then you may be successful with typing the [esc]
-key. If it is showing up immediately after a restart then you should check your code for correctness and make sure that the .Rdata
file is deleted from your working directory. If you don't know what that means then you may need to search for the methods appropriate to your operating system. You could also have an error in the code of one of your .rprofile
files.
In any case this has nothing to do with Rstudio per se and everything to to with the typical behavior of an R console session.
Do the lines still start with a "+"? It is also possible you forgot to close the brackets of a function. Try "}".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With