Hello,
I'm apologize to have made failure before.
I wrote this : p<-scan("teststat.txt") on R and R returns Error in
scan
("teststat.txt") : "scan" expected a real, got
"x". I don't really
understand,because teststat has been created, so........
Thanks a lot.
Sandrine
--------------------------------------------------------------------------------
Université de Bretagne sud http://www.univ-ubs.fr/
Did you try specifying the full path? [Also, is "\" an escape character in R as it is in S-Plus? In that case you need to write "\\" to get one "\" -- or use "/".] hope this helps. spencer graves sandrine.mainard1 at etud.univ-ubs.fr wrote:> Hello, > > I'm apologize to have made failure before. > I wrote this : p<-scan("teststat.txt") on R and R returns Error in scan > ("teststat.txt") : "scan" expected a real, got "x". I don't really > understand,because teststat has been created, so........ > > Thanks a lot. > > Sandrine > > > > > > > > > > > -------------------------------------------------------------------------------- > Universit? de Bretagne sud http://www.univ-ubs.fr/ > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help
On Fri, 25 Apr 2003 sandrine.mainard1 at etud.univ-ubs.fr wrote:> Hello, > > I'm apologize to have made failure before. > I wrote this : p<-scan("teststat.txt") on R and R returns Error in scan > ("teststat.txt") : "scan" expected a real, got "x". I don't really > understand,because teststat has been created, so........ > > Thanks a lot. > > SandrineIt seems that you have character data in your file. By default, scan() expects to read numerical values. If you want scan() to read character values, then you can do: p <- scan(what="") To read multiple variables, the "what" argument can be a list, and scan expects the variables to be the same type as those in the list e.g. p <- scan(what=list(a="", b=0)) to read a character variable (which will be called "a") and a numeric variable (which will be called "b"). The second variable will be floating point, not integer, by the way. It may be easier to use the "read.table" function instead of scan. Do you know how to access the help system and the documentation in R ? At the R prompt type e.g. "help(scan)" or "?scan" to get the help page. Look at the examples if there are any. Also, with your R distribution, you should have a set of html and pdf format documentation which is worth looking at. Hope this helps, Luke