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
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.
---
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)
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
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.
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
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.
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
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,
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
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
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
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
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
?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
吴 昊 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
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
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
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
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
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
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
--
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,
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 -
]
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
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
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
27 matches
Mail list logo