在RStudio Cloud中通过swirl安装dplyr。

huangapple go评论70阅读模式
英文:

Installing dplyr through swirl in RStudio Cloud

问题

以下是已翻译的内容:

"我正在学习数据清洗课程,需要使用dplyr进行swirl练习。我使用的是RStudio(Posit)Cloud,R版本为Shortstop Beagle(4.2.3)。我的CRAN镜像设置为“global(CDN)- RStudio”。

我尝试在swirl内外安装dplyr,并且这两种方法都出现了不同的错误。

我尝试在swirl外部安装使用以下命令:
install.packages("dplyr", repos = 'https://cloud.r-project.org', dependencies = TRUE)

它给出了这个错误:

Installing package into ‘/cloud/lib/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘dpylr’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

我还尝试使用本地CRAN镜像而不是全局的RStudio CRAN,但收到相同的消息(之前我也尝试过不带repos参数 - 没有变化。不带“dependencies”参数会出现不同的错误,但我理解为什么,所以我认为那不重要。如果你认为它重要,请告诉我,我将提供发生的情况示例)。

然后,最后,我尝试从swirl内部安装,使用以下步骤:
install.packages("swirl")(成功)
install_from_swirl("Getting and Cleaning Data")(成功)
library(swirl)(成功)
经过相关的swirl提示后,它给我这个:

This lesson requires the ‘dplyr’ package. Would you like me to
| install it for you now?

1: Yes
2: No

我选择了“是”,然后发生了这种情况:

 Trying to install package ‘dplyr’ now...
also installing the dependencies ‘generics’, ‘tidyselect’


| Package ‘dplyr’ loaded correctly!

Error in yaml.load(readLines(con, warn = readLines.warn), error.label = error.label,  : 
  (/cloud/lib/x86_64-pc-linux-gnu-library/4.2/swirl/Courses/Getting_and_Cleaning_Data/Manipulating_Data_with_dplyr/lesson.yaml) Scanner error: while scanning a tag at line 205, column 9 did not find expected whitespace or line break at line 205, column 19
In addition: Warning message:
`tbl_df()` was deprecated in dplyr 1.0.0.
ℹ Please use `tibble::as_tibble()` instead.
ℹ The deprecated feature was likely used in the swirl package.
  Please report the issue to the authors.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this
warning was generated. 

| Leaving swirl now. Type swirl() to resume.

是否是swirl课程过时了?这门课程可能没有得到监控,所以如果是这种情况,我不太可能迅速得到回应/修复。在此期间我还能做些什么吗?应该注意的是,swirl练习似乎不是成绩的一部分,所以如果你有其他关于如何熟悉dplyr的建议,我会欢迎!"

英文:

I'm taking a course on cleaning data, and need to do swirl exercises using dplyr. I use RStudio (Posit) Cloud, R version Shortstop Beagle (4.2.3). My CRAN mirror is set to "global (CDN) - RStudio".

I've tried installing dplyr inside and outside of swirl, and gotten different errors for those methods.

I've tried to install outside of swirl using:
install.packages("dpylr", repos = 'https://cloud.r-project.org', dependencies = TRUE)

And it gives this error:

Installing package into ‘/cloud/lib/x86_64-pc-linux-gnu-library/4.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘dpylr’ is not available for this version of R

A version of this package for your version of R might be available elsewhere,
see the ideas at
https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Installing-packages

I also tried using my local CRAN mirror instead of the global RStudio CRAN and got the same message (and previously I also tried without the repos argument--no change. A different error appeared without the "dependencies" argument but I understand why, so I don't think that's important. If you think it is, let me know and I will provide an example of what happened).

Then, finally, I tried installing from within swirl using these steps:
install.packages("swirl") (successful)
install_from_swirl("Getting and Cleaning Data") (successful)
library(swirl) (successful)
Went through the relevant swirl prompts, then it gave me this:

This lesson requires the ‘dplyr’ package. Would you like me to
| install it for you now?

1: Yes
2: No

I chose "yes" and then this happened:

 Trying to install package ‘dplyr’ now...
also installing the dependencies ‘generics’, ‘tidyselect’


| Package ‘dplyr’ loaded correctly!

Error in yaml.load(readLines(con, warn = readLines.warn), error.label = error.label,  : 
  (/cloud/lib/x86_64-pc-linux-gnu-library/4.2/swirl/Courses/Getting_and_Cleaning_Data/Manipulating_Data_with_dplyr/lesson.yaml) Scanner error: while scanning a tag at line 205, column 9 did not find expected whitespace or line break at line 205, column 19
In addition: Warning message:
`tbl_df()` was deprecated in dplyr 1.0.0.
ℹ Please use `tibble::as_tibble()` instead.
ℹ The deprecated feature was likely used in the swirl package.
  Please report the issue to the authors.
This warning is displayed once every 8 hours.
Call `lifecycle::last_lifecycle_warnings()` to see where this
warning was generated. 

| Leaving swirl now. Type swirl() to resume.

Is it the swirl lesson that's out of date somehow? This course probably isn't monitored, so I'm unlikely to get a response/fix quickly if that's the case--is there anything else I can do in the meantime? It should be noted the swirl exercises don't appear to be part of the grade, so if you have some other suggestion for how to get familiar with dplyr, I'd welcome it!

答案1

得分: 1

You have a typo in the first command (installing outside swirl)

The correct one

install.packages("dplyr", repos = 'https://cloud.r-project.org', dependencies = TRUE)

I tested it and it works in "posit.cloud"

Nevertheless, I have the same error inside swirl, but note the "dplyr" package was installed and loaded successfully; the error was about a yaml file for the first lesson 1: Manipulating Data with dplyr

I tested the second one 2: Grouping and Chaining with dplyr
looks ok

英文:

You have a typo in the first command (installing outside swirl)

The correct one

install.packages("dplyr", repos = 'https://cloud.r-project.org', dependencies = TRUE)

I tested it and it works in posit.cloud

Never the less, I have the same error inside swirl but note the dplyr package was installed and loaded successfully the error was about a yaml file
for the first lesson 1: Manipulating Data with dplyr

I tested the second one 2: Grouping and Chaining with dplyr
looks ok

huangapple
  • 本文由 发表于 2023年3月21日 00:35:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/75792959.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定