Hello, thank you very much for your help in last email. it is very helpful. right now, i have more questions about my project, 1. solve can i remove the NA from a vectors: for exmample, if my vector is: v <- (NA, 1, 2, 3, 4, 5) how can I remove the NA from vector v 2. how I can get input from the user? 3. can I read more than one data files in one program? and how i can write something to a file 4. how i can display/output something on the screen? thank you so much Best wish C-Ming Jan 24, 2005 --------------------------------- [[alternative HTML version deleted]]
Cuichang Zhao wrote:> Hello, > thank you very much for your help in last email. it is very helpful. right now, i have more questions about my project, > > 1. solve can i remove the NA from a vectors: > for exmample, if my vector is: > v <- (NA, 1, 2, 3, 4, 5) > how can I remove the NA from vector v > > 2. how I can get input from the user? > > 3. can I read more than one data files in one program? and how i can write something to a file > > 4. how i can display/output something on the screen? > > thank you so much > > Best wish > > C-Ming > > Jan 24, 2005 > > > > > --------------------------------- > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.htmlPlease do a suggested above: Read the posting guide and read a minimal amount of documentation, as well as the R FAQ and learn to search the mailing list archives. Uwe Ligges
The answers to your questions are in the text below. However these questions are generally answered in the base documentation. You might try going through the Keywords by Topic which on the windows system at least) is accessed by going through the html help entry on the help menu. Once your browser is open select "Search Engine & Keywords." Depending on how your browser is set up you may have to scroll down to the keywords. I found it helpful to browse through the categories to get a feel for what R can do.> -----Original Message----- > From: Cuichang Zhao [mailto:cuiczhao at yahoo.com] > Sent: Tuesday, 25 January 2005 3:25 PM > To: r-help at stat.math.ethz.ch > Subject: [R] more question > > > Hello, > thank you very much for your help in last email. it is very > helpful. right now, i have more questions about my project, > > 1. solve can i remove the NA from a vectors: > for exmample, if my vector is: > v <- (NA, 1, 2, 3, 4, 5) > how can I remove the NA from vector vAssuming you meant v <- c(NA, 1, 2, 3, 4, 5) then v[!is.na(v)] An introduction to R, Page 10 gives an example> > 2. how I can get input from the user?Page 279 of the Full reference Manual ?readline fun <- function() { ANSWER <- readline("Are you a satisfied R user? ") if (substr(ANSWER, 1, 1) == "n") cat("This is impossible. YOU LIED!\n") else cat("I knew it.\n") } fun()> > 3. can I read more than one data files in one program? and > how i can write something to a fileYes, The whole document R Data Import/Export is devoted to this topic. There are too many ways to answer this question.> > 4. how i can display/output something on the screen?cat("something") print("something") plot(5) plot(v) Try searching for device in the Full reference manual, if you are interested in the various ways output mechanisms. I think you need to be more precise in your question.> > thank you so much > > Best wish > > C-Ming > > Jan 24, 2005 > > > > > --------------------------------- > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >
Hi On 25 Jan 2005 at 9:00, Uwe Ligges wrote:> Cuichang Zhao wrote: > > Hello, > > thank you very much for your help in last email. it is very helpful. > > right now, i have more questions about my project, > > > > 1. solve can i remove the NA from a vectors: > > for exmample, if my vector is: > > v <- (NA, 1, 2, 3, 4, 5)v[!is.na(v)]> > how can I remove the NA from vector v > > > > 2. how I can get input from the user?scan() probably?> > > > 3. can I read more than one data files in one program? and how i can > > write something to a filewhat program? sink, write, ...> > > > 4. how i can display/output something on the screen?print, And most effective, what Uwe did recommend, read available documentation (R-intro, help pages).> > > > thank you so much > > > > Best wish > > > > C-Ming > > > > Jan 24, 2005 > > > > > > > > > > --------------------------------- > > > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at stat.math.ethz.ch mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide! > > http://www.R-project.org/posting-guide.html > > Please do a suggested above: Read the posting guide and read a minimal > amount of documentation, as well as the R FAQ and learn to search the > mailing list archives. > > Uwe Ligges > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.htmlPetr Pikal petr.pikal at precheza.cz
Cuichang Zhao wrote:> Hello, > thank you very much for your help in last email. it is very helpful. right now, i have more questions about my project, > > 1. solve can i remove the NA from a vectors: > for exmample, if my vector is: > v <- (NA, 1, 2, 3, 4, 5)which should read v <- c(NA, 1, 2, 3, 4, 5):> how can I remove the NA from vector v >v <- v[!is.na(v)]> 2. how I can get input from the user?try "?readline"> > 3. can I read more than one data files in one program? and how i can write something to a file?read.table, ?write.table, ?scan, ?readLines, ?write> > 4. how i can display/output something on the screen??print, ?x11, ?plot, ?Devices> > thank you so much > > Best wish > > C-Ming > > Jan 24, 2005one remark: I personally think it's a bad idea to refer people too quickly (with implied reproach) to the manuals (if the manuals are good, _anything_ is written down _somewhere_ but it might take substantial time to find it). but at the very least your questions 2.-4. (and the solution to no. 1 is not so hard to find either) are so elementary, that you probably have not spent a single minute reading the documentation (online help or e.g. Introduction to R). and that is in my view not a healthy ratio of "time I invested myself to solve the problem" to "time others invest to solve my problem". no offense meant, but really ... joerg> > > > > --------------------------------- > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >