Questions tagged [rstudio]

RStudio is an IDE for the R statistical programming language. DO NOT use this tag for general R programming problems, just use the R tag. ONLY use for RStudio-specific questions.

rstudio
Filter by
Sorted by
Tagged with
318 votes
10 answers
583k views

Update R using RStudio

How can I update R via RStudio?
AdamNYC's user avatar
  • 20k
286 votes
16 answers
698k views

Change R default library path using .libPaths in Rprofile.site fails to work

I am running R on Windows, not as an administrator. When I install a package, the following command doesn't work: > install.packages("zoo") Installing package(s) into ‘C:/Program Files/R/R-2.15.2/...
I Like to Code's user avatar
239 votes
4 answers
272k views

R - Markdown avoiding package loading messages

I have been using Knitr via R-Studio, and think it is pretty neat. I have a minor issue though. When I source a file in an R-Chunk, the knitr output includes external comments as follows: + FALSE ...
Roark's user avatar
  • 2,585
216 votes
9 answers
89k views

Difference between R MarkDown and R NoteBook

I am trying to understand at a high level what the differences between R Markdown and R NoteBook. I know they are interrelated but I would like to figure out how they are related. My understanding is ...
PagMax's user avatar
  • 8,298
125 votes
19 answers
82k views

rJava load error in RStudio/R after "upgrading" to OSX Yosemite

I recently "upgraded" from OSX Mountain Lion to Yosemite and from R 3.1.3 to 3.2. Immediately after the upgrade, when I opened R or RStudio I got a pop-up message saying that I needed to install Java ...
eipi10's user avatar
  • 92.7k
114 votes
6 answers
77k views

Rstudio rmarkdown: both portrait and landscape layout in a single PDF

I wonder how to use rmarkdown to generate a pdf which has both portrait and landscape layout in the same document. If there is a pure rmarkdown option that would be even better than using latex. Here'...
user3712688's user avatar
  • 1,161
114 votes
5 answers
140k views

ggplot plots in scripts do not display in Rstudio

I have a strange issue with Rstudio: If a script calls ggplot2 functions to display a plot, then using Source to run the script does not produce the plots. If I select the whole script with Ctrl+A, ...
Superbest's user avatar
  • 26k
105 votes
6 answers
105k views

Auto-format R code in RStudio

Is there any possibilities for auto-formatting code in RStudio? I found this, but it is not connected with RStudio. Also it is desirable that it be customizable formatting.
midas's user avatar
  • 1,828
102 votes
3 answers
139k views

Understanding user file ownership in docker: how to avoid changing permissions of linked volumes

Consider the following trivial Dockerfile: FROM debian:testing RUN adduser --disabled-password --gecos '' docker RUN adduser --disabled-password --gecos '' bob in a working directory with nothing ...
cboettig's user avatar
  • 12.5k
85 votes
5 answers
129k views

Code to clear all plots in RStudio

I have code to clear the workspace: rm(list=ls()) and code to clear the console: cat("\014") Is there code to clear all plots from Rstudio?
dpel's user avatar
  • 2,045
80 votes
5 answers
12k views

Rstudio and Google Drive Syncing Problems: "The process cannot access the file because it is being used by another process"

So I'm using RStudio and storing my files on Google Drive (the version with folders on your system, acting like Dropbox). I'm using it because it provides a lot more space for free than Dropbox, and I ...
jpm_phd's user avatar
  • 915
79 votes
5 answers
42k views

R knitr Markdown: Output Plots within For Loop

