Answers ( 2 )

  1. StringAsFactors is a argument in the read.csv(), read.table() etc functions.
    It indicates whether strings in a data frame should be treated as factor variables or as just plain strings.
    So, when it is set to False, the strings in a DataFrame will be set as strings and not factors.
    The default argument is set to TRUE which is necessary when using linear models like
    lm() and glm() as categorical variables need to be represented as features.

  2. The argument ‘stringsAsFactors’ is an argument to the ‘data.frame()’ function in R. It is a logical that indicates whether strings in a data frame should be treated as factor variables or as just plain strings. The argument also appears in ‘read.table()’ and related functions because of the role these functions play in reading in table data and converting them to data frames. By default, ‘stringsAsFactors’ is set to TRUE.

Leave an answer

Browse
Browse