[R] interpolation

2007-09-04 Thread Yogesh Tiwari
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

Re: [R] interpolation

2007-09-04 Thread Moshe Olshansky
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. ---

[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)

Re: [R] Interpolation in time

2005-10-06 Thread jim holtman
Is this what you want? 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

Re: [R] Interpolation in time

2005-10-06 Thread Achim Zeileis
On Thu, 6 Oct 2005 16:10:15 +0200 Anette Nørgaard wrote: This is exactly what I requested, thank you!! However I do actually have several columns in my data sheet where I need to do the same thing, then how do I come about that? Look at na.approx() in package zoo. Best, Z e.g.

Re: [R] Interpolation in time

2005-10-06 Thread Gabor Grothendieck
Is doy intended to represent the number of days since the beginning of the year? In that case convert the first two columns to class Date and interpolate using approx. See ?approx for variations: tt - as.Date(paste(yr, 1, 1, sep = -)) + doy - 1 ta[,dat] - approx(tt, dat, tt)$y Even better

Re: [R] Interpolation in time

2005-10-06 Thread Gabor Grothendieck
na.approx(zoo(ta[,-seq(2)], tt)) where tt is as before. On 10/6/05, Anette Nørgaard [EMAIL PROTECTED] wrote: This is exactly what I requested, thank you!! However I do actually have several columns in my data sheet where I need to do the same thing, then how do I come about that? e.g.

[R] interpolation function

2005-08-05 Thread 吴 昊
Hi, I have a sparse matrix.I want to fill values into the entries whose value is 0.The new generated values should come from the interpolation of the values have existed.Does R provide such interpolation functions which operate on Matrix, for example ,such a matrix below 0 0 0 0 2.3 0 0

Re: [R] interpolation function

2005-08-05 Thread Rolf Turner
What you intend strikes me as being pretty silly. Do not expect R to work magic for you. Even if there were such a function as you desire in R, the results it would give would be effectively meaningless for data such as you exhibited. cheers,

Re: [R] interpolation function

2005-08-05 Thread Adaikalavan Ramasamy
I do not understand your question. If this was not a sparse matrix, then I would have asked you refer into the missing value literature. Even there, people generally remove any columns/rows that have too many missing values to avoid unreliable results. And since this is a sparse matrix, you are

Re: [R] interpolation function

2005-08-05 Thread Spencer Graves
I hope you don't take offense at anything said on this list. My philosophy about this is summarized in something I wrote last December that has since been immoratlized in the fortunes package: library(fortunes) fortune(Spencer Graves) Our great-great grandchilren as yet unborn

Re: [R] interpolation function

2005-08-05 Thread tom wright
On Fri, 2005-05-08 at 12:12 +, 吴 昊 wrote: Hi, I have a sparse matrix.I want to fill values into the entries whose value is 0.The new generated values should come from the interpolation of the values have existed.Does R provide such interpolation functions which operate on Matrix, for

Re: [R] interpolation function

2005-08-05 Thread Liaw, Andy
I don't know if what Hao wanted to do is to hang himself, but if so, perhaps here is one possible rope: idx - which(m 0, arr.ind=TRUE) m.nz - m[idx] library(akima) (m.int - interp.new(idx[,1], idx[,2], m.nz, xo=1:9, yo=1:9, extrap=TRUE)) $x [1] 1 2 3 4 5 6 7 8 9 $y [1] 1 2 3 4 5 6 7 8 9 $z

[R] interpolation function in R

2005-08-04 Thread 吴 昊
Hi does R provide some interpolation fucntions? thank __ 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

Re: [R] interpolation function in R

2005-08-04 Thread Rolf Turner
?approx ?splinefun __ 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

Re: [R] interpolation function in R

2005-08-04 Thread Sundar Dorai-Raj
吴 昊 wrote: Hi does R provide some interpolation fucntions? thank __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

[R] Interpolation or Kriging

2004-03-05 Thread Sebastien Durand
Hello! Here is my problem, I have got a data set that contains values of intensity over a regular interval of time. What I need to do is to resample this data set (or curve) at a different interval of time x (1000 predictions will be made to resample the curve). So in order to perform such an

[R] Interpolation or Kriging

2004-03-05 Thread Edzer J. Pebesma
Sebastien, Please have a look at the geostatistics packages refered to from http://sal.agecon.uiuc.edu/csiss/Rgeo/ BTW -- is this page referenced from the R or CRAN home pages? I couldn't find a link a few days ago. Most of them may do what you want. I assume they can all be fooled by providing

[R] interpolation of the vector

2003-10-20 Thread temiz
Hello library(fields) x-cbind(dt1$V1,dt1$V2) # V1:east , V2=north coordinates of points Y-cbind(dt1$V4,dt1$V5) # V4,V5 cos and sines components fit2 - Krig(x,Y,cov.function=exp.cov, scale.type=range) : this gives Error in if (abs(f2 - f1) tol) { : missing value where TRUE/FALSE needed what

[R] Interpolation of azimuth values

2003-10-16 Thread temiz
Hello I will make an interpolation of data which represents azimuth direction ( angle from north in clockwise direction) values. But there is a problem. Say, for instance, while 1 and 359 indicate somewhat same direction, interpolation puts values in the range from 1 to 359. What can I do to

Re: [R] Interpolation of azimuth values

2003-10-16 Thread Prof Brian Ripley
On Thu, 16 Oct 2003, temiz wrote: I will make an interpolation of data which represents azimuth direction ( angle from north in clockwise direction) values. But there is a problem. Say, for instance, while 1 and 359 indicate somewhat same direction, interpolation puts values in the range

Re: [R] interpolation methods

2003-10-11 Thread Kris Nackaerts
Dear, Have a look at: *akima http://cran.r-project.org/src/contrib/akima_0.3-4.tar.gz: Interpolation of irregularly spaced data* Linear or cubic spline interpolation for irregular gridded data Kris --

Re[2]: [R] Interpolation

2003-02-12 Thread Remigijus Lapinskas
Many thanks to all who replied to my e-mail. My problem was that I had not known about the approx function. By the way, if I have x - c(1990,1994,1995,1997), is there an automated way to fill in the gaps, i.e., to get c(1991,1992,1993,1996)? Cheers, Remigijus Wednesday, February 12, 2003,

Re: [R] Interpolation

2003-02-12 Thread Sundar Dorai-Raj
Remigijus Lapinskas wrote: Many thanks to all who replied to my e-mail. My problem was that I had not known about the approx function. By the way, if I have x - c(1990,1994,1995,1997), is there an automated way to fill in the gaps, i.e., to get c(1991,1992,1993,1996)? Try this: R x -

RE: [R] Interpolation

2003-02-12 Thread Adaikalavan Ramasamy
] Subject: Re: [R] Interpolation Remigijus Lapinskas wrote: Many thanks to all who replied to my e-mail. My problem was that I had not known about the approx function. By the way, if I have x - c(1990,1994,1995,1997), is there an automated way to fill in the gaps, i.e., to get c

[R] interpolation and 3D plots

2003-02-03 Thread Davies, Jonathan
I've been told that you may be able to help. I have a complex linear model with multiple two-way interaction terms. Is there a way to view the interaction terms in a 3d plot equivalent to the S functions: plan-interp(x,y,z) image(plan) where x and y are my explanatory variables and z my

Re: [R] interpolation and 3D plots

2003-02-03 Thread John Fox
Dear Jonathan, The all.effects function in the car package will identify the high-order terms in a linear or generalized-linear model and absorb terms marginal to them (e.g., for a two-way interaction, the main effects marginal to the interaction and the constant). The plot method for the