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

introduce read.table( in lesson one (Analyzing Patient Data) #302

Open
paddytobias opened this Issue Oct 25, 2017 · 5 comments

Comments

Projects
None yet
5 participants
@paddytobias

paddytobias commented Oct 25, 2017

First objective in lesson one (Analyzing Patient Data) is "Read tabular data from a file into a program" however the exercise only addresses tabular data in a CSV format using read.csv(. This has the potential to convey to learners that R can only deal with CSV tabular data.

Perhaps it would be good to introduce read.table( with sep = "," as an alternative and add a note on how other value separated formats might be handled.

@Jerry-Lai

This comment has been minimized.

Jerry-Lai commented Oct 31, 2017

Good Call!

There is a step towards your suggestion in the data carpentry materials, by introducing the difference between read.csv and read.csv2, but the inclusion of sep = "," would be better actually.

It might also be helpful to include a small section on reading foreign data into R (i.e., .Stata, SPSS and SAS) and write / export data.frame into a foreign format.

@Arsh-07

This comment has been minimized.

Arsh-07 commented Dec 6, 2017

Great comment.

The read.csv function can be misleading to complete novice learners that R can read only csv file. Perhaps, they should be introduced to the read.table first and use correct arguments and explain that R can import many types of file from different platform as well. Explaining the field separation character ("sep") and that the default one in read.table is a white space and if the user do not specify any "sep" the file will be read and imported wrongly in R- hence leading to incorrect analysis. Maybe the read.table should be explain more in depth and that read.csv, read.delim, read.csv2 are in a way subset of read.table function in R with specific in built arguments.

@katrinleinweber

This comment has been minimized.

Collaborator

katrinleinweber commented Feb 1, 2018

Hello y'all :-) I'm open to PRs about this. However, counter-argument: teaching CSV specifically could support the understanding, that tidy data files of a defined format are sooo much easier to handle than messy tables.

@KlausVigo

This comment has been minimized.

KlausVigo commented Apr 24, 2018

I agree with @katrinleinweber here,
and it should not really a problem as read.table and read.csv share the same help file.
In fact the function definition of read.csv is just a function call to read.table, just changing some of the default parameters.

> read.csv
function (file, header = TRUE, sep = ",", quote = "\"", dec = ".", 
    fill = TRUE, comment.char = "", ...) 
read.table(file = file, header = header, sep = sep, quote = quote, 
    dec = dec, fill = fill, comment.char = comment.char, ...)

This is even one of the simplest and shortest functions, only ... argument will need some explanation.

@katrinleinweber

This comment has been minimized.

Collaborator

katrinleinweber commented Apr 25, 2018

Since there is also a discussion about introducing the tidyverse with read_csv() (#276), I would like to request your opinions there.

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