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

read.csv stringsAsFactors argument now defaults to FALSE? [episode 11] #402

Open
HungryWave opened this Issue Nov 14, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@HungryWave

HungryWave commented Nov 14, 2018

I am an R newbie. In the reading CSV files chapter, the example of replacing one color name with another does not seem to produce a vector with numbers now. It looks as though read.csv defaults to reading in the colors as strings now. Has this changed? Should this chapter be updated?

@HungryWave

This comment has been minimized.

HungryWave commented Nov 14, 2018

# Here we will use R's `ifelse` function, in which we provide the test phrase,
# the outcome if the result of the test is 'TRUE', and the outcome if the
# result is 'FALSE'. We will also assign the results to the Color column,
# using '<-'

# First - reload the data with a header
carSpeeds <- read.csv(file = 'data/car-speeds.csv')

carSpeeds$Color <- ifelse(carSpeeds$Color == 'Blue', 'Green', carSpeeds$Color)
carSpeeds$Color

This does not produce a vector with numbers.

@diyadas

This comment has been minimized.

Collaborator

diyadas commented Nov 15, 2018

Hello @HungryWave! I believe you're referring to Episode 11.

Thank you for sharing this info. I have a few questions, since I'm not able to reproduce this. If you are willing to provide some additional information, this might help figure out why you are getting a different result:

  1. Could you please let us know which version of R you are using? Our latest build of the lesson seems to be on 3.5, as is my local version.
  2. Could you please let me know the result of options()$stringsAsFactors for you?

Thanks!

@diyadas diyadas changed the title from read.csv stringsAsFunctions now default FALSE? to read.csv stringsAsFactors argument now defaults to FALSE? [episode 11] Nov 15, 2018

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