Re: [R] importing multiple file form folder

2012-06-10 Thread mpavlic
Thank Rui, as always your posts did the trick. Thanks, m -- View this message in context: http://r.789695.n4.nabble.com/importing-multiple-file-form-folder-tp4631637p4632948.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-pro

Re: [R] importing multiple file form folder

2012-06-10 Thread Rui Barradas
Hello, Try x <- "channel 1 20120601 003507 1.ddf" search <- "^channel [0-9]+ ([0-9]+ [0-9]+) .+$" replace <- "\\1" as.POSIXct(sub(search, replace, x), format="%Y%m%d %H%M%S") If this doesn't make it, use 'gsub', not 'sub'. Note that as.POSIXct makes use of time zones. See ?as.POSIXct and s

Re: [R] importing multiple file form folder

2012-06-10 Thread mpavlic
Hi again all, @Rui, melt did the trick. Thanks! I managed to make this thing work somehow. ABellow is the script for this : setwd("C:/Users/mpavlic/Desktop/HE Krsko/HEK/FOC/Data/Jun/DDF") library(reshape2) library(sqldf)

Re: [R] importing multiple file form folder

2012-06-10 Thread Rui Barradas
Hello, Try the following example. #install.packages("reshape2") library(reshape2) d <- data.frame(D=Sys.Date()+1:5, Temp1=1:5, Temp2=6:10, Temp3=11:15) d dm <- melt(d, id=("D")) dm If this seems familiar, then in your it should be id=c("Length", "Date") if "Date" already is a data.frame c

Re: [R] importing multiple file form folder

2012-06-10 Thread mpavlic
I am very sorry, but i dont know how it got posted three times! -- View this message in context: http://r.789695.n4.nabble.com/importing-multiple-file-form-folder-tp4631637p4632931.html Sent from the R help mailing list archive at Nabble.com. __ R-help

Re: [R] importing multiple file form folder

2012-06-10 Thread mpavlic
Thanks for reply Rui, this is not exactly what i need. The way you proposed i get the data structured like this : Length, TempAtLocation1, TempAtLocation2TempAtLocationN What i'd like is to actuall get the data from each file in Columns, but they should be binded in rows in one tab

Re: [R] importing multiple file form folder

2012-06-10 Thread mpavlic
Thanks for reply Rui, this is not exactly what i need. The way you proposed i get the data structured like this : Length, TempAtLocation1, TempAtLocation2TempAtLocationN What i'd like is to actuall get the data from each file in Columns, but they should be binded in rows in one tab

Re: [R] importing multiple file form folder

2012-06-10 Thread mpavlic
Thanks for reply Rui, this is not exactly what i need. The way you proposed i get the data structured like this : Length, TempAtLocation1, TempAtLocation2TempAtLocationN What i'd like is to actuall get the data from each file in Columns, but they should be binded in rows in one tab

Re: [R] importing multiple file form folder

2012-06-09 Thread Rui Barradas
Hello, 'cbind' means column bind and 'rbind', row bind. So, apparently, all you have to do is replace one letter. ONLY in the do.call, it will surelly do what you want, my only doubt is with cbinding the Length column, it should recycle the values. Hope this helps, Rui Barradas Em 09-06-2012

Re: [R] importing multiple file form folder

2012-06-09 Thread mpavlic
Hi all, i managed to (with the help of most posts here) using bellow code : >setwd("C:/Users/mpavlic/Desktop/test") >txt_files = list.files(pattern = '*.ddf'); >flist<-txt_files >flistNew <- sub("^channel 1 ([0-9 ]+).*", "\\1", flist) >coordinate<-read.cs

Re: [R] importing multiple file form folder

2012-05-29 Thread mpavlic
Hi Jim, thanks for that, works perfectly. m -- View this message in context: http://r.789695.n4.nabble.com/importing-multiple-file-form-folder-tp4631637p4631798.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mai

Re: [R] importing multiple file form folder

2012-05-29 Thread David Winsemius
On May 29, 2012, at 10:56 AM, mpavlic wrote: Hi Sarah, I can not for the life of me understand what was wrong with my post?!? Can you please explain, so that i will not make the same mistake again? She asked you to read the Posting Guide. It _still_ appears you have not done so. Please

