R studio console suddenly does not show output - r

here are my console output examples
as you see, there are no output values when using r studio console.
Actually, there are many related issues about this, but no clear solutions. Only a temporal or Adhoc solution like: restart R or using r notebook script.
Anyway, this phenomenon happens just 1 day ago, with the same code, same operations.
At the first time, console works and a few minutes later it doesn't work.
It is so annoying me to restart or run r notebook script...
Is anybody have the same issues as me?
(I cannot give reproducible data, because it works well the other's computer)

Click on the gear icon beside knit and make sure that "chunk output in console" is enabled.

Related

R console only shows text/comments

My R console seems to be stuck or something. It only shows the comments and doesn't execute the commands. I have had this more often. In the beginning R works fine and then at some point it stops working and only shows the comments. Is there a way to fix this?

How can I run multiple lines of code in R

I have just switched from windows 7 to windows 10 on my pc.
When I was still using windows 7, using the combination CTRL+R or CTRL+ENTER would run the line of code that I was in. Moreover, if the code continued on one or more lines below or started above my current line, it would run the entire section without me having to select it.
After switching to windows 10, the same combinations will only run the line of code that I am currently in, or the piece of code that is selected by me. To give an example:
#Tryout
for(i in 1:3){
print(i)
}
This code would normally run at once without having to select it, even when I would start in the first line (#Tryout). Now, if I don't select, I will need to use CTRL+R or CTRL+ENTER three times to go through this code and I have to start in the correct line. Starting in the line #Tryout will not run any part of the code but will only result in the line #Tryout being shown in the console.
I'm not good with computers (in your answers please pretend to be adressing a five-year-old) so I had one of my colleagues look at it who's our expert on R. Here are the findings:
The problem occurs in both RStudio as the standalone version of R.
I'm using R version 3.3.2, the same as before the windows update. Switching to version 3.5 didn't solve the problem.
I have other colleagues also using R 3.3 in combination with windows 10 for whom this problem does not occur.
Going to Tools-Global Options-Code and checking the box of 'Focus console after executing from source' doesn't help
When we went to 'Modify Keyboard Shortcuts', the name attached to the shortcut (CTRL+R or CTRL+ENTER) was the same as it was for other colleagues for which the function does run all lines in a command: 'Run Current Line or Selection'
The problem is not preventing me from using R, but it is tedious and I hope someone can help me to solve it.
Thanks so much for reading!
Click on header Tools, then Global Options..., then Code, then Ctrl + Enter Executes and choose Multi-line R statement
#M Waz & #Just Burfi: I know I can select the code and then run it, that works fine. But I don't want to have to manually select the code all the time.
#Clemsang: your answer puzzled me for a moment because I didn't have the CTRL + Enter Executes that you were referring to. I went back to my colleague who had the bright idea to check the version of RStudio that I was using.
As it turns out, I was using an old version (0.99.903). Now that I've installed a newer version (1.1.463), running the code works as before! I also have the CTRL + Enter Executes now.

Atom and Hydrogen: Output and console

I'm a Python beginner and recently came across the Atom editor and the package Hydrogen, that implements the Jupyter notebook. I did so after realizing that running the notebook in Chrome consumed way too many resources and also seemed to be a bit slower.
However, the Atom editor and Hydrogen always output prints within a little frame in the code (see image). Unfortunately, it doesn't use the full window width. I also don't see any console/terminal for installing pip libraries.
Is there a way to have the output in a console below the code, just as in Jupyter, and to have a terminal?
this comes most certainly too late, but in case someone else searches for this:
hit control+shift+P / cmd+shift+P and type "toggle output area".

RStudio does not display any output in console after entering code

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
Possibility 1 (until the + sign was mentioned): 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
Possibility 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 these two possibilities have nothing to do with Rstudio per se and everything to to with the typical behavior of an R console session in pretty much any IDE.
Do the lines still start with a "+"? It is also possible you forgot to close the brackets of a function. Try "}".
I had the same issue and none of the tips mentioned here were working.
Session > Restart R did the trick for me, possibly suggesting that I had a similar problem as andrewH but was not patient enough to wait for R to behave again.
This is a very old question, but I just had the same problem with a different cause, so I thought I would describe it here case it should be useful to someone else. I was getting the regular command prompt, with nothing more, no matter what I typed at the command line. I tried multiple returns, escape, sink, traceback, closeAllConnections (which did give me a response, "error: unexpected ) in (), but then went back to the command prompt and ignored a second traceback).
Anyway after half an hour or so of pulling my hair out, up pops "View(Mid2)". Mid2 is a tibble with 8.5 million observations of 88 numeric variables. I must have tapped it in the environment pane accidentally. I suppose it just took that long for the viewer to render it. I assume that all the other things I did hit at once, because RStudio crashed immediately thereafter.
The interesting thing about this particular version of the problem is what didn't happen. The red stop sign in the upper right of the console window, that lights when R is busy, didn't light. That is unfortunate -- but understandable, if the RStudio viewer is a different process. But also, when my computer is working hard on a really big computation or IO task, the fan usually starts, but it didn't. Don't know why. . I took its absence, incorrectly, to mean no such computation was underway.
If the lines in console are starting with "+".
Save your work and close the 'RStudio' or other tool which you are using and Start it again, it worked for me.
If you are using R Studio Cloud, refresh or re-opening won't work.
Only clue from the above posts or answers is your console will always start with '+'
In my case I tried all possibilities of closing braces.
And ")" worked for me when I typed that into the console and press enter.
sink() function did nothing in R Studio Cloud
A simple mistake might have also caused this problem:
A rather lengthy command left abandoned in the console is blocking the appearance of the result line.
Thus, the console only shows that line, but the result from any code run from the source, will not appear.
To solve this, just switch to the console, remove any remaining command and try again.
Experiencing something like that explained here as an unresponsive console to the R-Code running was just devastating for me when I experienced it. But luckly although I tried every trick explained in this page, it did not work for me. At last I clicked on the "To console" option available just below the Environment, History, Connections, Tutorial Tab on the R Studio. It solved the puzzle for me just now.
The best solution I've found is closeAllConnections and/or sink which almost always work
But as a stop gap measure, View()'ing always works. It's sort of a pain but whatever you wanted to print out, surround by View and you can see it

Preventing what was/were previously copied on to my clipboard from appearing on R Console when using R

I am having some problems with my clipboard contents when using R. When I run my scripts/commands in tinn-r, very often I would get something that I had ran earlier pasted onto my R Console instead of the command that I have just selected.
To get over this, I would go to my clipboard and delete its content(text/syntax). However, the same text/syntax that I had just deleted would re-appear on my clipboard and would again appear on my R Console when trying to run a different syntax from my tinn-r.
Good luck. Tinn-R seems to be a particularly buggy way of interacting with R. Though it takes some effort to set up, the StatET plugin interface from Eclipse has been working way better for me than Tinn-R ever did.

Resources