You shouldn't include install commands on a Rmd file, if you want to keep it there as a reference, comment the command with # so it doesn't get executed.
As another option you can also put the code in a chunk with eval = FALSE if you still want to be able to execute it interactively and be shown highlighted in the output but not run it during compilation.
Rendering a Rmarkdown should indeed not installed package - that is not recommended.
Regarding this specific error, this is because install.packages() is run non interactively and no default repos is defined in R options. Setting that would solve it, but again not recommended.
Hi, thanks i put "#" in front of install.packages, but now i get an other error saying "error in eval (expr, envir, enclos): object 'economic_data' not found ....". The thing is everything works fine when i plot everything in the other r file, so i don´t understand what the problem is.
Have in mind that when you knit an Rmd document the code gets executed in a clean environment other than the one you are currently working on so you have to include the necessary code to load any external data you are working with.
For example, if economic_data comes from a csv file, you would include something like this
@ThaBrazilianGuy , the answer given by @andresrcs is the correct one. This means that the object is not found - so it means either it is not created inside the Rmd document, or either the object is in a package you have forgot to load using library() or data(..., package = ...)
Please check you Rmd document that you did not provide to be sure that all your R object are within the document. All the R code must be able to run without external object.
okey so i solved this issue somehow, but now when i want to knit my document to word i get the following error:
namespace 'rlang' 0.4.12 is already loaded, but >= 1.0.1 is required
sry full error is:
Error: package or namespace load failed for ‘mosaic’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
Namensraum ‘rlang’ 0.4.12 ist bereits geladen, aber >= 1.0.1 wird gefordert
If you keep getting the same error message then the update process has been unsuccessful, to help you with that we need to see the complete console output you get when you try to install it.
Also, why are you trying to install it from a downloaded source file?, that is very prone to failure since you might be lacking other package dependencies or the required compiling tools. If you don't have a very compelling reason to do it that way I would strongly recommend using a normal on-line installation.
And if you still have installation problem, you could try running installation with pak
Basically what I would recommand is to be sure to close any open R (or RStudio) session, then open a new empty project RStudio (or better just R console) and then run the installation of rlang.