Changbin -
   If you want the entire line, use

readLines('~/ca_boost_feature.txt',warn=FALSE)[2]
[1] " H.2.C C.1.D C.3.R E.0.N C.2.S C.0.G H.3.G"

   If you want a vector with the contents of the line, use

scan('~/ca_boost_feature.txt',skip=1,n=7,what='')
Read 7 items
[1] "H.2.C" "C.1.D" "C.3.R" "E.0.N" "C.2.S" "C.0.G" "H.3.G"

Hope this helps.
                                        - Phil Spector
                                         Statistical Computing Facility
                                         Department of Statistics
                                         UC Berkeley
                                         [email protected]





On Fri, 24 Sep 2010, Changbin Du wrote:

Dear community,

I have one file named ca_boost_feature.txt,

Feature selection (Boosting:0.0025,5)!
H.2.C C.1.D C.3.R E.0.N C.2.S C.0.G H.3.G
log file: ep

If I want to use the second line of this file, how to read it into R?

varr<-read.table("/home/cdu/operon/carbonic/ca_boost_feature.txt", sep=" ",
skip=1, header=F, strip.white=TRUE, nrows=1)
Warning message:
In read.table("/home/cdu/operon/carbonic/ca_boost_feature.txt",  :
 incomplete final line found by readTableHeader on
'/home/cdu/operon/carbonic/ca_boost_feature.txt'

I attached this file with this email.

Thanks!


--
Sincerely,
Changbin
--


______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to