Hi Maybe it is time to read what I wrote below. And also documentation.
from cbind vectors or matrices. These can be given as named arguments. Other R objects will be coerced as appropriate: see sections 'Details' and 'Value'. (For the "data.frame" method of cbind these can be further arguments to data.frame<http://127.0.0.1:31138/library/base/help/data.frame> such as stringsAsFactors.) Value For the default method, a matrix combining the ... arguments column-wise or row-wise. (Exception: if there are no inputs or all the inputs are NULL, the value is NULL.) The type of a matrix result determined from the highest type of any of the inputs in the hierarchy raw < logical < integer < double < complex < character < list . ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ so the lowest common type of values is numeric and everything is coerced to numeric. For adding columns dat<-data.frame(a,b) is the way how to preserve type of input vectors. > a<-as.Date(c("2013-01-01","2013-01-01","2013-01-03","2013-01-04","2013-01-04","2013-01-06")) > b<-c(5,3,3,3,1,1) > data.frame(a,b) a b 1 2013-01-01 5 2 2013-01-01 3 3 2013-01-03 3 4 2013-01-04 3 5 2013-01-04 1 6 2013-01-06 1 From: Lee Marine [mailto:marine1...@gmail.com] Sent: Friday, January 24, 2014 8:36 AM To: PIKAL Petr Subject: Re: [R] My problem with R > a<-as.Date(c("2013-01-01","2013-01-01","2013-01-03","2013-01-04","2013-01-04","2013-01-06")) > b<-c(5,3,3,3,1,1) > dat<-cbind(a,b) > dat a b [1,] 15706 5 [2,] 15706 3 [3,] 15708 3 [4,] 15709 3 [5,] 15709 1 [6,] 15711 1 Why time data is disappear? I don't know why until now... Beacause you are cbinding Date with number and this result in a numeric matrix. So read documentation to ?cbind ?matrix ?data.frame and if you are in reading process you could look also to R-intro. Especially if it is a homework. Regards Petr 2014/1/24 Lee Marine <marine1...@gmail.com<mailto:marine1...@gmail.com>> Hi, 2013-10-03 15:00:00,0,0,0,306.9,0.00152952,5.233336,37.462458,37.288565,37.495268,37.869302,0,36.30062,0.0112164183333333,0,0.15432,5.63763608087092,3348,3,279.49,1.02305,95.12,283.3,2.250766,0.6553984,0,0.00327721273, 2013-10-03 15:00:01,-0.132013800027602,0.132013800027602,0,306.9,0.001835424,5.234696,37.462458,37.288565,37.495268,37.869302,0,35.48486,0.0109048483333333,0,0.15432,6.99844479004666,3322,3,279.49,1.02305,95.12,283.3,2.250766,0.6575098,0,0.00326809999, 2013-10-03 15:00:02,-0.0296014499822541,0.0296014499822541,0,306.9,0.001835424,5.235206,37.462458,37.288565,37.495268,37.869302,0,36.30062,0.0107179083333333,0,0.15432,7.77604976671851,3361,3,279.49,1.02305,95.11,283.3,2.250766,0.6575098,0,0.00326809999,0.2057819528, ... These are part of actual data(length of dataset1 : 85207 * I have 16 dataset) data names are "date", "A", "B", ,,,,,"X","Y","Z","AA" I do not know what is the means of data, but I have to solve this problem because it is my homework =) I think these are so so many big data, but if I solved it, I can feel a sense of accomplishment. My point is, When I merging "date" and "A" or "A", "B", for example, > a date value 1 2013-01-01 5 2 2013-01-01 3 3 2013-01-03 3 4 2013-01-04 3 5 2013-01-04 1 6 2013-01-06 1 > dd num 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 then, I do not want result just like this, > ee<-cbind(a$date,dd$num) > ee [,1] [,2] [1,] 15706 1 [2,] 15706 2 [3,] 15708 3 [4,] 15709 4 [5,] 15709 5 [6,] 15711 6 All I want result is this. 2013-01-01 1 2013-01-01 2 2013-01-03 3 2013-01-04 4 2013-01-04 5 2013-01-06 6 Have a great weekend, Best Regards, Marine 2014/1/22 PIKAL Petr <petr.pi...@precheza.cz<mailto:petr.pi...@precheza.cz>> Hi First of all without posting some of your data it is really difficult to understand what you really want. Just select only a small part for 2 your data frames and post an output from dput. e.g. dput(data3[1:10, 1:7]) dput(data4[1:10, 1:7]) Most probably resulting timestamp is in POSIXlt mode which has list structure. If you want to work with it as with vector you need to transfer it to POSIXct timestamp <-as.POSIXct(timestamp) and only after that to do rbinding. However I am not sure that rbind preserves time/date format. see below > test[100:110] [1] "2014-01-08 15:00:00 CET" "2014-01-08 15:00:00 CET" [3] "2014-01-08 15:00:00 CET" "2014-01-08 15:00:00 CET" [5] "2014-01-08 15:00:00 CET" "2014-01-08 15:00:00 CET" [7] "2014-01-08 15:00:00 CET" "2014-01-08 15:00:00 CET" [9] "2014-01-08 15:00:00 CET" "2014-01-08 15:00:00 CET" [11] "2014-01-08 15:00:00 CET" > rbind(test[100:110], test[110:120]) [,1] [,2] [,3] [,4] [,5] [,6] [1,] 1389189600 1389189600 1389189600 1389189600 1389189600 1389189600 [2,] 1389189600 1389189600 1389189600 1389189600 1389189600 1389189600 [,7] [,8] [,9] [,10] [,11] [1,] 1389189600 1389189600 1389189600 1389189600 1389189600 [2,] 1389189600 1389189600 1389189600 1389189600 1389189600 Resulting number are seconds from 1.1.1970 UTC. Look at Examples in POSIX help page. I am still just guessing, without actual data it is difficult to understand where is the problem. I still believe that merge(data1, data2, all=T) is the most efficient way. Petr From: Lee Marine [mailto:marine1...@gmail.com<mailto:marine1...@gmail.com>] Sent: Wednesday, January 22, 2014 9:16 AM To: PIKAL Petr Subject: Re: [R] My problem with R Thanks for your re-email. I success merge function(really appreciate you) but I have one problem. That is,,, time data rbind... I can not solved it. I want to see 2013-10-04 04:42:00 2013-10-04 04:42:01 2013-10-04 04:42:02 ... timestamp(as you know) is really good, >timestamp3<-strptime(paste(data3[,1],data3[,2], sep=""),format="%Y-%m-%d >%H:%M:%S") >timestamp4<-strptime(paste(data4[,1],data4[,2], sep=""),format="%Y-%m-%d >%H:%M:%S") ... I can not use merge because I need row binding, not column binding. but It did not work. Time<-rbind(rbind(timestamp3,timestamp4,timestamp5,timestamp6,timestamp7,timestamp8,timestamp9,timestamp10,timestamp11,timestamp12,timestamp13,timestamp14,timestamp15,timestamp16) > str(Time) 'data.frame': 14 obs. of 9 variables: $ sec :List of 14 ..$ timestamp3 : num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp4 : num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp5 : num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp6 : num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp7 : num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp8 : num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp9 : num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp10: num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp11: num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp12: num 0 1 2 4 5 6 7 8 9 10 ... ..$ timestamp13: num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp14: num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp15: num 1 2 3 4 5 6 7 8 9 10 ... ..$ timestamp16: num 0 1 2 3 4 5 6 7 8 9 ... $ min :List of 14 ..$ timestamp3 : int 42 42 42 42 42 42 42 42 42 42 ... ..$ timestamp4 : int 0 0 0 0 0 0 0 0 0 0 ... > summary(Time) sec.Length sec.Class sec.Mode min.Length min.Class min.Mode 36568 -none- numeric 36568 -none- numeric 85206 -none- numeric 85206 -none- numeric 85207 -none- numeric 85207 -none- numeric 85206 -none- numeric 85206 -none- numeric ... hour.Length hour.Class hour.Mode mday.Length mday.Class mday.Mode 36568 -none- numeric 36568 -none- numeric 85206 -none- numeric 85206 -none- numeric 85207 -none- numeric 85207 -none- numeric ... mon.Length mon.Class mon.Mode year.Length year.Class year.Mode 36568 -none- numeric 36568 -none- numeric 85206 -none- numeric 85206 -none- numeric ... wday.Length wday.Class wday.Mode yday.Length yday.Class yday.Mode 36568 -none- numeric 36568 -none- numeric 85206 -none- numeric 85206 -none- numeric ... isdst.Length isdst.Class isdst.Mode 36568 -none- numeric 85206 -none- numeric I want to result just like that;;; [1] "2013-10-04 04:42:00" "2013-10-04 04:42:01" "2013-10-04 04:42:02" [4] "2013-10-04 04:42:03" "2013-10-04 04:42:04" "2013-10-04 04:42:05" ... I tried to find many ways > mid<-rbind(timestamp3=timestamp3, timestamp4=timestamp4) >mid<-merge(timestamp3, timestamp4) >mid<-rbind(as.POSIXct(timestamp3,timestamp4)) ... etc all fail...T^ T What should I do? Best Regards, Marine 2014/1/22 PIKAL Petr <petr.pi...@precheza.cz<mailto:petr.pi...@precheza.cz>> Hi From: Lee Marine [mailto:marine1...@gmail.com<mailto:marine1...@gmail.com>] Sent: Wednesday, January 22, 2014 2:01 AM To: PIKAL Petr Subject: Re: [R] My problem with R ps. >str(timestamp3) POSIXlt[1:36568], format: "2013-10-04 04:42:00" "2013-10-04 04:42:01" ... POSIX format can have list structure or vector structure which is appropriate for your case. see ?as.POSIXct However did you consider to use merge which is probably more appropriate than rbind and does not have "matrix" side effect. If I understand correctly you want to import several files with same structure and stack them together > file1<-data.frame(a=rnorm(10), b=1:10) > file1 a b 1 1.1507791 1 2 1.1080384 2 3 1.4140105 3 4 0.5001733 4 5 -0.2109147 5 6 0.4318809 6 7 0.7652300 7 8 -0.3629509 8 9 -0.1579185 9 10 -0.3710052 10 > file2<-data.frame(a=rnorm(10), b=11:20) > file2 a b 1 0.38297419 11 2 -0.77735905 12 3 1.50438015 13 4 0.30632757 14 5 0.30045189 15 6 0.66224030 16 7 1.64338395 17 8 -0.84172668 18 9 -0.33173291 19 10 0.02078888 20 > merge(file1, file2, all=T) a b 1 -0.84172668 18 2 -0.77735905 12 3 -0.37100523 10 4 -0.36295093 8 5 -0.33173291 19 6 -0.21091468 5 7 -0.15791848 9 8 0.02078888 20 9 0.30045189 15 10 0.30632757 14 11 0.38297419 11 12 0.43188092 6 13 0.50017333 4 14 0.66224030 16 15 0.76522999 7 16 1.10803836 2 17 1.15077911 1 18 1.41401048 3 19 1.50438015 13 20 1.64338395 17 After merging you can convert date and time to POSIX and sort or aggregate your file . AFAIK merge can stack only two data frames but you can do it easily in cycle or by hand. Assuming your objects are named data1-datan, you can do final <-merge(data1, data2, all=T) final <- merge(final, data3, all=T) .... Regards Petr > mode(timestamp3) [1] "list" > Time<-data.frame(rbind(timestamp3,timestamp4,timestamp5,timestamp6,timestamp7,timestamp8,timestamp9, timestamp10,timestamp11,timestamp12,timestamp13,timestamp14,timestamp15,timestamp16)) > str(Time) 'data.frame': 14 obs. of 9 variables: $ sec :List of 14 ..$ timestamp3 : num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp4 : num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp5 : num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp6 : num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp7 : num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp8 : num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp9 : num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp10: num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp11: num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp12: num 0 1 2 4 5 6 7 8 9 10 ... ..$ timestamp13: num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp14: num 0 1 2 3 4 5 6 7 8 9 ... ..$ timestamp15: num 1 2 3 4 5 6 7 8 9 10 ... ..$ timestamp16: num 0 1 2 3 4 5 6 7 8 9 ... $ min :List of 14 ..$ timestamp3 : int 42 42 42 42 42 42 42 42 42 42 ... ..$ timestamp4 : int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp5 : int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp6 : int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp7 : int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp8 : int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp9 : int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp10: int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp11: int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp12: int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp13: int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp14: int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp15: int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp16: int 0 0 0 0 0 0 0 0 0 0 ... $ hour :List of 14 ..$ timestamp3 : int 4 4 4 4 4 4 4 4 4 4 ... ..$ timestamp4 : int 15 15 15 15 15 15 15 15 15 15 ... ..$ timestamp5 : int 15 15 15 15 15 15 15 15 15 15 ... ..$ timestamp6 : int 15 15 15 15 15 15 15 15 15 15 ... ..$ timestamp7 : int 15 15 15 15 15 15 15 15 15 15 ... ..$ timestamp8 : int 15 15 15 15 15 15 15 15 15 15 ... ..$ timestamp9 : int 15 15 15 15 15 15 15 15 15 15 ... ..$ timestamp10: int 15 15 15 15 15 15 15 15 15 15 ... ..$ timestamp11: int 15 15 15 15 15 15 15 15 15 15 ... ..$ timestamp12: int 15 15 15 15 15 15 15 15 15 15 ... ..$ timestamp13: int 15 15 15 15 15 15 15 15 15 15 ... ..$ timestamp14: int 15 15 15 15 15 15 15 15 15 15 ... ..$ timestamp15: int 15 15 15 15 15 15 15 15 15 15 ... ..$ timestamp16: int 15 15 15 15 15 15 15 15 15 15 ... $ mday :List of 14 ..$ timestamp3 : int 4 4 4 4 4 4 4 4 4 4 ... ..$ timestamp4 : int 4 4 4 4 4 4 4 4 4 4 ... ..$ timestamp5 : int 5 5 5 5 5 5 5 5 5 5 ... ..$ timestamp6 : int 6 6 6 6 6 6 6 6 6 6 ... ..$ timestamp7 : int 7 7 7 7 7 7 7 7 7 7 ... ..$ timestamp8 : int 8 8 8 8 8 8 8 8 8 8 ... ..$ timestamp9 : int 9 9 9 9 9 9 9 9 9 9 ... ..$ timestamp10: int 10 10 10 10 10 10 10 10 10 10 ... ..$ timestamp11: int 11 11 11 11 11 11 11 11 11 11 ... ..$ timestamp12: int 12 12 12 12 12 12 12 12 12 12 ... ..$ timestamp13: int 13 13 13 13 13 13 13 13 13 13 ... ..$ timestamp14: int 14 14 14 14 14 14 14 14 14 14 ... ..$ timestamp15: int 15 15 15 15 15 15 15 15 15 15 ... ..$ timestamp16: int 16 16 16 16 16 16 16 16 16 16 ... $ mon :List of 14 ..$ timestamp3 : int 9 9 9 9 9 9 9 9 9 9 ... ..$ timestamp4 : int 9 9 9 9 9 9 9 9 9 9 ... ..$ timestamp5 : int 9 9 9 9 9 9 9 9 9 9 ... ..$ timestamp6 : int 9 9 9 9 9 9 9 9 9 9 ... ..$ timestamp7 : int 9 9 9 9 9 9 9 9 9 9 ... ..$ timestamp8 : int 9 9 9 9 9 9 9 9 9 9 ... ..$ timestamp9 : int 9 9 9 9 9 9 9 9 9 9 ... ..$ timestamp10: int 9 9 9 9 9 9 9 9 9 9 ... ..$ timestamp11: int 9 9 9 9 9 9 9 9 9 9 ... ..$ timestamp12: int 9 9 9 9 9 9 9 9 9 9 ... ..$ timestamp13: int 9 9 9 9 9 9 9 9 9 9 ... ..$ timestamp14: int 9 9 9 9 9 9 9 9 9 9 ... ..$ timestamp15: int 9 9 9 9 9 9 9 9 9 9 ... ..$ timestamp16: int 9 9 9 9 9 9 9 9 9 9 ... $ year :List of 14 ..$ timestamp3 : int 113 113 113 113 113 113 113 113 113 113 ... ..$ timestamp4 : int 113 113 113 113 113 113 113 113 113 113 ... ..$ timestamp5 : int 113 113 113 113 113 113 113 113 113 113 ... ..$ timestamp6 : int 113 113 113 113 113 113 113 113 113 113 ... ..$ timestamp7 : int 113 113 113 113 113 113 113 113 113 113 ... ..$ timestamp8 : int 113 113 113 113 113 113 113 113 113 113 ... ..$ timestamp9 : int 113 113 113 113 113 113 113 113 113 113 ... ..$ timestamp10: int 113 113 113 113 113 113 113 113 113 113 ... ..$ timestamp11: int 113 113 113 113 113 113 113 113 113 113 ... ..$ timestamp12: int 113 113 113 113 113 113 113 113 113 113 ... ..$ timestamp13: int 113 113 113 113 113 113 113 113 113 113 ... ..$ timestamp14: int 113 113 113 113 113 113 113 113 113 113 ... ..$ timestamp15: int 113 113 113 113 113 113 113 113 113 113 ... ..$ timestamp16: int 113 113 113 113 113 113 113 113 113 113 ... $ wday :List of 14 ..$ timestamp3 : int 5 5 5 5 5 5 5 5 5 5 ... ..$ timestamp4 : int 5 5 5 5 5 5 5 5 5 5 ... ..$ timestamp5 : int 6 6 6 6 6 6 6 6 6 6 ... ..$ timestamp6 : int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp7 : int 1 1 1 1 1 1 1 1 1 1 ... ..$ timestamp8 : int 2 2 2 2 2 2 2 2 2 2 ... ..$ timestamp9 : int 3 3 3 3 3 3 3 3 3 3 ... ..$ timestamp10: int 4 4 4 4 4 4 4 4 4 4 ... ..$ timestamp11: int 5 5 5 5 5 5 5 5 5 5 ... ..$ timestamp12: int 6 6 6 6 6 6 6 6 6 6 ... ..$ timestamp13: int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp14: int 1 1 1 1 1 1 1 1 1 1 ... ..$ timestamp15: int 2 2 2 2 2 2 2 2 2 2 ... ..$ timestamp16: int 3 3 3 3 3 3 3 3 3 3 ... $ yday :List of 14 ..$ timestamp3 : int 276 276 276 276 276 276 276 276 276 276 ... ..$ timestamp4 : int 276 276 276 276 276 276 276 276 276 276 ... ..$ timestamp5 : int 277 277 277 277 277 277 277 277 277 277 ... ..$ timestamp6 : int 278 278 278 278 278 278 278 278 278 278 ... ..$ timestamp7 : int 279 279 279 279 279 279 279 279 279 279 ... ..$ timestamp8 : int 280 280 280 280 280 280 280 280 280 280 ... ..$ timestamp9 : int 281 281 281 281 281 281 281 281 281 281 ... ..$ timestamp10: int 282 282 282 282 282 282 282 282 282 282 ... ..$ timestamp11: int 283 283 283 283 283 283 283 283 283 283 ... ..$ timestamp12: int 284 284 284 284 284 284 284 284 284 284 ... ..$ timestamp13: int 285 285 285 285 285 285 285 285 285 285 ... ..$ timestamp14: int 286 286 286 286 286 286 286 286 286 286 ... ..$ timestamp15: int 287 287 287 287 287 287 287 287 287 287 ... ..$ timestamp16: int 288 288 288 288 288 288 288 288 288 288 ... $ isdst:List of 14 ..$ timestamp3 : int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp4 : int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp5 : int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp6 : int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp7 : int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp8 : int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp9 : int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp10: int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp11: int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp12: int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp13: int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp14: int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp15: int 0 0 0 0 0 0 0 0 0 0 ... ..$ timestamp16: int 0 0 0 0 0 0 0 0 0 0 ... > mode(Time) [1] "list" What is the problem? 2014/1/22 Lee Marine <marine1...@gmail.com<mailto:marine1...@gmail.com>> Hi, This is marine, again. Thanks for your e-mail that give me a time to think. I tried to work in R again, First step, >data3=read.csv("D://data3.csv", header=FALSE) >str(data3) 'data.frame': 36568 obs. of 89 variables: $ V1 : Factor w/ 1 level "2013-10-04": 1 1 1 1 1 1 1 1 1 1 ... $ V2 : Factor w/ 36568 levels "10:00:00","10:00:01",..: 17753 17754 17755 17756 17757 17758 17759 17760 17761 17762 ... $ V3 : num 0.208 0.545 0.208 0.208 0.782 ... $ V4 : num 0.744 0.373 0.744 0.744 0.17 ... ... > head(data3$V1) [1] 2013-10-04 2013-10-04 2013-10-04 2013-10-04 2013-10-04 2013-10-04 Levels: 2013-10-04 > head(data3$V2) [1] 4:42:00 4:42:01 4:42:02 4:42:03 4:42:04 4:42:05 36568 Levels: 10:00:00 10:00:01 10:00:02 10:00:03 10:00:04 10:00:05 ... 9:59:59 Second step, >a3<-cbind(data3[1:36568,3]) >b3<-cbind(data3[1:36568,4]) >c3<-cbind(data3[1:36568,5]) ... >a<-rbind(a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16) >b<-rbind(b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16) ... >str(a) #V1=a num [1:1143479, 1] 0.208 0.545 0.208 0.208 0.782 ... I attempt to bind data in data frame, >seems=data.frame(cbind(date,day,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,aa,ab,ac,ad)) >str(seems) 'data.frame': 1143479 obs. of 32 variables: $ X1 : num 1 1 1 1 1 1 1 1 1 1 ... $ X2 : num 17753 17754 17755 17756 17757 ... $ X3 : num 0.208 0.545 0.208 0.208 0.782 ... It is all changed number. also, >timestamp3<-strptime(paste(data3[,1],data3[,2], sep=""),format="%Y-%m-%d >%H:%M:%S") >timestamp4<-strptime(paste(data4[,1],data4[,2], sep=""),format="%Y-%m-%d >%H:%M:%S") >timestamp5<-strptime(paste(data5[,1],data5[,2], sep=""),format="%Y-%m-%d >%H:%M:%S") ... >mode(timestamp3) [1] "List" > head(timestamp16) [1] "2013-10-16 15:00:00" "2013-10-16 15:00:01" "2013-10-16 15:00:02" [4] "2013-10-16 15:00:03" "2013-10-16 15:00:04" "2013-10-16 15:00:05" > tail(timestamp16) [1] "2013-10-17 14:59:54" "2013-10-17 14:59:55" "2013-10-17 14:59:56" [4] "2013-10-17 14:59:57" "2013-10-17 14:59:58" "2013-10-17 14:59:59" It was good only first time. I have to bind(rbind) these timestamps and all data, tried to bind, >Time<-rbind(timestamp3,timestamp4,timestamp5,timestamp6,timestamp7,timestamp8,timestamp9,timestamp10, timestamp11,timestamp12,timestamp13,timestamp14,timestamp15,timestamp16) >head(Time) >head(timestamp3) sec min hour mday timestamp3 Numeric,36568 Integer,36568 Integer,36568 Integer,36568 timestamp4 Numeric,85206 Integer,85206 Integer,85206 Integer,85206 timestamp5 Numeric,85207 Integer,85207 Integer,85207 Integer,85207 timestamp6 Numeric,85206 Integer,85206 Integer,85206 Integer,85206 timestamp7 Numeric,85207 Integer,85207 Integer,85207 Integer,85207 timestamp8 Numeric,85161 Integer,85161 Integer,85161 Integer,85161 mon year wday yday timestamp3 Integer,36568 Integer,36568 Integer,36568 Integer,36568 timestamp4 Integer,85206 Integer,85206 Integer,85206 Integer,85206 timestamp5 Integer,85207 Integer,85207 Integer,85207 Integer,85207 timestamp6 Integer,85206 Integer,85206 Integer,85206 Integer,85206 timestamp7 Integer,85207 Integer,85207 Integer,85207 Integer,85207 timestamp8 Integer,85161 Integer,85161 Integer,85161 Integer,85161 ... >Time<-data.frame(rbind(timestamp3,timestamp4,timestamp5,timestamp6,timestamp7,timestamp8,timestamp9, timestamp10,timestamp11,timestamp12,timestamp13,timestamp14,timestamp15,timestamp16)) >head(Time) # did not work If time column is work, I can try to implement aggregate function, but it didn't work. Please tell me how I figure it out. Best Regards, Marine 2014/1/21 PIKAL Petr <petr.pi...@precheza.cz<mailto:petr.pi...@precheza.cz>> Hi see in line > -----Original Message----- > From: r-help-boun...@r-project.org<mailto:r-help-boun...@r-project.org> > [mailto:r-help-bounces@r-<mailto:r-help-bounces@r-> > project.org<http://project.org>] On Behalf Of Lee Marine > Sent: Tuesday, January 21, 2014 7:17 AM > To: r-help@r-project.org<mailto:r-help@r-project.org> > Subject: [R] My problem with R > > Hi, I am a student in trouble with R. > please help me! > > I have a 16 huge data(.csv). > > data1<-read.csv(D://data1.csv, header=FALSE) . > . > . > data16<-read.csv(D://data16.csv, header=FALSE) > > and then, I tried to seperated data w/ column. > > a1<-cbind(data1[1:36568,1]) > b1<-cbind(data1[1:36568,2]) > . > . > . > ac16<-cbind(data16[1:85207,31]) > > a column is a Date(yyyy-mm-dd) > b column is a Time(hh:mm:ss) > c to ac is a numeric data. > > finished this work, use "rbind" function. > > date<-rbind(a1,a2,a3,a4,.....,a16) > time<-rbind(b1,b2,b3,..........,b16) > . > . > . > . > ac<-rbind(ac1,ac2,ac3,...,ac16) > > I want to see yyyy-mm-dd format, but It does not work. > >b > [,1] > [1,] 17753 > [2,] 17754 > [3,] 17755 > [4,] 17756 > [5,] 17757 > [6,] 17758 > > >a > [,1] > [1,] 1 > [2,] 1 > [3,] 1 > [4,] 1 > [5,] 1 > [6,] 1 > > I don't know why... It is because you did not bother to make a glimpse to R-Intro to learn about data types and how to work with them. 1. Reading such data to R means that they are transformed to character or factor. See ?str ?factor 2. Functions rbind and cbind produce matrices if input is not a data frame. Matrices can not hold different types of data as data frames. > Question 1. > I want to paste a and b >> yyyy-mm-dd hh:mm:ss timestamp <-strptime(paste(data1[,1], data1[,2], sep=" "), format = ....) see ?paste ?strptime ?as.POSIXct how to do it exactly > > Question 2. > I want to averaging mean, median for every each minute groups. > for example) see ?aggregate for averaging and ?format how to specify minute chunks. Final remarks. If you prototype the code for one file, you can do all computation in cycle. Do not post in HTML Post some data eg. by dput Do your homework and read help pages. They are available, usually well written and much effort is invested to them to be simply overlooked. Regards Petr > Time c d e f > . . > . > 2014-01-20 00:00:00 3.1428 1.99 0.123455 7.5526 2014-01-20 00:00:01 > 3.1887 1.03 0.176545 7.5234 2014-01-20 00:00:02 2.1876 1.27 0.987455 > 7.5996 ... > 2014-01-20 00:01:00 5.4428 1.96 0.164455 7.8666 2014-01-20 00:01:01 > 1.5658 1.39 0.176545 7.7786 2014-01-20 00:01:02 3.1776 1.67 0.254655 > 7.4567 > > then, > Time average_C c d e > f . . . > 2014-01-20 00:00:00 here 3.1428 1.99 0.123455 7.5526 > 2014-01-20 00:00:01 3.1887 1.03 0.176545 7.5234 > 2014-01-20 00:00:02 2.1876 1.27 0.987455 7.5996 > ... > 2014-01-20 00:01:00 here 5.4428 1.96 0.164455 7.8666 > 2014-01-20 00:01:01 1.5658 1.39 0.176545 7.7786 > 2014-01-20 00:01:02 3.1776 1.67 0.254655 7.4567 > > PLEASE HELP ME, R-help!!! > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org<mailto:R-help@r-project.org> 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. ________________________________ Tento e-mail a jakékoliv k nìmu pøipojené dokumenty jsou dùvìrné a jsou urèeny pouze jeho adresátùm. Jestli¾e jste obdr¾el(a) tento e-mail omylem, informujte laskavì neprodlenì jeho odesílatele. Obsah tohoto emailu i s pøílohami a jeho kopie vyma¾te ze svého systému. Nejste-li zamý¹leným adresátem tohoto emailu, nejste oprávnìni tento email jakkoliv u¾ívat, roz¹iøovat, kopírovat èi zveøejòovat. Odesílatel e-mailu neodpovídá za eventuální ¹kodu zpùsobenou modifikacemi èi zpo¾dìním pøenosu e-mailu. V pøípadì, ¾e je tento e-mail souèástí obchodního jednání: - vyhrazuje si odesílatel právo ukonèit kdykoliv jednání o uzavøení smlouvy, a to z jakéhokoliv dùvodu i bez uvedení dùvodu. - a obsahuje-li nabídku, je adresát oprávnìn nabídku bezodkladnì pøijmout; Odesílatel tohoto e-mailu (nabídky) vyluèuje pøijetí nabídky ze strany pøíjemce s dodatkem èi odchylkou. - trvá odesílatel na tom, ¾e pøíslu¹ná smlouva je uzavøena teprve výslovným dosa¾ením shody na v¹ech jejích nále¾itostech. - odesílatel tohoto emailu informuje, ¾e není oprávnìn uzavírat za spoleènost ¾ádné smlouvy s výjimkou pøípadù, kdy k tomu byl písemnì zmocnìn nebo písemnì povìøen a takové povìøení nebo plná moc byly adresátovi tohoto emailu pøípadnì osobì, kterou adresát zastupuje, pøedlo¾eny nebo jejich existence je adresátovi èi osobì jím zastoupené známá. This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner. The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email. In case that this e-mail forms part of business dealings: - the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and without stating any reasoning. - if the e-mail contains an offer, the recipient is entitled to immediately accept such offer; The sender of this e-mail (offer) excludes any acceptance of the offer on the part of the recipient containing any amendment or variation. - the sender insists on that the respective contract is concluded only upon an express mutual agreement on all its aspects. - the sender of this e-mail informs that he/she is not authorized to enter into any contracts on behalf of the company except for cases in which he/she is expressly authorized to do so in writing, and such authorization or power of attorney is submitted to the recipient or the person represented by the recipient, or the existence of such authorization is known to the recipient of the person represented by the recipient. ________________________________ Tento e-mail a jakékoliv k nìmu pøipojené dokumenty jsou dùvìrné a jsou urèeny pouze jeho adresátùm. Jestli¾e jste obdr¾el(a) tento e-mail omylem, informujte laskavì neprodlenì jeho odesílatele. Obsah tohoto emailu i s pøílohami a jeho kopie vyma¾te ze svého systému. Nejste-li zamý¹leným adresátem tohoto emailu, nejste oprávnìni tento email jakkoliv u¾ívat, roz¹iøovat, kopírovat èi zveøejòovat. Odesílatel e-mailu neodpovídá za eventuální ¹kodu zpùsobenou modifikacemi èi zpo¾dìním pøenosu e-mailu. V pøípadì, ¾e je tento e-mail souèástí obchodního jednání: - vyhrazuje si odesílatel právo ukonèit kdykoliv jednání o uzavøení smlouvy, a to z jakéhokoliv dùvodu i bez uvedení dùvodu. - a obsahuje-li nabídku, je adresát oprávnìn nabídku bezodkladnì pøijmout; Odesílatel tohoto e-mailu (nabídky) vyluèuje pøijetí nabídky ze strany pøíjemce s dodatkem èi odchylkou. - trvá odesílatel na tom, ¾e pøíslu¹ná smlouva je uzavøena teprve výslovným dosa¾ením shody na v¹ech jejích nále¾itostech. - odesílatel tohoto emailu informuje, ¾e není oprávnìn uzavírat za spoleènost ¾ádné smlouvy s výjimkou pøípadù, kdy k tomu byl písemnì zmocnìn nebo písemnì povìøen a takové povìøení nebo plná moc byly adresátovi tohoto emailu pøípadnì osobì, kterou adresát zastupuje, pøedlo¾eny nebo jejich existence je adresátovi èi osobì jím zastoupené známá. This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner. The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email. In case that this e-mail forms part of business dealings: - the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and without stating any reasoning. - if the e-mail contains an offer, the recipient is entitled to immediately accept such offer; The sender of this e-mail (offer) excludes any acceptance of the offer on the part of the recipient containing any amendment or variation. - the sender insists on that the respective contract is concluded only upon an express mutual agreement on all its aspects. - the sender of this e-mail informs that he/she is not authorized to enter into any contracts on behalf of the company except for cases in which he/she is expressly authorized to do so in writing, and such authorization or power of attorney is submitted to the recipient or the person represented by the recipient, or the existence of such authorization is known to the recipient of the person represented by the recipient. ________________________________ Tento e-mail a jakékoliv k nìmu pøipojené dokumenty jsou dùvìrné a jsou urèeny pouze jeho adresátùm. Jestli¾e jste obdr¾el(a) tento e-mail omylem, informujte laskavì neprodlenì jeho odesílatele. Obsah tohoto emailu i s pøílohami a jeho kopie vyma¾te ze svého systému. Nejste-li zamý¹leným adresátem tohoto emailu, nejste oprávnìni tento email jakkoliv u¾ívat, roz¹iøovat, kopírovat èi zveøejòovat. Odesílatel e-mailu neodpovídá za eventuální ¹kodu zpùsobenou modifikacemi èi zpo¾dìním pøenosu e-mailu. V pøípadì, ¾e je tento e-mail souèástí obchodního jednání: - vyhrazuje si odesílatel právo ukonèit kdykoliv jednání o uzavøení smlouvy, a to z jakéhokoliv dùvodu i bez uvedení dùvodu. - a obsahuje-li nabídku, je adresát oprávnìn nabídku bezodkladnì pøijmout; Odesílatel tohoto e-mailu (nabídky) vyluèuje pøijetí nabídky ze strany pøíjemce s dodatkem èi odchylkou. - trvá odesílatel na tom, ¾e pøíslu¹ná smlouva je uzavøena teprve výslovným dosa¾ením shody na v¹ech jejích nále¾itostech. - odesílatel tohoto emailu informuje, ¾e není oprávnìn uzavírat za spoleènost ¾ádné smlouvy s výjimkou pøípadù, kdy k tomu byl písemnì zmocnìn nebo písemnì povìøen a takové povìøení nebo plná moc byly adresátovi tohoto emailu pøípadnì osobì, kterou adresát zastupuje, pøedlo¾eny nebo jejich existence je adresátovi èi osobì jím zastoupené známá. This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner. The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email. In case that this e-mail forms part of business dealings: - the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and without stating any reasoning. - if the e-mail contains an offer, the recipient is entitled to immediately accept such offer; The sender of this e-mail (offer) excludes any acceptance of the offer on the part of the recipient containing any amendment or variation. - the sender insists on that the respective contract is concluded only upon an express mutual agreement on all its aspects. - the sender of this e-mail informs that he/she is not authorized to enter into any contracts on behalf of the company except for cases in which he/she is expressly authorized to do so in writing, and such authorization or power of attorney is submitted to the recipient or the person represented by the recipient, or the existence of such authorization is known to the recipient of the person represented by the recipient. ________________________________ Tento e-mail a jakékoliv k nìmu pøipojené dokumenty jsou dùvìrné a jsou urèeny pouze jeho adresátùm. Jestli¾e jste obdr¾el(a) tento e-mail omylem, informujte laskavì neprodlenì jeho odesílatele. Obsah tohoto emailu i s pøílohami a jeho kopie vyma¾te ze svého systému. Nejste-li zamý¹leným adresátem tohoto emailu, nejste oprávnìni tento email jakkoliv u¾ívat, roz¹iøovat, kopírovat èi zveøejòovat. Odesílatel e-mailu neodpovídá za eventuální ¹kodu zpùsobenou modifikacemi èi zpo¾dìním pøenosu e-mailu. V pøípadì, ¾e je tento e-mail souèástí obchodního jednání: - vyhrazuje si odesílatel právo ukonèit kdykoliv jednání o uzavøení smlouvy, a to z jakéhokoliv dùvodu i bez uvedení dùvodu. - a obsahuje-li nabídku, je adresát oprávnìn nabídku bezodkladnì pøijmout; Odesílatel tohoto e-mailu (nabídky) vyluèuje pøijetí nabídky ze strany pøíjemce s dodatkem èi odchylkou. - trvá odesílatel na tom, ¾e pøíslu¹ná smlouva je uzavøena teprve výslovným dosa¾ením shody na v¹ech jejích nále¾itostech. - odesílatel tohoto emailu informuje, ¾e není oprávnìn uzavírat za spoleènost ¾ádné smlouvy s výjimkou pøípadù, kdy k tomu byl písemnì zmocnìn nebo písemnì povìøen a takové povìøení nebo plná moc byly adresátovi tohoto emailu pøípadnì osobì, kterou adresát zastupuje, pøedlo¾eny nebo jejich existence je adresátovi èi osobì jím zastoupené známá. This e-mail and any documents attached to it may be confidential and are intended only for its intended recipients. If you received this e-mail by mistake, please immediately inform its sender. Delete the contents of this e-mail with all attachments and its copies from your system. If you are not the intended recipient of this e-mail, you are not authorized to use, disseminate, copy or disclose this e-mail in any manner. The sender of this e-mail shall not be liable for any possible damage caused by modifications of the e-mail or by delay with transfer of the email. In case that this e-mail forms part of business dealings: - the sender reserves the right to end negotiations about entering into a contract in any time, for any reason, and without stating any reasoning. - if the e-mail contains an offer, the recipient is entitled to immediately accept such offer; The sender of this e-mail (offer) excludes any acceptance of the offer on the part of the recipient containing any amendment or variation. - the sender insists on that the respective contract is concluded only upon an express mutual agreement on all its aspects. - the sender of this e-mail informs that he/she is not authorized to enter into any contracts on behalf of the company except for cases in which he/she is expressly authorized to do so in writing, and such authorization or power of attorney is submitted to the recipient or the person represented by the recipient, or the existence of such authorization is known to the recipient of the person represented by the recipient. [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org 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.