Can't compile an R script


I am trying to compile an R script by clicking on the notebook icon.

However, I keep getting this error:

Error in contrib.url(repos, "source") :
trying to use CRAN without setting a mirror
Calls: ... withVisible -> eval -> eval -> install.packages -> contrib.url
Execution halted

Could anyone please let me know how I can compile my script? Thank you!

Can you clarify please? R is an interpreted language so there is no compiling, maybe you actually mean that you are trying to knit your document?

This suggests that you are including install commands in your Rmd file, you shouldn't do that, you only need to install packages once, if you include these commands in your file, R is going to try to install them each time you knit your document.

I have an R script (.R) and I wanted to ''transform'' it into something like in R markdown or a jupyter notebook, however, R markdown won't run some of my lines of code and jupyter notebook uploads my script as text.

At the top of my script, next to a ''wand'' there's a notebook that says ''compile report'' and that's what I was using.

Is there another way to approach this issue?

I don't use Jupyter, I use R and RStudio so I will restrict my comments to that.

Have you therefore rewritten your script placing the 'code' portions you want into designated code blocks, using backticks etc, and otherwise adding your own text around it ? the rmarkdown headers are important also I believe.

I tried line by line but at some point it had problems running.

I guess my overall question would be if there is a quick way of transfering my R script to an R markdown instead of having to input each bit of code line by line.

Thank you!

You can familiarise yourself with the basics. With this resource.

Presumably the simplest thing you can do, is have your headers and make a single code chunk for all your old rscript.
However I don't see this giving you any advantage over the plain r script. But I suppose you can start there and iterate.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.