Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[suggestion] data structures episode 04: add line of code introducing the dir.create function #494

Open
margarc opened this issue Apr 7, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@margarc
Copy link

commented Apr 7, 2019

After this point in Episode 4 Data Structures:
Let’s start by making a toy dataset in your data/ directory, called feline-data.csv:
cats <- data.frame(coat = c("calico", "black", "tabby"),
weight = c(2.1, 5.0,3.2),
likes_string = c(1, 0, 1))

I would suggest to introduce a line here to introduce the useful function dir.create()
In case students did not already create a folder in their directory called "data". Otherwise confusion might be created. Most likely instructors will have to mention this anyway at this stage i.e.

dir.create(“data”)

and explain that this will automatically create a new folder called data in the directory we are working with.
and continue with this as it is written in the lesson episode already:
write.csv(x = cats, file = "data/feline-data.csv", row.names = FALSE)

@naupaka

This comment has been minimized.

Copy link
Member

commented Apr 15, 2019

While I see the value in this, I wonder if it might not cause more headache than value-add.

Many novices have a lot of trouble determining/setting/understanding the concept of a working directory, and creating directories in R might be more complicated than just making a new directory with Finder/Windows Explorer, which helps learners see the concordance between the files they are accessing in R and the file system browser they are used to and comfortable with.

But I also think that this whole cat part should be cut out and the content adjusted to use the gapminder dataset instead. Otherwise it seems a bit out of place. But perhaps that's just me?

@jcoliver

This comment has been minimized.

Copy link
Collaborator

commented Apr 15, 2019

In non-SWC workshops, I've found dir.create is fairly accessible to novices and helps reinforce the connection between R commands and the file system (the data folder "appears" in the Files pane when one runs dir.create("data")). On the other hand, I don't know if a novice really needs dir.create.

But adding a brief "Miscellaneous Tip" with dir.create would be appropriate - something that is short, and easily skippable by instructors. Want to submit a PR, @margarc ?

But the cats to gapminder transition is a whole other issue. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.