所以我在Rstudio上使用installR将R更新到版本4.0.0,并将我的包文件复制到R中的库文件中,目录是:C:\\Users\\Ibrahim\\Documents\\R\\R-4.0.0\\library
每当我调用一个包时,例如 tidytext,它会给我:
\nlibrary(tidytext)\nError: package or namespace load failed for \xe2\x80\x98tidytext\xe2\x80\x99:\n package \xe2\x80\x98tidytext\xe2\x80\x99 was installed before R 4.0.0: please re-install it \n
Run Code Online (Sandbox Code Playgroud)\n然后我尝试安装它,它会给我:
\ninstall.packages('tidytext')\nWARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:\n\nhttps://cran.rstudio.com/bin/windows/Rtools/\ntrying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/tidytext_0.2.4.zip'\nContent type 'application/zip' length 3008780 bytes (2.9 MB)\ndownloaded 2.9 MB\n\npackage \xe2\x80\x98tidytext\xe2\x80\x99 successfully unpacked and MD5 sums checked\n\nThe downloaded binary packages are in\n C:\\Users\\Ibrahim\\AppData\\Local\\Temp\\Rtmpmo5Lza\\downloaded_packages\n
Run Code Online (Sandbox Code Playgroud)\n再次调用它会给出:
\nlibrary(tidytext)\nError: …
Run Code Online (Sandbox Code Playgroud) 假设我有这个清单:
values <- list(2, 8, 3, 21, 54, 2, 43, 31)
countries <- list('US', 'UK', 'China', 'US', 'Russia', 'UK', 'US', 'China')
names(values) <- countries
Run Code Online (Sandbox Code Playgroud)
然后,值看起来像:('US' = 2, 'UK' = 8, 'China' = 3, 'US' = 21, 'Russia' = 54, 'UK' = 2, 'US' = 43, 'China' = 31)
R 中是否有内置函数或某种简短的方法来添加重复项的值?意思是,让值变成:(('UK' = 10, 'China' = 34, 'Russia' = 54, 'US' = 66)
顺序并不重要)