[R] substr or split help needed

From: Milton Cezar <miltinho_astronauta_at_yahoo.com.br>
Date: Sun 18 Jun 2006 - 01:31:32 EST

Dear R-friends    

  I have several data files with about 1,900 lines (records) each. Im using read.table command to read the files. The files looks like

  LID                                                     ,   TYPE ,        PLAND
  D:\Bijou-MC\Simula_P005_H100_R001.txt , Forest ,       NA
  D:\Bijou-MC\Simula_P005_H100_R001.txt , Forest ,       10.2
  D:\Bijou-MC\Simula_P010_H100_R001.txt , Forest ,        9.2

  My first problem is that some command (like hist(data$PLAND)) say that the data isnt a numeric one. May be because the first PLAND value are NA? When I done read.table command I used something link:   data<-read.table (file="xxx.dat", head=T, sep="\,", na.strings="NA").    

  Another problem is that I need parse the LID column. When I do "print (head(data$LID) I receive the following result (look that the slash was lost on the read):

  Its ok to me, but now I need create the P, H and R columns into the "data" table as a parse of LID column. When I try use the command "p<-substr(data$LID, 19,3)" I got an error message saying that the variable is not char one.    

  Finally, Id like drop the LID column and insert the P, H and R into the table.    

  Thanks for your help!    

  Kind regards, miltinho            

        [[alternative HTML version deleted]]

R-help@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 Received on Sun Jun 18 01:36:26 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 18 Jun 2006 - 06:10:57 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.