Install tidyverse on DataCamp's servers
ismayc opened this issue · 18 comments
I just tried to load library(tidyverse)
and library(nycflights13)
in a chunk via tutorial::go_interactive()
and received the Error: there is no package called 'tidyverse'
error and a similar error for nycflights13
. Could you provide a listing of the CRAN packages that are installed on the DataCamp servers?
Hey @ismayc we indeed do not have all packages on DataCamp's servers. To see which packages are available, you can use rownames(installed.packages())
in the console.
I'll update this issue to install tidyverse and will do this asap. I'll let you know when it's available!
Hi @filipsch. I have tried to run rownames(installed.packages())
multiple times but get that my session has been disconnected after it tries to evaluate for a few seconds each time.
What is the process for adding new packages to DataCamp's servers? I'm particularly interested in different R packages to allow students to more easily access interesting data frames in R:
- some of Hadley's data R packages (
nycflights13
andbabynames
), - the
fivethirtyeight
package we just got on CRAN, and - the
okcupiddata
package on dating profiles.
@ismayc there's no strict policy for adding new packages on DataCamp, basically we just listen to requests like this and add packages whenever people need them. Currently there are over 4000 packages available, but they aren't are all necessarily the latest versions.
We have been working on a more generic system where you can specify which packages you want in a DataCamp course and which version, but this is only supported for full-fledged DataCamp courses (that you can create through datacamp.com/teach), not via DataCamp Light chunks yet. This is on the roadmap though!
I'll install tidyverse
, nycflights13
, babynames
, fivethirtyeight
and okcupiddata
in a minute. Let me know if there's anything else you'd like.
Thanks! I'm working on developing a course right now via datacamp.com/teach so that's great! I look forward to adding exercises using those packages.
That's already possible!
- Add
from: 'r-base-prod:13'
to thecourse.yml
. - Add a
requirements.r
file to the root folder of your repository, where you list all the package installs you need. So in your case, that would be:
devtools::install_version("tidyverse", "1.1.0")
devtools::install_version("nycflights13", "0.2.1")
...
Normally, the build logs in teach should now show that a 'course image' is being created for your course. If the build passes, you will have the packages available to you.
Let me know if you encounter any issues with this, happy to help!
In any case, I'll also make the packages available in the basic setup for courses that don't use the new system.
Excellent! Did I overlook this in the help provided by DataCamp somewhere?
@ismayc Yeah, it's more of an internal thing currently, we'll open it up to everybody soon.
Ah, no problem! Just wanted to make sure I wasn't bugging you with questions when the answers were right in front of me. Thanks so much again!
I'm still having trouble being able to use the fivethirtyeight
package and am receiving the same error as before.
- My GitHub repo is at https://github.com/ismayc/Effective-Data-Storytelling-using-the-tidyverse
- the
requirements.r
file is at https://github.com/ismayc/Effective-Data-Storytelling-using-the-tidyverse/blob/master/requirements.r - the
course.yml
is at https://github.com/ismayc/Effective-Data-Storytelling-using-the-tidyverse/blob/master/course.yml
Hey @ismayc I checked on DataCamp, and it works fine?
Go to: https://campus.datacamp.com/courses/3085/8353?ex=1
And submit the answer; works fine for me! Let me know if you don't see the same behavior.
Ah, I have been looking at it in the Preview window of the editor retrieved when I press Edit this Course. I would guess that Preview doesn't have the capabilities of adding packages yet?
I've changed my workflow to just write my markdown files in RStudio, push to GitHub, and then check the results at https://campus.datacamp.com/courses/3085/8353?ex=1 . Really slick! Thanks, @filipsch!
@ismayc as soon as you have successfully built a course image, normally the teach editor should also use that package in the preview, but I'll have to check. We recently launched a new version of the campus app, and this might have been looked over.
For now, the other workflow you propose is probably the most trustworthy one.
Let me know as soon as you see something out of the ordinary, happy to get some outside feedback!
I'll close this for now, if that's okay.
This workflow is great! I'm really liking it so far. I now have a separate question for you:
Is the R Markdown interface in Garrett's course available for use in other courses too like the one I am creating? I'm happy to chat in another way since we have gone far off the original issue created here.
@ismayc yes it is, but we're not actively developing or documenting it because it's not being used in a lot of places.
This is the writeup for this exercise from garrett's course:
--- type:MarkdownExercise xp:100 skills:1,5 key:3c547b4e1b
## The R Markdown Exercise interface
For this course, DataCamp has developed a new kind of interface that looks like the R Markdown pane in RStudio. You have a space (my_document.Rmd) to write R Markdown documents, as well as the buttons to compile the R Markdown document. To keep things simple, we'll stick with making html and pdf documents, although it is also possible to create Microsoft Word documents with R Markdown.
When you click "Knit HTML", DataCamp will compile your R Markdown document and display the finished, formatted results in a new pane.
To give you a taste of the things you'll learn in this course, we've prepared two documents in the editor on the right:
- my_document.Rmd containing the actual R Markdown code;
- faded.css, a supplementary file that brands your report.
*** =instructions
- Change the title of the Markdown Document from "Ozone" to "Hello R Markdown".
- Click the "Knit HTML" button to see the compiled version of your sample code.
*** =hint
To change the title, change the value that comes after "title: " in my_document.Rmd on the right. Then, submit your work by clicking the "Knit HTML" button.
*** =sample_code
{{{my_document.Rmd}}}
---
title: "Ozone"
output:
html_document:
css: faded.css
---
## Data
The `atmos` data set resides in the `nasaweather` package of the *R* programming language. It contains a collection of atmospheric variables measured between 1995 and 2000 on a grid of 576 coordinates in the western hemisphere. The data set comes from the [2006 ASA Data Expo](http://stat-computing.org/dataexpo/2006/).
Some of the variables in the `atmos` data set are:
* **temp** - The mean monthly air temperature near the surface of the Earth (measured in degrees kelvin (*K*))
* **pressure** - The mean monthly air pressure at the surface of the Earth (measured in millibars (*mb*))
* **ozone** - The mean monthly abundance of atmospheric ozone (measured in Dobson units (*DU*))
You can convert the temperature unit from Kelvin to Celsius with the formula
$$ celsius = kelvin - 273.15 $$
And you can convert the result to Fahrenheit with the formula
$$ fahrenheit = celsius \times \frac{9}{5} + 32 $$
```{r, echo = FALSE, results = 'hide'}
example_kelvin <- 282.15
```
For example, `r example_kelvin` degrees Kelvin corresponds to `r example_kelvin - 273.15` degrees Celsius.
{{{faded.css}}}
h1{
color: white;
padding: 10px;
background-color: #3399ff
}
ul {
list-style-type: square;
}
.MathJax_Display {
padding: 0.5em;
background-color: #eaeff3
}
*** =solution
{{{solution.Rmd}}}
---
title: "Hello R Markdown"
output:
html_document:
css: faded.css
---
## Data
The `atmos` data set resides in the `nasaweather` package of the *R* programming language. It contains a collection of atmospheric variables measured between 1995 and 2000 on a grid of 576 coordinates in the western hemisphere. The data set comes from the [2006 ASA Data Expo](http://stat-computing.org/dataexpo/2006/).
Some of the variables in the `atmos` data set are:
* **temp** - The mean monthly air temperature near the surface of the Earth (measured in degrees kelvin (*K*))
* **pressure** - The mean monthly air pressure at the surface of the Earth (measured in millibars (*mb*))
* **ozone** - The mean monthly abundance of atmospheric ozone (measured in Dobson units (*DU*))
You can convert the temperature unit from Kelvin to Celsius with the formula
$$ celsius = kelvin - 273.15 $$
And you can convert the result to Fahrenheit with the formula
$$ fahrenheit = celsius \times \frac{9}{5} + 32 $$
```{r, echo = FALSE, results = 'hide'}
example_kelvin <- 282.15
```
For example, `r example_kelvin` degrees Kelvin corresponds to `r example_kelvin - 273.15` degrees Celsius.
{{{faded.css}}}
h1{
color: white;
padding: 10px;
background-color: #3399ff
}
ul {
list-style-type: square;
}
.MathJax_Display {
padding: 0.5em;
background-color: #eaeff3
}
*** =sct
```{r}
test_error()
test_rmd_file({
test_yaml_header(options = "title",
not_called_msg = "Make sure to define the title on top of the R Markdown document in the editor.",
incorrect_msg = "Set the title of the document to \"Hello R Markdown\". Beware of typos and caps!")
test_yaml_header(options = "output.html_document.css",
not_called_msg = "Don't change anything in the title apart from the document title!",
incorrect_msg = "Don't change anything in the title apart from the document title!")
})
success_msg("Nice job! Cool, right? Continue to the next exercise to get introduced to the basics of R Markdown.")
```
Watch out: the 'automated exercise checker' that runs on www.datacamp.com/teach currently does not work for markdown exercises. This will be fixed soon.
Great! @rudeboybert and I are really excited about this DataCamp platform. It solves a lot of logistical issues we've had in the past in teaching students how to use and work with R. We are looking forward to testing it out this coming semester in our classroom and are glad that it will tie in nicely with our textbook at http://moderndive.com.
A couple more questions:
- If a student has an issue on a question, can they direct me to their specific work via a link?
- And how does the "Show Discussion" feature work if I'd like to assign my students to take my course.
If you have documentation on this that I have missed, please let me know. I'm happy to read over the help manuals but I couldn't find this on first glance.