[R] About qvalue
luke at inpharmatica.co.uk
Wed Apr 30 17:21:03 CEST 2003
On Fri, 25 Apr 2003 sandrine.mainard1 at etud.univ-ubs.fr wrote:
> 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.
It 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,
More information about the R-help