Re: [R] data$variable=factor(....)

2015-07-11 Thread Peter Langfelder
There are two issues here. First, your original factor seems to have 4 levels: " F", " M", "F", "M". Note the extra space in front of the first two F and M. You may want to fix that first: gender.fixed = sub(" ", "", as.character(data$gender)) Check that everything is correct by typing table(gen

Re: [R] data$variable=factor(....)

2015-07-11 Thread Rui Barradas
Hello, Just to add that the op's data$gender has 4 levels, not just 2. So it would be better to remove the leading spaces from " F" and " M", by using ?sub or ?gsub. Hope this helps, Rui Barradas Em 11-07-2015 21:19, Jeff Newmiller escreveu: Well, you can help yourself on this list if you

Re: [R] data$variable=factor(....)

2015-07-11 Thread Jeff Newmiller
Well, you can help yourself on this list if you stop letting your email client determine the format (HTML in this case) that you use since that format gets corrupted on this mailing list leading to frequent misunderstandings. Learn how to make your email client send plain text format. If you

[R] data$variable=factor(....)

2015-07-11 Thread Dagmar Juranková
Hello everybody, I have a problem with R. I uploaded a questionnaire saved as csv into R and I tried to test independence between two variables. data <- read.csv("C:/Users/Me/Desktop/data.csv")> View(data)> df = read.csv("C:/Users/Me/Desktop/data.csv")> ls() [1] "df" "data"> attributes(d