DS4PS / cpp-525-sum-2021

Course shell for CPP 525 Advanced Regression Analysis
http://ds4ps.org/cpp-525-sum-2021/
0 stars 2 forks source link

Knitting error #5

Open krittschof opened 3 years ago

krittschof commented 3 years ago

I have the following in my first chunk as always:

knitr::opts_chunk$set(echo = TRUE, message=F, warning=F, fig.align='center', fig.width=9 )

But when I knit, I receive the following error (see image):

image

Please advise. I Googled, and I am not finding a solution. Thanks, Kerri

lecy commented 3 years ago

Do you have an install.package() call in your RMD script somewhere?

Remember that you only need to install a package once, afterwards load it with the library() command. You should not include install commands in RMD files because they create errors while knitting.

lecy commented 3 years ago

The line number in bug tracking is helpful but not always accurate or precise, so take those with a grain of salt.

Typically it references the start line of a code chunk, and the error can be anywhere in the chunk.

Sometimes it is off completely if it is a complicated bug that results from dependencies in your code.

krittschof commented 3 years ago

I do remember. Thank you for that reminder. What I noticed when I install the following packages from the lecture:

install.packages( "plm" )
install.packages( "stargazer" )
install.packages( "scales" )
install.packages( "car" )
install.packages( "gplots" )
install.packages( "fastDummies" )

The last 3 (car, gplot, and fastDummies), I receive an error message saying that there are no packages call such. So when I left install.packages.... the error messages did not occur when I ran them. Hope that makes sense.

krittschof commented 3 years ago

I did change to library( ), except for the last 3 noted above

krittschof commented 3 years ago

Lastly, do we need the last 3 for the lab? Or is it just for the lecture notes?

lecy commented 3 years ago

Those packages are available via CRAN:

https://cran.r-project.org/web/packages/available_packages_by_name.html

Can you try opening an R shell and installing the packages?

R Studio sends you to their own server to install packages. Maybe these packages are not archived there?

Otherwise let me know what errors you get.

lecy commented 3 years ago

I don't know which you need for the lab off the top of my head, but it might be none.

krittschof commented 3 years ago

I have updated (Under Tools) and then installed the packages under Tools (they appear there), but when I run the library() of the packages, I receive "Error in library ("car") ; there is no package called 'car'. This error message occurs for gplots and fastDummies.

krittschof commented 3 years ago

I also receive this message: "WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:"

I closed out and did an update in R (appears not correctly) via the previous message.

lecy commented 3 years ago

The packages are not installing properly then.

Rtools is a separate install. I suspect if you install that first then try installing the other packages it will fix the issue.

If you don’t need the packages, though, skip it.

lecy commented 3 years ago

Skip it = just remove the library() calls for those packages from your RMD file.

krittschof commented 3 years ago

I had a colleague look at what was going on, It was Drop box that was inhibiting the install. He unlocked it, but R is still running through dropbox. Do you know how to stop that????

lecy commented 3 years ago

Interesting! I have not encountered this before.

What does it mean for something to run through Dropbox?

Program files are usually installed in a root directory.

C:\Program Files\R

If R is installed somewhere else, you might want to remove it and re-install in the root directory? That should happen by default, but maybe pay attention during the install process.

And packages are installed in your local library, which typically defaults to the documents folder:

C:\Users\username\Documents\R\win-library\4.0

I suspect this is your problem: packages, not the R software itself?

Are you archiving files in the Documents folder with Dropbox?

Do you have the option activated where you archive all files on your computer with Dropbox?

image

krittschof commented 3 years ago

I do not actively store in dropbox (well not my intention anyway), I will check your suggestion out above and let you know. Thank you.