Guojun Zhu
2006-Apr-30 21:38 UTC
[R] general help on R and factor in R and a few simple comment from a newbie
Hi. I am starting to learn R for a course project. I am relative OK c++ programer. I found the R is very different. I have read the "an introduction to R". I have to say it is not very newbie friendly. It does not explain many things clearly. And unfortunately, there is not too much introductory materials available on-line. I do not want to buy a book. For example, I found factor is a quite different concept.I cannot use it as a vector which I can somehow think as a 1-dimension array. help(factor) does not help much to clear about the concept either. Also there are quite few basic concepts like the data structure of model, etc is far from clear for me. Yet there is no general place I can look for there more general idea. help is a very interesting and useful function. However, I would say the content lacks some general idea. I used to learn Mathematica, which is also a high-level tool by their help. It is very comprehensive, yet well-organized with some general idea, some specific fundtion explanation and some functions about one topic. For R's help, you get only the specific explanation for the perticular function, and no more related things. I feel it is more like a reference for experienced user instead of some newbie. I know there should be some trick by R with some dense code for big work. But unfortunately, I could not find many place to learn it. Now for a specific question, I use read.csv to read some data from an excel data file (about 30,000 line data). Some columns has empty data, so NA was read. But they were read in as a factor instead of vector. I need to manipulate them later as a vector (for example standardizing by dividing with standard deviation, or derive a new column from other two or more columns). How to convert it into vector? Or maybe some functions already exists for factor already?
Gabor Grothendieck
2006-Apr-30 22:27 UTC
[R] general help on R and factor in R and a few simple comment from a newbie
On 4/30/06, Guojun Zhu <shmilylemon at yahoo.com> wrote:> Hi. I am starting to learn R for a course project. I > am relative OK c++ programer. I found the R is very > different. I have read the "an introduction to R". I > have to say it is not very newbie friendly. It does > not explain many things clearly. And unfortunately, > there is not too much introductory materials available > on-line. I do not want to buy a book.Enter R into google and you get the R home page. On the left pane of that under Documentation click on Other and from there click on Contributed Documentation and there is a list of literally dozens of different introductions. Also google for zoonekynd R for another online intro to R.> > For example, I found factor is a quite different > concept.I cannot use it as a vector which I can > somehow think as a 1-dimension array. help(factor) > does not help much to clear about the concept either. > Also there are quite few basic concepts like the data > structure of model, etc is far from clear for me. Yet > there is no general place I can look for there more > general idea. > > help is a very interesting and useful function. > However, I would say the content lacks some general > idea. I used to learn Mathematica, which is also a > high-level tool by their help. It is very > comprehensive, yet well-organized with some general > idea, some specific fundtion explanation and some > functions about one topic. For R's help, you get only > the specific explanation for the perticular function, > and no more related things. I feel it is more like a > reference for experienced user instead of some newbie. > > > > I know there should be some trick by R with some dense > code for big work. But unfortunately, I could not > find many place to learn it. > > > Now for a specific question, > > I use read.csv to read some data from an excel data > file (about 30,000 line data). Some columns has empty > data, so NA was read. But they were read in as a > factor instead of vector. I need to manipulate them > later as a vector (for example standardizing by > dividing with standard deviation, or derive a new > column from other two or more columns). How to > convert it into vector? Or maybe some functions > already exists for factor already? >Check out the na.strings= and possibly the as.is = TRUE arguments on read.table. Also the read.xls command from the gdata package may be helpful.