简体   繁体   English

如何在 RStudio 上正确安装 googlevis package?

[英]How to install googlevis package properly on RStudio?

IDC4U_Unit 4_Data Visualization IDC4U_Unit 4_数据可视化

# #

Load Packages加载包

# #

install.packages("googleVis") WARNING: Rtools is required to build R packages but is not currently installed. install.packages("googleVis") 警告:构建 R 软件包需要 Rtools,但目前尚未安装。 Please download and install the appropriate version of Rtools before proceeding:请在继续之前下载并安装适当版本的 Rtools:

https://cran.rstudio.com/bin/windows/Rtools/ trying URL ' https://cran.rstudio.com/bin/windows/contrib/4.0/googleVis_0.6.4.zip ' Content type 'application/zip' length 940725 bytes (918 KB) downloaded 918 KB https://cran.rstudio.com/bin/windows/Rtools/ trying URL ' https://cran.rstudio.com/bin/windows/contrib/4.0/googleVis_0.6.4.zip ' Content type 'application/zip'长度 940725 字节 (918 KB) 下载 918 KB

package 'googleVis' successfully unpacked and MD5 sums checked Error in install.packages: ERROR: failed to lock directory 'C:\Program Files\R\R-4.0.0\library' for modifying Try removing 'C:\Program Files\R\R-4.0.0\library/00LOCK' package 'googleVis' 成功解压并检查了 MD5 和 install.packages 中的错误:错误:无法锁定目录 'C:\Program Files\R\R-4.0.0\library' 以进行修改尝试删除 'C:\Program Files\ R\R-4.0.0\库/00LOCK'

library(googleVis) Error in library(googleVis): there is no package called 'googleVis'图书馆(googleVis)图书馆(googleVis)中的错误:没有名为“googleVis”的package

# #

Load Canada Imports Data加载加拿大进口数据

# #

Imports <- read.csv("C:/Users/jaysu/OneDrive - orchestrate cutting-edge web-readiness/VHSOntario12/IDC4U/cansimMotionChartImports.csv") head(Imports) Ref_Date GEO TRADE BASIS SA PTP Value Difference PercentageDifference 1 1997 Canada Import Balance of payments Seasonally adjusted United States 211258 0 0.0 2 1998 Canada Import Balance of payments Seasonally adjusted United States 233517 22259 10.5 3 1999 Canada Import Balance of payments Seasonally adjusted United States 249200 15683 6.7 4 2000 Canada Import Balance of payments Seasonally adjusted United States 266165 16965 6.8 5 2001 Canada Import Balance of payments Seasonally adjusted United States 253913 -12253 -4.6 6 2002 Canada Import Balance of payments Seasonally adjusted United States 254856 944 0.4 dim(Imports) [1] 532 9 summary(Imports) Ref_Date GEO TRADE BASIS SA PTP Value Difference Imports <- read.csv("C:/Users/jaysu/OneDrive - 编排尖端网络就绪/VHSOntario12/IDC4U/cansimMotionChartImports.csv") head(Imports) Ref_Date GEO TRADE BASIS SA PTP Value Difference PercentageDifference 1 1997 Canada进口国际收支季节性调整后的美国 211258 0 0.0 2 1998 年加拿大进口国际收支季节性调整后的美国 233517 22259 10.5 3 1999 加拿大进口国际收支季节性调整后的美国 249200 15683 6.7 4 2000 加拿大进口国际收支季节性调整后的美国266165 16965 6.8 5 2001 年加拿大进口国际收支季节性调整后的美国 253913 -12253 -4.6 6 2002 年加拿大进口国际收支季节性调整后的美国 254856 944 0.4 dim(进口) [1] 532 9 摘要(进口) Ref_Date GEO TRADE BASIS SA PTP 价值差异
Min.分钟。 :1997 Length:532 Length:532 Length:532 Length:532 Length:532 Min. :1997 长度:532 长度:532 长度:532 长度:532 长度:532 最小: 0 Min. : 0 分钟。 :-45298.0 :-45298.0
1st Qu.:2001 Class:character Class:character Class:character Class:character Class:character 1st Qu.: 1314 1st Qu.: -40.0 1st Qu.:2001 Class:character Class:character Class:character Class:character Class:character 1st Qu.: 1314 1st Qu.: -40.0
Median:2006 Mode:character Mode:character Mode:character Mode:character Mode:character Median: 2804 Median: 122.5中位数:2006 模式:字符 模式:字符 模式:字符 模式:字符 模式:字符 中位数:2804 中位数:122.5
Mean:2006 Mean: 14819 Mean: 520.0平均值:2006 平均值:14819 平均值:520.0
3rd Qu.:2011 3rd Qu.: 5544 3rd Qu.: 503.0第三届:2011 第三届:5544 第三届:503.0
Max.最大限度。 :2015 Max. :2015 最大。 :363036 Max. :363036 最大。 : 37231.0 : 37231.0
PercentageDifference Min.百分比差异最小值:-100.000 :-100.000
1st Qu.: -2.625第一曲:-2.625
Median: 4.700中位数:4.700
Mean: 7.995平均值:7.995
3rd Qu.: 14.500第三曲:14.500
Max.最大限度。 : 230.200 : 230.200

MotionImports <- gvisMotionChart(Imports, + idvar="PTP", + timevar="Ref_Date") Error in gvisMotionChart(Imports, idvar = "PTP", timevar = "Ref_Date"): could not find function "gvisMotionChart" plot(MotionImports) MotionImports <- gvisMotionChart(Imports, + idvar="PTP", + timevar="Ref_Date") gvisMotionChart 中的错误(Imports, idvar = "PTP", timevar = "Ref_Date"):找不到 function “gvisMotionChart”绘图(MotionImports )

It keeps showing an error whenever I try to troubleshoot or do a diagnostic.每当我尝试排除故障或进行诊断时,它都会一直显示错误。

It looks like you need to try the following.看来您需要尝试以下操作。

# Install Rtools and googleVis
install.packages(c("Rtools", "googleVis"))

# Load googleVis
library(googleVis)

You might also want to save your script in the same folder as your local data, and then change the working directory to that folder.您可能还希望将脚本保存在与本地数据相同的文件夹中,然后将工作目录更改为该文件夹。 You can do this in RStudio using:您可以使用以下方法在 RStudio 中执行此操作:

Session > Set Working Directory > To Source File Location Session > 设置工作目录 > 到源文件位置

After that, you can try importing the data as usual.之后,您可以尝试照常导入数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM