Re: [R] Factors and Alternatives

2017-05-09 Thread peter dalgaard
Inline... > On 9 May 2017, at 12:12 , g.maub...@weinwolf.de wrote: > > Hi All, > > I am using factors in a study for the social sciences. > > I discovered the following: > > -- cut -- > > library(dplyr) > > test1 <- c(rep(1, 4), rep(0, 6)) > d_test1 <- data.frame(test) > > test2 <- factor(t

Re: [R] Factors and Alternatives

2017-05-09 Thread Bob O'Hara
odd. Maybe > there is a way dealing with that kind of problems in R and I am eager to > learn how it can be solved using R. > > What would you suggest? > > Kind regards > > Georg > > > > > Von:"Bob O'Hara" > An: g.maub...@weinwolf.de, &g

Re: [R] Factors and Alternatives

2017-05-09 Thread Bob O'Hara
That's easy! First > str(test3) Factor w/ 2 levels "WITHOUT Contact",..: 2 2 2 2 1 1 1 1 1 1 tells you that the internal values are 1 and 2, and the labels are "WITHOUT Contact" and "WITH Contact". If you read the help page for factor() you'll see this: levels: an optional vector of the values (

[R] Factors and Alternatives

2017-05-09 Thread G . Maubach
Hi All, I am using factors in a study for the social sciences. I discovered the following: -- cut -- library(dplyr) test1 <- c(rep(1, 4), rep(0, 6)) d_test1 <- data.frame(test) test2 <- factor(test1) d_test2 <- data.frame(test2) test3 <- factor(test1, levels = c(0, 1),