[R] Interpolation in time

2005-10-06 Thread Anette Nørgaard
Can anybody help me write a code on the following data example, which
fills out all NA values by using a linear interpolation with the two
closest values?
 
Doy is day of year (%j).
 
Code example:
yr-c(rep(2000,14))
doy-c(16:29)
dat-c(3.2,NA,NA,NA,NA,NA,NA,5.1,NA,NA,NA,NA,NA,4.6)
ta-cbind(yr,doy,dat)
 
ta
  yr doy dat
 [1,] 2000  16 3.2
 [2,] 2000  17  NA
 [3,] 2000  18  NA
 [4,] 2000  19  NA
 [5,] 2000  20  NA
 [6,] 2000  21  NA
 [7,] 2000  22  NA
 [8,] 2000  23 5.1
 [9,] 2000  24  NA
[10,] 2000  25  NA
[11,] 2000  26  NA
[12,] 2000  27  NA
[13,] 2000  28  NA
[14,] 2000  29 4.6
 
Anette Norgaard 

[[alternative HTML version deleted]]

__
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


[R] barplot with multiple columns

2005-09-12 Thread Anette Nørgaard
I have a large dataset looking like this (as an example):
 
doy-c(178,179,180,181,182,183,184,185,186,187,188)
s1-c(0 , 0, 2.4 , 0 , 3.34 , 0 , 5.34 , 0 , 0 , 0 , 6.9)
s2-c(0 , 9.72, 0, 10.56 , 2.67 , 0 , 6.45 ,0 , 0 , 9, 3.6)
 
dat-cbind(doy,s1,s2)
 
dat
 
I need to make a barplot where the two time series s1 and s2 are plottet
beside each other for each doy. How can I do that?
 
Anette

[[alternative HTML version deleted]]

__
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


[R] time series graphs

2005-09-04 Thread Anette Nørgaard
About time series graphs, I need help to move on:
 
A time series of data directly from a data logger comes in the dat
format created below:
 
year-c(rep(2005,10))
doy-c(rep(173,5),rep(174,5))
time-c(15,30,45,100,115,15,30,45,100,115)
dat1-c(0.022128,0.035036,0.051632,0.071916,0.081136,0.07837,0.083902,0.
126314,0.080214,0.117094)
dat2-
c(0.533074667,0.887982667,1.284938,1.845450333,2.145839333,2.145126667,2
.392422,3.60253,2.330776333,3.5277)
dat-cbind(year,doy,time,dat1,dat2)
dat
 
time 15 corresponding to 00:15 (past 2400)
 
I'd like to make a graph illustrating all observation from
the two time series dat1 and dat2
in one graph with different possibilities of labeling the x-axis.
 
1st wish:
with the date and time drawn on the x-axis every hour (meaning every
fourth observation)
e.g. June 24 01:00, Jun 24 02:00 etc.
 
2nd example:
with the date label once per 24 hour period
e.g. June 24
 
I've tried many things and have become very confused on the ts
possibilities. Everything I have is
timeseries, so it is very important to get a grip on this.
 
Please give me a hint.
 
Time series beginner - Anette

[[alternative HTML version deleted]]

__
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


[R] time series graphs

2005-09-04 Thread Anette Nørgaard
About time series graphs, I need help to move on:
 
A time series of data directly from a data logger comes in the dat
format created below:
 
year-c(rep(2005,10))
doy-c(rep(173,5),rep(174,5))
time-c(15,30,45,100,115,15,30,45,100,115)
dat1-c(0.022128,0.035036,0.051632,0.071916,0.081136,0.07837,0.083902,0.
126314,0.080214,0.117094)
dat2-
c(0.533074667,0.887982667,1.284938,1.845450333,2.145839333,2.145126667,2
.392422,3.60253,2.330776333,3.5277)
dat-cbind(year,doy,time,dat1,dat2)
dat
 
time 15 corresponding to 00:15 (past 2400)
 
I'd like to make a graph illustrating all observation from
the two time series dat1 and dat2
in one graph with different possibilities of labeling the x-axis.
 
1st wish:
with the date and time drawn on the x-axis every hour (meaning every
fourth observation)
e.g. June 24 01:00, Jun 24 02:00 etc.
 
2nd example:
with the date label once per 24 hour period
e.g. June 24
 
I've tried many things and have become very confused on the ts
possibilities. Everything I have is
timeseries, so it is very important to get a grip on this.
 
Please give me a hint.
 
Time series beginner - Anette
 

[[alternative HTML version deleted]]

__
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