Well that’s easy enough - thank you
-Original Message-
From: Jim Lemon
Sent: Monday, June 11, 2018 11:50 PM
To: Jeff Reichman
Cc: r-help mailing list
Subject: Re: [R] Changing selected columns to factor
Hi Jeff,
jrdf<-data.frame(A=rnorm(10),B=rnorm(10),C=rnorm(10),
D=rnorm(10
Hi Jeff,
jrdf<-data.frame(A=rnorm(10),B=rnorm(10),C=rnorm(10),
D=rnorm(10),E=rnorm(10),F=rnorm(10),G=rnorm(10),
H=rnorm(10),I=rnorm(10),J=rnorm(10))
for(i in c(2,7,8,9)) jrdf[,i]<-factor(jrdf[,i])
sapply(jrdf,"class")
Jim
On Tue, Jun 12, 2018 at 9:57 AM, Jeff Reichman wrote:
> R-Help Forum
>
R-Help Forum
If I have a data frame consisting of say ten (10) variables
(A,B,C,D,E,F,G,H,I,J) and I want to change Variables 2,7,8,and 9 to factors
is there a command such that I can do it in one line or do I simply have to
convert each separately?
Jeff
[[alternative HTML version
3 matches
Mail list logo