R * not meaningful for factors ERROR

后端 未结 1 658
我寻月下人不归
我寻月下人不归 2020-12-01 18:14

I have the following data.frame and I want to perform some calculations on the 2nd column.

> test  
  code age
1  101  15
2  102  25
3  103  16
4  104          


        
相关标签:
1条回答
  • 2020-12-01 19:00

    new[,2] is a factor, not a numeric vector. Transform it first

    new$MY_NEW_COLUMN <-as.numeric(as.character(new[,2])) * 5
    
    0 讨论(0)
提交回复
热议问题