Try this: # test data Input <- "4547;1970.01.01 00:00-1970.01.01 01:00; noData 4547;1970.01.01 00:00-1970.01.01 01:00; noData"
# replace next line with Lines <- readLines("myfile.dat") Lines <- readLines(textConnection(Input)) Lines <- gsub("[;-]", " ", Lines) read.table(textConnection(Lines)) On 4/19/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > Dear List, > > somebody knows, if the following operation can be done in an easier way? > > The data rows which should be read into R look like that: > > 4547;1970.01.01 00:00-1970.01.01 01:00; noData > > Unitil now we are doing this procedure: > > 1. Dividing columns which are separated by ";" > > => temp <- read.table(file ,sep=';', na.strings='noData', > strip.white=TRUE) > => write(temp, temp.txt) > > 2. Dividing colums which are separated by "-" > > => temp <- read.table(temp.txt ,sep='-', na.strings='noData', > strip.white=TRUE) > => write(temp, temp.txt) > > 3. Dividing colums which are separated by " " > > => temp <- read.table(temp.txt ,sep=' ', na.strings='noData', > strip.white=TRUE) > > I can imagine that there should be a way to do this more efficient. > > Thanks for help in advance. > > Jan Schwanbeck > > University of Berne > Institute of Geography > > ______________________________________________ > 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 > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.