[R] how to avoid change string to number automaticlly in r

2014-08-15 Thread Wenlan Tian
I was trying to save some string into a matrix, but it automatically changed to numbers (levels). How can i avoid it?? Here is the original table: trtmeans M1 0 12.16673 a2 111 11.86369 ab3 125 11.74433 ab4 14 11.54073 b I wanna to save to a matrix like: J0001 a ab ab b But, what i

[R] save results in a loop

2014-08-13 Thread Wenlan Tian
Hi, i'm new to R. I have a question about how to save results in a loop to a file. Here is an example: for (i in 6:n){ Tukey1 = HSD.test(lm(sdata_mg[,n] ~ sdata_mg$Medium+sdata_mg$color+sdata_mg$type+sdata_mg$Micro), 'sdata_mg$Micro') } I don't know how to do it with the loop for all data, so i