Hello, I would like to please ask if someone would explain how r reads characters and numbers differently. Using read.csv, I had a matrix that resembled the following, only with many more ids and data:
ID Visit variable 2 1 5 2 1 3 2 3 4 2 41 1 2 42 34 2 5 54 2 9 1 2 10 3 2 12 5 5 1 54 5 2 9 5 3 3 5 41 54 5 41 2 5 5 235 5 9 4 5 10 2 5 12 2 I then tried to subset for Visit==3. However, subset == was not working properly. This gave me zero rows. I printed the matrix/dataframe and found that this was because r viewed the 3 as " 3" (space three). So, I had to type subset == " 3" to select for the data instead. I think this has to do with character, number and string properties, but I am quite a novice. Would anyone be able to instruct me how one tells a dafaframe/matrix to convert numbers such as " 3" to "3" so that I do not get confused in the future? I guess another problem I have is that I am still learning the differences between matrices and dataframes. Thanks so much, Matt [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.