Creating a new variable from a lookup table

后端 未结 4 799
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-29 04:39

I have the following columns in my data set:

presult     aresult
  I         single
  I         double
  I         triple
  I         home run
  SS        st         


        
4条回答
  •  天命终不由人
    2020-11-29 05:43

     dataset$base <- as.integer(as.factor(dataset$aresult))
    

    Depending on your data as.factor() could be omitted, because in many cases strings are factor by default, e.g. with read.table

提交回复
热议问题