Displaying 20 results from an estimated 1000 matches similar to: "Substitute NAs by zero"
2010 Aug 25
2
Repeat the first day data through all the day. Zoo
down vote favorite
Hello
I have a zoo series. It lasts 10 years and its frequency is 15min.
I'd like to get a new zoo series (or vector) with the same number of
elements, whith each element equal to the first element of the day. That's,
The first element everyday is repeated throughout the wole day.
This is not same as aggregate(originalseries,as.Date,head,1) because this
gives a
2010 Jun 30
2
merging and adding time series
Hello
I have two series (that can have with different frequencies or with missing
values).
I merge them and use na.locf, getting a zoo objet with a common index and
two core columns.
How can I add this columns getting a new zoo series?
Any other way of adding two asynchronou series?
regards
--
View this message in context:
2010 Oct 20
4
How to select not continous rows?
Hello
How can I select several not continuous rows ?
If I wanted to select rows 1 to 7 I'll write
mydata[,1:7]
But what if I need to select rows 1 to 5 and 10 to 15?
--
View this message in context: http://r.789695.n4.nabble.com/How-to-select-not-continous-rows-tp3003840p3003840.html
Sent from the R help mailing list archive at Nabble.com.
2010 Jun 15
6
working with zoo time index ??
Hello
Where could I find examples on how to work with the time index in a
timeseries or zoo series?
Let say I've got this series
DATA
1990-01-01 10:00:00 0.900
1990-01-01 10:01:00 0.910
1990-01-01 10:03:00 0.905
1990-01-01 10:04:00 0.905
1990-01-01 10:05:00 0.890
.......................
2000-12-31 20:00:00 0.992
How do I make simple calculations such as ... ?
Calculate the
2010 Sep 10
6
adding zeroes after old zeroes in a vector ??
Hello
Imagine I have a vector with ones and zeroes
I write it compactly:
1111111100001111111111110000000001111111111100101
I need to get a new vector replacing the "N" ones following the zeroes to
new zeroes.
For example for N = 3
1111111100001111111111110000000001111111111100101 becomes
1111111100000001111111110000000000001111111100000
I can do it with a for loop but I've read
2010 Nov 16
4
plot vs print ??
Hello
What's the differente betwen using "plot" and using "print" in order to
plot a graph?
For example in order to plot the result of a histogram.
cheers
--
View this message in context: http://r.789695.n4.nabble.com/plot-vs-print-tp3045256p3045256.html
Sent from the R help mailing list archive at Nabble.com.
2010 Aug 16
2
when to use textConnection ??
Hello.
I don't uderstant when to use textConnection and when not.
Some examples do it, some not.
I've even seen something like
con <- textConnection(rev(rev(ReadLines('data.txt'))[-(1:2]))
data <- read.table(con)
close(con)
--
View this message in context: http://r.789695.n4.nabble.com/when-to-use-textConnection-tp2327132p2327132.html
Sent from the R help mailing list
2010 Jun 19
3
R vs SAS and Revolution R
Hello
How do you compare R to SAS in terms of speed and management of large
datasets?
What about Revolution R?
I've seen on their site, they claim that Revolution R is much faster than R
and it's multithread...
Can you really notice the difference?. What dissadvantage does it have?
I think it's based on R 2.10. but R already issued the version 2.12
Regards
What alternative
2010 Oct 08
2
R: Why this deosn't work?, matrix, rounding error?
Hello
Why this works:
ncota <- 1
nslope <- 29
resul <- matrix(rep(0,ncota*nslope*4),ncota*nslope,4)
But this doesn't?
ncota <- 1
sini <- 0.1; sfin <- 1.5; spaso <- 0.05; nslope <- 1+((sfin-sini)/spaso)
resul <- matrix(rep(0,ncota*nslope*4),ncota*nslope,4)
I guess the problem is that the division gives a noninteger number.
How can I get the second one work?
I
2010 Oct 20
2
number format, writing 1e-5 instead of 0.00001
Hello
I've used read.table to read a file that contains numbers such as 0.00001
when I write them back with write.table those numbers appear as 1e-5
How can I keep the old format?
thanks
--
View this message in context: http://r.789695.n4.nabble.com/number-format-writing-1e-5-instead-of-0-00001-tp3003831p3003831.html
Sent from the R help mailing list archive at Nabble.com.
2010 Aug 18
2
Different way of aggregating
Hi
Usually "aggregate" is used to calculate things such as the sum of all data
on the first day, the sum next day, and so on.
But how can I calculate the mean of the first hour of all days, the mean of
the second hour of all days, and so on. ???
That's
Most examples:
today at 1am + today at 2am + today at 3am +.... -> sum
today
tomorrow at 1am + tomorrow at
2010 Sep 09
3
Bug on chron
hello
I think I've found a bug
I don't know if it's a chron bug or a R one.
(05/12/05 23:00:00) +1/24 gives
(05/12/05 24:00:00)
instead of
(05/13/05 00:00:00)
it looks like the same but it's not because when you get the date of this
datetime it says day 12 instead of 13.
Please, forward it to the place where this bugs are supposed to be posted.
cheers
--
View this message
2010 Aug 17
2
remove rows ??
Hello
I have a file with this format
2005-01-03 09:05 0.00
2005-01-03 09:10 0.01
2005-01-03 09:15 0.02
2005-01-03 09:20 0.03
2005-01-03 09:25 0.04
2005-01-03 09:30 0.05
2005-01-03 09:35 0.06
2005-01-03 09:40 0.07
2005-01-03 09:45 0.08
2005-01-03 09:50 0.09
2005-01-03 09:55 0.10
2005-01-03 10:00 0.00
2005-01-03 10:05 0.00
....
some
2010 Jul 16
2
multivariate graphs, averaging on some vars
Hello
I have a table of this kind:
function x1 x2 x3
2.232 1 1 1.00
2.242 1 1 1.01
2.732 1 1 1.02
2.770 1 2 1.00
1.932 1 2 1.01
2.132 1 2 1.02
3.222 1.2 1 1
..... ... .. ..
The table represents the values of a function(x1, x2, x3) for each
combination x1, x2, x3.
I'd like to generate a plot where each point has the coordinates x=x1, y=x2,
2012 Jul 02
2
using "na.locf" from package zoo to fill NA gaps
Hi everybody,
I have a small question about the function "na.locf" from the package "zoo".
I saw in the help that this function is able to fill NA gaps with the last
value before the NA gap (or with the next value).
But it is possible to fill my NA gaps according to the last AND the next
value at the same time?
Actually, I want R to fill my gaps with the method of
2007 Oct 29
9
Problems with mongrel on NetBSD
I seem to have a (recent) problem with mongrel on NetBSD. I''m running
a development release of NetBSD (called NetBSD-current 4.99.34).
When I start mongrel, it listens on the IPv6 wildcard address, but not
on the IPv4 wildcard:
=> Booting Mongrel (use ''script/server webrick'' to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with
2018 Jan 08
0
Replace NAs in split lists
"Enforce" is overstating it... results will differ if there are no non-NA values for a given ID, and there is a potential further discrepancy if there are multiple non-NA values. But these issues were not identified by the OP, so may not be relevant in their case.
--
Sent from my phone. Please excuse my brevity.
On January 8, 2018 6:41:33 AM PST, Eric Berger <ericjberger at
2011 Sep 30
1
last observation carried forward +1
Hi R-helpers
I'm looking for a vectorised function which does missing value replacement
as in last observation carried forward in the zoo package but instead of a
locf, I would like the locf function to add +1 to each time a missing value
occurred. See below for an example.
> require(zoo)
> x <- 5:15
> x[4:7] <- NA
> coredata(na.locf(zoo(x)))
[1] 5 6 7 7 7 7 7 12 13
2018 Jan 08
0
Replace NAs in split lists
Yes, you are right if the IDs are always sequentially-adjacent and the first non-NA value appears in the first record for each ID.
--
Sent from my phone. Please excuse my brevity.
On January 8, 2018 2:29:40 AM PST, PIKAL Petr <petr.pikal at precheza.cz> wrote:
>Hi
>
>With the example, na.locf seems to be the easiest way.
>> library(zoo)
>
>> na.locf(df1)
> ID
2011 Jun 15
0
specifying interactions in a gam model with "by"
I?m confused by the difference in the fit of a gam model (in package mgcv)
when I specify an interaction in different ways. I would appreciate it if
someone could explain the cause of these differences.
For example:
x <- c(105, 124, 124, 124, 144, 144, 150, 176, 178, 178,
206, 206, 212, 215, 215, 227, 229, 229, 229, 234,
234, 254, 254, 290, 290, 303, 334, 334, 334, 344,