convert characters to factors

Description

convert each character column in a data frame to a factor.

Usage

1

Arguments

x

a data.frame in which columns are to be converted.

Value

A data.frame with character columns converted in factor columns.

Note

This is an utility to quickly transform a character vector to factor for analysis purpose.

Author(s)

Giorgio Arcara.

Examples

1
2
3
4
5
6
7
8
	
dat=data.frame(RT=rnorm(20, mean=500, sd=100), Subject=rep(1:10, 2))

conditions=c(rep("a", 10), rep("b", 10))

dat$conditions=conditions	

dat=char2fac(dat)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.