[R] interpolation
Moshe Olshansky
m_olshansky at yahoo.com
Wed Sep 5 02:30:11 CEST 2007
If your data is in data.txt file you can do the
following:
x <- read.table(file="data.txt",header=TRUE)
t<-ISOdatetime(x[,1],x[,2],x[,3],x[,4],x[,5],x[,6])
secs <- as.numeric(t)
So now secs represents your time in seconds and you
can use any type of interpolation you wish to
interpolate co2obs.
--- Yogesh Tiwari <yogesh.mpi at googlemail.com> wrote:
> Hello R Users,
>
> I am new to R and I have simple problem for R users.
>
> I have CO2 observations defined on time
> axis(yr,mo,day,hr,min,sec). (DATA
> ATTACHED HERE)
>
> First I want to convert time axis as one axis as
> 'hour' on regular interval
> as 1 hour. Say 00 hrs to 24hrs(jan1), 25hrs to
> 48hrs(jan2) and so on.
>
> Then I want to interpolate CO2 at every hour.
>
> Kindly anybody can help,
>
> Many thanks,
>
> Regards,
> Yogesh
> > yr mo dy hr min sec co2obs
> 1998 1 9 0 35 24 365.19
> 1998 1 9 1 17 39 363.54
> 1998 1 9 1 58 41 364.24
> 1998 1 9 2 39 42 364.88
> 1998 1 9 3 20 43 365.06
> 1998 1 9 4 1 44 364.75
> 1998 1 9 4 42 45 364.77
> 1998 1 9 5 23 46 364.87
> 1998 1 9 6 4 51 364.77
> 1998 1 9 6 45 52 364.73
> 1998 1 9 7 26 54 364.76
> 1998 1 9 8 7 55 363.49
> 1998 1 23 1 6 16 364.31
> 1998 1 23 1 48 32 364.38
> 1998 1 23 2 29 33 364.67
> 1998 1 23 3 10 35 365.53
> 1998 1 23 3 51 36 365.16
> 1998 1 23 4 32 37 364.56
> 1998 1 23 5 13 40 364.62
> 1998 1 23 5 54 41 365.05
> 1998 1 23 6 35 42 365.13
> 1998 1 23 7 16 44 365.45
> 1998 1 23 7 57 49 364.77
> 1998 1 23 8 38 49 364.65
> 1998 2 3 0 44 21 362.43
> 1998 2 3 1 26 36 363.96
> 1998 2 3 2 7 38 364.59
> 1998 2 3 2 48 40 364.62
> 1998 2 3 3 29 40 366.22
> 1998 2 3 4 10 41 365.4
> 1998 2 3 4 51 41 365.34
> 1998 2 3 5 32 42 365.31
> 1998 2 3 6 13 44 364.84
> 1998 2 3 6 54 46 365.07
> 1998 2 3 7 35 51 364.84
> 1998 2 3 8 16 50 364.81
> 1998 2 19 0 35 14 363.41
> 1998 2 19 1 17 31 362.93
> 1998 2 19 1 58 32 363.86
> 1998 2 19 2 39 33 364.87
> 1998 2 19 3 20 34 366.05
> 1998 2 19 4 1 36 364.84
> 1998 2 19 4 42 36 364.77
> 1998 2 19 5 23 37 365.01
> 1998 2 19 6 4 39 365
> 1998 2 19 6 45 39 365.9
> 1998 2 19 7 26 40 366.24
> 1998 2 19 8 7 41 366.55
> 1998 3 5 0 50 20 363.13
> 1998 3 5 1 32 37 363.6
> 1998 3 5 2 13 39 364.26
> 1998 3 5 2 54 40 364.26
> 1998 3 5 3 35 41 364.39
> 1998 3 5 4 16 42 365.24
> 1998 3 5 4 57 42 365.48
> 1998 3 5 5 38 43 365.01
> 1998 3 5 6 19 44 365.43
> 1998 3 5 7 0 45 365.11
> 1998 3 5 7 41 46 368.54
> 1998 3 5 8 22 48 364.96
> 1998 3 19 0 46 36 363.25
> 1998 3 19 1 28 51 363.8
> 1998 3 19 2 9 53 364.21
> 1998 3 19 2 50 55 364.46
> 1998 3 19 3 31 58 365.61
> 1998 3 19 4 12 59 365.57
> 1998 3 19 4 53 59 365.53
> 1998 3 19 5 35 0 365.38
> 1998 3 19 6 16 3 366.23
> 1998 3 19 6 57 4 364.28
> 1998 3 19 7 38 6 367.08
> 1998 3 19 8 19 5 369.19
> 1998 4 2 1 8 1 363.76
> 1998 4 2 1 50 17 365.14
> 1998 4 2 2 31 18 365.26
> 1998 4 2 3 12 21 364.7
> 1998 4 2 3 53 24 364.04
> 1998 4 2 4 34 25 366.13
> 1998 4 2 5 15 25 366.11
> 1998 4 2 5 56 26 366.34
> 1998 4 2 6 37 27 367.9
> 1998 4 2 7 18 28 367.3
> 1998 4 2 7 59 30 367.02
> 1998 4 2 8 40 35 367.6
> 1998 4 16 0 43 37 364.53
> 1998 4 16 1 25 51 364.09
> 1998 4 16 2 6 53 365.12
> 1998 4 16 2 47 55 365.41
> 1998 4 16 3 28 57 365.4
> 1998 4 16 4 9 57 365.24
> 1998 4 24 0 45 51 364.34
> 1998 4 24 1 28 5 364.78
> 1998 4 24 2 9 7 364.78
> 1998 4 24 2 50 9 364.99
> 1998 4 24 3 31 10 364.62
> 1998 4 24 4 12 11 365.86
> 1998 4 24 4 53 12 367.95
> 1998 4 24 5 34 13 367.97
> 1998 4 24 6 15 17 367.19
> 1998 4 24 6 56 18 368.56
> 1998 4 24 7 37 20 370.28
> 1998 4 24 8 18 20 369.23
> 1998 5 7 0 46 14 364.62
> 1998 5 7 1 28 28 365.45
> 1998 5 7 2 9 29 365.22
> 1998 5 7 2 50 31 365.77
> 1998 5 7 3 31 31 365.87
> 1998 5 7 4 12 33 366.1
> 1998 5 7 4 53 34 366.07
> 1998 5 7 5 34 34 369.69
> 1998 5 7 6 15 36 369.66
> 1998 5 7 6 56 38 370.46
> 1998 5 7 7 37 39 368.98
> 1998 5 7 8 18 40 368.6
> 1998 5 21 0 27 3 367.12
> 1998 5 21 1 9 18 366.16
> 1998 5 21 1 50 19 367.27
> 1998 5 21 2 31 20 366.22
> 1998 5 21 3 12 22 368.61
> 1998 5 21 3 53 24 367.24
> 1998 5 21 4 34 24 366.84
> 1998 5 21 5 15 25 370.65
> 1998 5 21 5 56 27 369
> 1998 5 21 6 37 28 369.96
> 1998 5 21 7 18 31 369.58
> 1998 5 21 7 59 32 368.42
> 1998 6 4 0 46 12 365.12
> 1998 6 4 1 28 27 366.55
> 1998 6 4 2 9 27 366.1
> 1998 6 4 2 50 28 366.98
> 1998 6 4 3 31 30 367.69
> 1998 6 4 4 12 31 366.79
> 1998 6 4 4 53 31 368.43
> 1998 6 4 5 34 32 368.46
> 1998 6 4 6 15 34 368.71
> 1998 6 4 6 56 35 369.91
> 1998 6 4 7 37 36 368.71
> 1998 6 4 8 18 38 369.38
> 1998 6 18 0 30 55 365.16
> 1998 6 18 1 13 10 366.67
> 1998 6 18 1 54 13 365.79
> 1998 6 18 2 35 14 366.48
> 1998 6 18 3 16 15 366.79
> 1998 6 18 3 57 16 367.88
> 1998 6 18 4 38 16 367.84
> 1998 6 18 5 19 17 368.39
> 1998 6 18 6 0 18 368.65
> 1998 6 18 6 41 20 368.8
> 1998 6 18 7 22 20 368.37
> 1998 6 18 8 3 21 367.93
> 1998 7 12 0 34 47 365.17
> 1998 7 12 1 17 2 366.45
> 1998 7 12 1 58 2 366.72
> 1998 7 12 2 39 2 366.23
> 1998 7 12 3 20 3 366.31
> 1998 7 12 4 1 5 367.07
> 1998 7 12 4 42 7 367.44
> 1998 7 12 5 23 10 366.94
> 1998 7 12 6 4 12 367.27
> 1998 7 12 6 45 13 367.45
> 1998 7 12 7 26 15 366.59
> 1998 7 12 8 7 15 365.04
> 1998 7 23 0 43 7 367.07
> 1998 7 23 1 25 22 366.46
> 1998 7 23 2 6 22 366.27
> 1998 7 23 2 47 23 365.89
> 1998 7 23 3 28 26 365.74
> 1998 7 23 4 9 27 366.39
> 1998 7 23 4 50 28 366.63
> 1998 7 23 5 31 29 366.51
> 1998 7 23 6 12 32 366.5
> 1998 7 23 6 53 33 365.7
> 1998 7 23 7 34 34 365.21
> 1998 7 23 8 15 35 364.58
> 1998 8 6 1 16 54 366.86
> 1998 8 6 1 59 10 366.19
> 1998 8 6 2 40 12 366.5
> 1998 8 6 3 21 13 366.14
> 1998 8 6 4 2 15 366.11
> 1998 8 6 4 43 16 366.2
> 1998 8 6 5 24 16 366.63
> 1998 8 6 6 5 18 366.38
> 1998 8 6 6 46 19 364.87
> 1998 8 6 7 27 20 363.89
> 1998 8 6 8 8 22 364.76
> 1998 8 6 8 49 22 363.34
> 1998 8 20 1 4 3 366.07
> 1998 8 20 1 46 17 366.21
> 1998 8 20 2 27 18 365.33
> 1998 8 20 3 8 19 365.86
> 1998 8 20 3 49 20 366.24
> 1998 8 20 4 30 23 366.6
> 1998 8 20 5 11 24 366.05
> 1998 8 20 5 52 24 366.27
> 1998 8 20 6 33 26 364.84
> 1998 8 20 7 14 27 364.47
> 1998 8 20 7 55 29 364.63
> 1998 8 20 8 36 30 364.82
> 1998 9 11 0 39 33 366.17
> 1998 9 11 1 21 48 366.52
>
=== message truncated ===>
______________________________________________
> R-help at 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.
>
More information about the R-help
mailing list