Re: [R] importing multiple file form folder

2012-05-29 Thread jim holtman
Here is how to get the number: > x <- c("channel 1 20120509 153744 1.ddf", "channel 1 20120509 154744 > 1.ddf", + "channel 1 20120509 155744 1.ddf", "channel 1 20120509 160744 1.ddf", + "channel 1 20120509 161744 1.ddf", "channel 1 20120509 162744 1.ddf") > # get the numbe

Re: [R] importing multiple file form folder

2012-05-29 Thread mpavlic
Just one more thing ... my colnames are as follows : c("channel 1 20120509 153744 1.ddf", "channel 1 20120509 154744 1.ddf", "channel 1 20120509 155744 1.ddf", "channel 1 20120509 160744 1.ddf", "channel 1 20120509 161744 1.ddf", "channel 1 20120509 162744 1.ddf",...) H

Re: [R] importing multiple file form folder

2012-05-29 Thread mpavlic
Hi again Rui, i got the column names settled like this : >colnames(Temp) <- paste(flist, seq_len(ncol(Temp)), sep=".") Thanks again, m -- View this message in context: http://r.789695.n4.nabble.com/importing-multiple-file-form-folder-tp4631637p4631737.html Sent from the R help mailing list a

Re: [R] importing multiple file form folder

2012-05-29 Thread mpavlic
Hi Rui, Thanks a lot, it works like I wanted. I am sorry about my late response though... Is it possible to get the name of the file (Channe 1. ) as a name of the column in the resulting table (dataframe)? Many thanks, m -- View this message in context: http://r.789695.n4.nabble.com/im

Re: [R] importing multiple file form folder

2012-05-29 Thread mpavlic
Hi Sarah, I can not for the life of me understand what was wrong with my post?!? Can you please explain, so that i will not make the same mistake again? Regards, m -- View this message in context: http://r.789695.n4.nabble.com/importing-multiple-file-form-folder-tp4631637p4631734.html Sent fr

Re: [R] importing multiple file form folder

2012-05-28 Thread Rui Barradas
I believe my already posted solution works. I've just tried it with your examples. url <- c("http://r.789695.n4.nabble.com/file/n4631640/channel_1_20120509_153744_1.ddf";, "http://r.789695.n4.nabble.com/file/n4631640/channel_1_20120509_154744_1.ddf";) flist <- url And the rest is

Re: [R] importing multiple file form folder

2012-05-28 Thread Rui Barradas
Hello, I've named your file 'file1.txt' and with readLines("file1.txt") saw 25 lines, then a header, then a table of tab separated values. The header is full of blanks, such as the ones in 'length (m)' and 'temperature (°C)', making it impratical. So if 'flist' is your list of files, try the

Re: [R] importing multiple file form folder

2012-05-28 Thread Nicolas Iderhoff
Hi, if you're on a mac, I would recommend Automator. If you're on unix I would recommend a handy bash script with regex. And on windows.. I don't know.. you could do regex in R, couldn't you? Am 28.05.2012 um 21:02 schrieb mpavlic: > Hi all, > > I have a set of files (which is growing) in a

Re: [R] importing multiple file form folder

2012-05-28 Thread Sarah Goslee
Sure, I have lots of ideas, mostly involving you overwriting your results with each iteration. But unless you post your code to the the list, I'll never know if my ideas are right. Please read the posting guide. Using the Nabble interface does not exempt you from posting manners. Sarah On Mon, M

Re: [R] importing multiple file form folder

2012-05-28 Thread mpavlic
I managed to sort something out with a for loop, but it's till not working ok... What it does is it loops through all files in the folder, it imports each file from line 763 on. Than it just takes the second column (Temprerature) and binds the columns (cbind). BUT it just binds the values of th

[R] importing multiple file form folder

2012-05-28 Thread mpavlic
Hi all, I have a set of files (which is growing) in a folder. The files are text files... The form of files is such : ...with numbers for Length (m) going up to 2000 ... Anyway...i just need the data from first two columns (length (m) and Temperature (C)), and no data before that... This Len