Hi Arun,
Thank you so much for your answer. It surely does help. Having to know
different approaches for the same problem has given me more insights on R
language. I appreciate your time and effort.
Best,
Janesh Devkota
On Thu, Apr 11, 2013 at 10:00 PM, arun wrote:
> Hi,
> May be this helps:
Hi,
May be this helps:
lines1<- readLines("WAT_DEP.DAT.part")
indx<- which(grepl("[*]",lines1))
indx2<-indx[seq(from=indx[2],length(indx),by=2)]+1
lines2<-str_trim(lines1[indx2],side="left")
dat1<-read.table(text=lines2,sep="",header=FALSE)
library(stringr)
lst1<- lapply(split(indx,((seq_along(in
the data from a text file and reshape the data
Is this what you are looking for:
> input <- readLines("C:\\Users\\Owner\\Downloads\\WAT_DEP.DAT")
> start <- grep("N:SNAPSHOT", input) # find start of the data
> # add index of what would have been the l
Is this what you are looking for:
> input <- readLines("C:\\Users\\Owner\\Downloads\\WAT_DEP.DAT")
> start <- grep("N:SNAPSHOT", input) # find start of the data
> # add index of what would have been the last block
> start <- c(start, tail(start, 1) + 53L)
> # now read in the data using 'text' par
4 matches
Mail list logo