简体   繁体   中英

R: read.table problems

I might just be crazy but I really can't see where I am going wrong on my simple R program. I am trying to read a table from a file but every time I try to it comes back with this error:

./tmp.r: line 1: syntax error near unexpected token `('
./tmp.r: line 1: `tmp <- read.table("/home/Data/run1.DOC.sample_summary",header=FALSE)'

The file I am trying to read from looks something like this:

Aim  A_%_above_20  A_%_above_30  A_%_above_40  
28         0.0          0.0          0.0     
99         50           100.0        82.9  
34         62.1         0.0          0.0  

Here is my code:

tmp <- read.table("/home/Data/run1.DOC.sample_summary",header=FALSE)
names(tmp)
max_num <- max(tmp)
hist(tmp$'*_%_above_30',col=heat.colors(max_num), main='Percent in Test', xlab='Percent Covered')

Does anyone see what I am doing wrong here? I am just not seeing it. Thanks

it this because you used wrong path name? eg, try changing "home..." to "/home..."

Those tmp$'*_%_above_30' really work in your last line ?

Also, try to put comments on different part of your code to see which one is making your code crash.

Finally, maybe it's just a bad encoding of some characters in your code. Try to rewrite it from scratch.

And how do you launch your script ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM