Data Frame Initialization - Character Initialization read as Factors?

后端 未结 1 1167
被撕碎了的回忆
被撕碎了的回忆 2021-01-29 15:13

I am trying to initialize a data frame like this as I would like to have an empty data frame with two character vectors as columns

out_frame<-data.frame(Hospi         


        
1条回答
  •  长发绾君心
    2021-01-29 15:19

    The data.frame function takes the following argument "stringsAsFactors". By default it is set to TRUE. Set it to FALSE to keep character from being cast to factors.

    out_frame <- data.frame(Hospital = character(), State = character(), stringsAsFactors = FALSE)
    str(out_frame)
    

    0 讨论(0)
提交回复
热议问题