> abc <- 1:10

> efg <- 10:19

> ag <- cbind(abc,efg)


> mutate(ag, efg2 = efg + 100)
Error in UseMethod("mutate_") : 
  no applicable method for 'mutate_' applied to an object of class "c('matrix', 'integer', 'numeric')"



> ag <- data.frame(ag)

> mutate(ag, efg2 = efg + 100)

   abc efg efg2

1    1  10  110

2    2  11  111

3    3  12  112

4    4  13  113

5    5  14  114

6    6  15  115

7    7  16  116

8    8  17  117

9    9  18  118

10  10  19  119


mutate 함수는 data.frame으로 만든 데이터로 돌려야 돌아가는 것 같음. 




원 코드

#test====

abc <- 1:10

efg <- 10:19

ag <- cbind(abc,efg)


ag <- data.frame(ag)


mutate(ag, efg2 = efg + 100)







+ Recent posts