0

I've been messing around with R for a short time, and I've come across a problem, I assume that it's my first experience in this type of program and I don't understand many things, the problem is the following:

I am trying to do a statseducation course, where in the swirl part, there is a link to download the course. Once the course was downloaded and the swirl() package installed, I proceeded to install the course as indicated in the guide without success.

I have tried to change the location of the file without success, and the solutions that I have consulted refer to the preloaded courses in the package and choosing a specific program, such as:

install_course_zip("~/Downloads/swirl_courses-master.zip", multi=TRUE, which_course="R Programming")

However, what I want is to install the course and be able to follow it, not just download a lesson.

I hope I was able to explain myself well and that you can give me a hand.

Thanks in advance!

Sergio Lahera

library(swirl)
install_course_zip(""C:Users/sergi/Desktop/R/R Basics/swirl_courses-master.zip", multi=TRUE)

But it throws me the following error message:

Error in unzip(path, list = TRUE) : zip file 'C:Users/sergi/Desktop/R/R Basics/swirl_courses-master.zip' cannot be opened

What I want is to be able to install the course and then be able to choose the lesson to follow it properly.

Phil
  • 7,287
  • 3
  • 36
  • 66
  • You have one quote too many in your example but I assume that's a typo not replicated in the real code. Does the zip file you are trying to open definitely exist, and do you have access to it (i.e. can you open it outside of R?). Have you tried moving it to a different directory and asking R to open it from there? Perhaps one without a space in the file path? Also what do you get if you do `file.exists("C:Users/sergi/Desktop/R/R Basics/swirl_courses-master.zip")`? – SamR Mar 24 '23 at 19:25
  • @SamR Thank you very much for your comment! I can open the file with 7zip, if that's what you mean Before moving it to that folder, try where I downloaded from, with identical results: `install_course_zip("C:Users/sergi/Downloads/swirl_courses-master.zip", multi=TRUE) Error in unzip(path, list = TRUE) : zip file 'C:Users/sergi/Downloads/swirl_courses-master.zip' cannot be opened` What I get is the following: `file.exists("C:Users/sergi/Desktop/R/R Basics/swirl_courses-master.zip") [1] FALSE` – Sergio Lahera Mar 24 '23 at 23:05
  • So there's something wrong with that path. I can't test at the moment but shouldn't Windows paths have a slash after `C:`? So it should be `"C:/Users/sergi/Desktop/R/R Basics/swirl_courses-master.zip"`? Or just put the zip file in your working directory and do `install_course_zip("./swirl_courses-master.zip")` – SamR Mar 24 '23 at 23:17
  • True, the path was misspelled, although I did find a workaround, so I'll close this question and see if it happens again in the future. Thank you very much for your contributions! – Sergio Lahera Mar 25 '23 at 11:37

1 Answers1

0

Thanks to @SamR's input, I realized that the path was misspelled, however, I couldn't test if that fixed my error.

Therefore, as it is a course that is in a GitHub repository, with the function install_github_course(github_username, course_name) I was able to fix the error:

[1]: https://github.com/Sullivanstatistics/swirl_courses
[2]: https://i.stack.imgur.com/dJlnq.png

dandrews
  • 967
  • 5
  • 18