Created
January 28, 2015 14:38
-
-
Save kleinschmidt/0ee3300550468f5b9729 to your computer and use it in GitHub Desktop.
converting factor to character after rowwise()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(dplyr) | |
data.frame(a=factor(c('10', '20', '30', '40'))) %>% | |
mutate(b=as.character(a)) %>% | |
rowwise() %>% | |
mutate(c=as.character(a)) %>% | |
str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Classes ‘rowwise_df’, ‘tbl_df’, ‘tbl’ and 'data.frame': 4 obs. of 3 variables: | |
$ a: Factor w/ 4 levels "10","20","30",..: 1 2 3 4 | |
$ b: chr "10" "20" "30" "40" | |
$ c: chr "1" "2" "3" "4" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment