r-novice-inflammation icon indicating copy to clipboard operation
r-novice-inflammation copied to clipboard

Output incorrect to description

Open EPLeyne opened this issue 4 years ago • 2 comments

http://swcarpentry.github.io/r-novice-inflammation/11-supp-read-write-csv/index.html

The 'stringsAsFactors' (from line 75) section of this episode does not appear as described. The first assignment runs and returns a list of all the car colours. However the descriptions says that it is "Blue", "Green" and '1','2'.... Untitled (2)

Looking at the str(carSpeeds) the description doesn't match the output in the screen (description: "We can see that the $Color and $State columns are factors and $Speed is a numeric column.." output: $Color and $State are character strings, and $Speed is an int column. Untitled2 (2)

I also ran the script in my RStudio and it did output as the description except for the str(carSpeeds) (line 89), $Color is a character string.

EPLeyne avatar Jun 03 '20 04:06 EPLeyne

Dear EPleyne,

thanks for reporting this discrepancy. Can you please check issue #472 as it reports the same problem.

Regards, Slave

strajanoski avatar Jun 03 '20 05:06 strajanoski

Thanks for identifying the link Slave.

I note that the initial comment in that issue was made a month ago, and that neither the reporter nor the first replyer noted the problem with the colours not being listed as factors. So I wonder if they didn't notice it or this is a new issue.

As per your reply in that issue, if you think it is a HTML issue then it is way above my head, but I'll keep looking at the script and see if I can spot anything.

EPLeyne avatar Jun 03 '20 06:06 EPLeyne

Thanks for the report! It is the same issue as https://github.com/swcarpentry/r-novice-inflammation/issues/493.

Briefly, the version 4.0 of R changed the default value of stringAsFactors in read.csv(). This was not properly documented in the lesson for a brief period of time and lead to confusion with results for learners possibly differing from what we were showing in the lesson.

As mentioned in #493, this is hopefully now clearer since https://github.com/swcarpentry/r-novice-inflammation/commit/3922356b966a9643b243d1614025a38f9bbf7afc and subsequent lesson updates. Please reach out if you still encounter issues with this.

Bisaloo avatar Dec 16 '23 10:12 Bisaloo