Re: [R] format selected columns in dataframe as character

2015-02-26 Thread MacQueen, Don
Of course you could have created them as character vectors in the first place: dfx - data.frame( group = c(rep('A', 8), rep('B', 15), rep('C', 6)), sex = sample(c(M, F), size = 29, replace = TRUE), age = runif(n = 29, min = 18, max = 54), stringsAsFactors=FALSE ) But if that is not

Re: [R] format selected columns in dataframe as character

2015-02-26 Thread JS Huang
Try as.character like the following shows. dfx - data.frame( + group = c(rep('A', 8), rep('B', 15), rep('C', 6)), + sex = sample(c(M, F), size = 29, replace = TRUE), + age = runif(n = 29, min = 18, max = 54)) dfx group sex age 1 A M 41.35554346 2 A F

[R] format selected columns in dataframe as character

2015-02-26 Thread Alain D.
Dear R-List, #I have a df with the first two cols formatted as factor. dfx - data.frame( group = c(rep('A', 8), rep('B', 15), rep('C', 6)), sex = sample(c(M, F), size = 29, replace = TRUE), age = runif(n = 29, min = 18, max = 54)) # now I want to format both factor VARs as character # I