Issues installing packages


#1

Hey everyone, I’m an MPH student new to R. I’ve had repeated issues using packages that I have already installed and run (with library). I get an error message: could not find (package). Any tips? Thanks!


#2

Did you recently update your version of R to 3.4.2 which came out last week? If so when you installed it, you may not have copied all of your packages over to the updated version.

Also, is the issue you’re having only in loading the packages, such as through the library() command or using the pane in RStudio? Or are you unable to install new packages at all using the install.packages() command?

If it’s the former issue, you can always try reinstalling the packages and try it again.


#3

No recent updates. I am able to install and load the packages using install.packages and library(package). But then when I try to run a function, such as oddsratio which should have been in the oddsratio package, I get "Error: could not find function “oddsratio” ". I’ve restarted R, uninstalled and reinstalled several times without change.


#4

Have you experienced this issue with any other packages? Just took a quick look through the oddsratio documentation (https://cran.r-project.org/web/packages/oddsratio/oddsratio.pdf) and it doesn’t appear to have a function called oddsratio. Packages do not always have a function that is the same as the package name so it is always a good idea to read the documentation to make sure you are using the package/function correctly.

Since you said you are new to R, how are you learning it? If you are looking for a good introductory book, R for Data Science is very popular and easy to follow. It will take you step by step through many different areas such as visualization, communication, data wrangling, and modelling. I would look into it and it can be found online here:


#5

Maybe I’m misunderstanding - I thought this help section implied the function was oddsratio, or oddsratio.midp, etc. Is there a faster way to find the functions the package includes rather than reading the documentation?

Yes, I’ve had this issue with some other packages, but restarting and installing them again fixed it. This time is different. Thank you for the book recommendation - I’m going to get it!!


#6

That function help page appears as though it’s from the epitool package documentation, so try loading that package and see if your code will run correctly. The good news though is that you are reading the documentation correctly. An easy way to tell which package a function is found in is at the top left of the help pane it will say something along the lines of "oddsratio {epitools}.

The easiest way that I’ve found is using google to find the exact help page of the function I’m looking for, which is how I found that the oddsratio is found in epitools rather than in oddsratio.


#7

@aball1wb Did you get everything to work? Or are there still issues?