rstudio / rstudioapi

Safely access RStudio's API (when available)
http://rstudio.github.io/rstudioapi
Other
167 stars 37 forks source link

Hmisc load pkg error #116

Open kristinoble opened 5 years ago

kristinoble commented 5 years ago

I've tried to use the rcorr function in this pkg and receive error message that the function does not exist, which tells me there was an error in pkg download. I have tried the same code and data in R 3.4.3 R 3.4.4 and Rstudio 3.4.4.

It is saying there i sno pkg called rstudioapi...how do I fix this?

install.packages("Hmisc", dep=TRUE) Installing package into ‘C:/Users/#####/Documents/R/win-library/3.4’ (as ‘lib’ is unspecified) trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/Hmisc_4.1-1.zip' Content type 'application/zip' length 1818563 bytes (1.7 MB) downloaded 1.7 MB

package ‘Hmisc’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in C:\Users\A059915\AppData\Local\Temp\RtmpeOjyRS\downloaded_packages

library(Hmisc) #Correlation tables Loading required package: lattice Loading required package: survival Loading required package: Formula Loading required package: ggplot2 Error: package or namespace load failed for ‘Hmisc’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘rstudioapi’

x <- c(-2, -1, 0, 1, 2) y <- c(4, 1, 0, 1, 4) z <- c(1, 2, 3, 4, NA) v <- c(1, 2, 3, 4, 5) rcorr(cbind(x,y,z,v)) Error in rcorr(cbind(x, y, z, v)) : could not find function "rcorr"

tanguojeng1982 commented 4 years ago

Sometimes there are other packages that have a function named "rcorr". You might want to try specify that rcorr from the Hmisc package with "Hmisc::rcorr( )". Hope this helps.