I would like to create an automated knitr report that will produce histograms for each numeric field within my dataframe. My goal is to do this without having to specify the actual fields (this ...
bnjmn's user avatar
  • 4,548
75 votes
4 answers
54k views

How to convert R Markdown to HTML? I.e., What does "Knit HTML" do in Rstudio 0.96?

What commands are run when pressing "Knit HTML" on an R Markdown file in Rstudio 0.96? My motivation is that I might want to run the same command when I'm in another text editing environment or I ...
Jeromy Anglim's user avatar
75 votes
2 answers
15k views

"long vectors not supported yet" error in Rmd but not in R Script

I am operating matrices with R 3.1 and RStudio 0.99. I have my R Script and with cmd+enter it works without problem. I created an Rmd for reporting but I have this error Error in ...
pachadotdev's user avatar
  • 3,459
74 votes
1 answer
48k views

avoid string printed to console getting truncated (in RStudio)

I want to print a long string to the RStudio console so that it does not get truncated. > paste(1:300, letters, collapse=" ") [1] "1 a 2 b 3 c 4 d 5 e 6 f 7 g 8 h 9 i ... 181 y 182 z 183 a 184 b.....
Mark Heckmann's user avatar
74 votes
4 answers
134k views

Scale and size of plot in RStudio shiny

Related, but only talks about the allocated plot space in general, not how to directly set the plot image size and then scale it to fill the desired space Shiny Chart Space Allocation I'm creating a ...
Hendy's user avatar
  • 10.4k
73 votes
8 answers
114k views

multiple authors and subtitles in Rmarkdown yaml

I'm trying to follow this pandoc example to add multiple authors to an Rmarkdown file in the yaml metadata block. The pdf will generate in RStudio (Version 0.98.932), but there is no author ...
Eric Green's user avatar
  • 7,495
73 votes
6 answers
70k views

The R console is in my native language, how can I set R to English?

I am using R on Windows 7. Apparently R somehow found evidence that I speak languages besides English, and stubbornly insists on giving output in the console in my own language. For a variety of ...
Superbest's user avatar
  • 26k
70 votes
8 answers
63k views

How to use objects from global environment in Rstudio Markdown

I've seen similar questions on Stack Overflow but virtually no conclusive answers, and certainly no answer that worked for me. What is the easiest way to access and use objects (regression fits, data ...
Adam Robinsson's user avatar
67 votes
9 answers
132k views

Rtools not being detected by R

Update: I've written a brief walkthrough guide to installing Rtools on windows. Original: I am trying to build an R package using RStudio on Windows 7. When I attempt to build the package via ...
coatless's user avatar
  • 20.4k
66 votes
7 answers
30k views

two-column layouts in RStudio presentations/slidify/pandoc

I'm trying to come up with a good system for generating slides and accompanying handouts. The ideal system would have the following properties: beautiful in both presentation (PDF/HTML) and handout (...
Ben Bolker's user avatar
  • 218k
63 votes
6 answers
148k views

Reset the graphical parameters back to default values without use of dev.off()

Such as margins, orientations and such... dev.off() does not work for me. I am often using RStudio, with its inbuilt graphics device. I then have plotting functions, which I want to plot either in ...
Cookie's user avatar
  • 12.3k
61 votes
6 answers
91k views

suppress console output in r markdown, but keep plot

Hi I have the following markdown chunk: ```{r, echo=FALSE,warning=FALSE,message=FALSE,error=FALSE} lapply(obj,function(x) plot(x,main="some plot") box() axis(1,at=seq(0,25,by=1)) ``` The output is ...
brucezepplin's user avatar
  • 9,492
60 votes
2 answers
75k views

How to run an entire R script at once [closed]

How do I run an entire R code script in RStudio? When I click on the Run button in RStudio, the code runs only on a line-by-line basis and I want it to execute all the code at once instead of ...
alphabeta's user avatar
  • 757
60 votes
1 answer
7k views

Difference: "Compile PDF" button in RStudio vs. knit() and knit2pdf()

TL;DR What are the (possibly unwanted) side-effects of using knit()/knit2pdf() instead of the "Compile PDF"1 button in RStudio? Motivation Most users of knitr seem to write their documents ...
CL.'s user avatar
  • 14.8k
59 votes
4 answers
61k views

How do I open a script file in RStudio using an R command?

I have a simple script file called test.R. It's saved in the working directory. When I go to File > Open > test.R, it opens the file in the editor (without executing the code, which is what I ...
user3654852's user avatar
58 votes
1 answer
3k views

Persistent warnings from earlier commands with RStudio

I'm struggling to create a reproducible example for this, but I suspect others will know what I mean. Why does R sometimes seem to get stuck with a backlog of warnings/error messages that it repeats ...
geotheory's user avatar
  • 23k
57 votes
10 answers
40k views

Rstudio difference between run and source

I am using Rstudio and not sure how options "run" and "source" are different. I tried googling these terms but 'source' is a very common word and wasn't able to get good search results :(
user2543622's user avatar
  • 6,228
56 votes
2 answers
111k views

How to use Rstudio relative paths

How can I use relative paths in a RStudio project environment? For example, to access a file, I use the whole path: # My RStudio project working directory: getwd() [1] "C:/Users/MaurizioLocale/...
Worice's user avatar
  • 3,917
54 votes
3 answers
32k views

R: In RStudio how do I make knitr output to a different folder to avoid cluttering up my drive?

I am using RStudio's knit HTMl function to output some presentations. But it always outputs the files to my current work directory. How can I make it output to another directory so that my directory ...
xiaodai's user avatar
  • 15.3k
52 votes
5 answers
92k views

How to output text in the R console without creating new lines?

I would like to output a progress indicator during my lengthy running algorithms. I can easily "bubble up" a progress value from within my algorithm (e.g. via invoking a provided function callback ...
DuckMaestro's user avatar
  • 15.5k
52 votes
2 answers
62k views

In RStudio/RMarkdown, how to setwd?

setwd in an Rmd file in RStudio does not appear to change the directory in subsequent chunks. Is there a way to set the working directory for good? Example: ```{r} setwd("/tmp") getwd() ``` ```{r} ...
user650654's user avatar
  • 5,838
50 votes
7 answers
53k views

Setting work directory in knitr using opts_chunk$set(root.dir = ...) doesn't work

My R project is structured like a package with directories /R, /vignettes, /data etc. In one of my Rmd docs in /vignettes I source a script which in located in /R. Inside this script I use read.csv() ...
Thomas Neitmann's user avatar
50 votes
1 answer
16k views

Renaming RStudio project under version control

What's the right way to rename an RStudio project (esp., when that project is under version control)? E.g., I created an RStudio project with version control in "~/myproject". Then I decided I wanted ...
lowndrul's user avatar
  • 3,755
49 votes
12 answers
32k views

How to add a page break in word document generated by RStudio & markdown

I writing a Word document with R markdown in R Studio. I can get many things, but at the moment I am not figuring out how can I get a page break. I have found solutions but only for rendered latex / ...
Giorgio Spedicato's user avatar
49 votes
4 answers
59k views

How to indent multiple lines of code in Rstudio?

I have tried using "reindent lines" after highlighting the lines but that doesn't work (in fact it removes indentation). For example I want a quick way to take a script like this #parameters b=2 c=1 ...
WetlabStudent's user avatar
46 votes
5 answers
22k views

What is a neat command line equivalent to RStudio's Knit HTML?

What is a neat command line equivalent to RStudio's Knit HTML? Given an .Rmd file, you can use RStudio to knit .html, .docx and .pdf files using Knitr. It would be great to shift this process ...
elke's user avatar
  • 1,230
46 votes
3 answers
16k views

How to fast insert new 'pipe operator' in Rstudio?

I have been using the ctrl + shift + m shortcut to insert well known %>% pipe operator. Since the release of R version 4.1.0 and adding a new |> to base, I wonder is the corresponding shortcut ...
dy_by's user avatar
  • 1,171
46 votes
2 answers
83k views

In R markdown in RStudio, how can I prevent the source code from running off a pdf page?

I currently have some code that looks like so: ```{r, tidy=TRUE} plot(DT$age, DT$height, xlab = "Age of participant in Trials", ylab = "Height of participant in Trials") ``` Now, it was my ...
user1398057's user avatar
  • 1,119
45 votes
2 answers
25k views

How can I use spell check in Rmarkdown?

I want to write a report with Rmarkdown. However, I am a little worried about my spelling. I hope there is a package installed in my Rstudio which can automatically help me spell check. So, is there ...
medfordwinter's user avatar
45 votes
1 answer
3k views

Operator "[<-" in RStudio and R

By accident i've encountered strange behaviour of "[<-" operator. It behaves differently depending on order of calls and whether i'm using RStudio or just ordinary RGui. I will make myself clear ...
BartekCh's user avatar
  • 920
44 votes
9 answers
70k views

How to get unsaved script tabs

I would like to know, if it is possible to get unsaved script tabs in R studio. I accidentally open and switch to new project, then my unsaved scripts disappeared. Can anyone help to get my unsaved ...
Agaz Wani's user avatar
  • 5,594
44 votes
5 answers
92k views

Restart R within Rstudio

I'm trying to call a simple python script from within R using system2(). I've read some information I found vague that said if 'too much' memory is used, it won't work. If I load a large dataset and ...
Ben Hunter's user avatar
43 votes
2 answers
52k views

How to hide code in RMarkdown, with option to see it

I'm writing an RMarkdown document in which I'd like to re-run some chunks (5 to 9). There's no need to display these chunks again, so I considered using ```{r echo=FALSE} to make the rerun chunks ...
RobinLovelace's user avatar
43 votes
14 answers
79k views

pandoc document conversion failed with error 43 : pdflatex: The memory dump file could not be found

RStudio : 0.98.994 OS: Microsoft Windows 7 Ultimate Edition, 64-bit Service Pack 1 MiKTeX: 2.9.4503 Hi, I get the following error when I try to knit a PDF document. pandoc.exe: Error producing PDF ...
Bharathi Boyareddigari's user avatar
42 votes
10 answers
28k views

Check if R is running in RStudio

I am looking for a way to test if R is being run from RStudio. For some reason I could find the answer on google yesterday but not today, but I think it had to do with testing if a certain system ...
Sacha Epskamp's user avatar
42 votes
9 answers
108k views

How to preserve formatting from rstudio when copy/pasting to Word?

I want to reproduce my code in Word 2010. The scripts were written in rstudio, and I would like to preserve rstudio's formatting when pasting into Word. Principally, I like the font colors and ...
dubhousing's user avatar
42 votes
5 answers
115k views

How do you change the default directory in RStudio (or R)?

I consulted http://www.rstudio.com/ide/docs/using/workspaces and tried the setwd code and clicking on More --> Set as working directory options. However, the next time I closed and opened RStudio, it ...
user3380666's user avatar
42 votes
1 answer
30k views

Renaming Objects in RStudio context sensitive within entire Project

I have an issue when developing an R project using RStudio. I create an object, and then realise later, that I want to give it another name. I then have to manually change the name, which in larger ...
David Go's user avatar
  • 840
42 votes
2 answers
99k views

How to uninstall R and RStudio with all packages, settings and everything else?

I messed up something and there is a problem with tidyverse. Tried to find a solution but spend lots of time without result. How to uninstall R and RStudio with all packages, settings and everything ...
vasili111's user avatar
  • 6,522

1
2 3 4 5
159