Data showing as character instead of factor

When I use summary() or str() it shows my data as characters instead of factors.

This happens even when I'm following a tutorial where they are using the same data in the same format as me and it shows up as factors for them without having to do anything extra. Is there any reason for this?

The default behaviour of reading in data via read.table(), read.csv(), etc. changed in a recent version of R. stringsAsFactors now defaults to FALSE. You can either change this to TRUE when reading in your data or you can convert the characters to factors afterwards.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.