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

Reading and Writing CSV Files in R: Introduce na.strings argument and explain how to read CSV file by providing a filename only #387

mrakovic opened this Issue Jul 30, 2018 · 2 comments


None yet
3 participants

mrakovic commented Jul 30, 2018

Hi everyone,
I would like to offer two suggestions related to the lesson "Reading and Writing CSV Files in R":

  1. In most cases, researchers need to deal with missing data in their datasets, so introducing na.strings argument (among other read.csv arguments introduced in the lesson so far) may be a useful complement for those researchers who want to know, for example, how to convert empty cells in a dataframe to a NA string - conventional label that R understands as missing data point.
  2. From my experience, some researchers prefer to place their CSV files into a working directory (root level, without using subfolders), so having this scenario covered in the read.csv introduction may be an addition worth considering. For example, read.csv(file = 'car-speeds.csv') will locate and read the file if it exists in a working directory (assuming that working directory was properly set before).
    Looking forward to reading your comments.

This comment has been minimized.


diyadas commented Jul 31, 2018

Hi Mladen! Thanks for your comments.

  1. I could see a case for this, especially as na is covered as an argument in write.csv later on, but I'd like @katrinleinweber to weigh in on this as well before proceeding.

  2. I would actually caution against this. I believe it's more helpful to have learners understand how to get data that is not stored in the same location as their working directory and I find it good practice to separate scripts vs. data. I also feel like a lot of the particulars of navigating directories are covered well in the Unix shell lesson (which is often taught just prior to the R lesson in many Carpentry workshops).


This comment has been minimized.


katrinleinweber commented Jul 31, 2018

Hello :-) I agree with @diyadas' 2. argument.

About 1.: The argument is also intended for cases in which the raw data contains something else, like n.a., --, etc. It can also take a c()ombination of several strings. I think a PR changing exactly the phrases that you mean, or adding what you want to see included, would be best to decide. If you do, please include a "(fix #387)" in your commit message. It will unlock a little GitHub magic ;-)

@diyadas diyadas added the help wanted label Aug 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment