Hello
Can someone explain me the difference between aggregate and merge, please?
I've read the help on both commands but I don't understant the difference.
thanks
--
View this message in context:
http://r.789695.n4.nabble.com/aggregate-vs-merge-tp2255300p2255300.html
Sent from the R help maili
Maybe he wants to compile it to an exe file in order to make it faster.
--
View this message in context:
http://r.789695.n4.nabble.com/executable-script-tp839859p2255307.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project
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
...
Hi
thanks
Let say data are written like this:
1990-01-01 10:01:00 , 0.910
1990-01-01 10:03:00 , 0.905
Would it be ok to read it with theses lines or is better to use your way?
tmp <- read.table("demo2.txt", sep = ",")
z <- zoo(tmp[, 2], as.Date(as.chron(tmp[, 1]), format = "%Y-%m-%d
%H:%M:%S
I can't see where you check the date.
--
View this message in context:
http://r.789695.n4.nabble.com/working-with-zoo-time-index-tp2255804p2257226.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https
Hi
I'll ask in a different way...
I have all this in a file.txt
1990-01-01 10:00:00 , 0.900 # element 1
1990-01-01 10:01:00 , 0.910 # element 2
1990-01-01 10:03:00 , 0.905 # element 3
1990-01-01 10:04:00 , 0.905 # element 4
1990-01-01 10:05:00 , 0.890
I said taking the first element everyday, but that was just an example, I
could need one every 2 hours or something more complicated such as one every
hour if the former one was non null.
--
View this message in context:
http://r.789695.n4.nabble.com/working-with-zoo-time-index-tp2255804p2257641
OK,
I've seen now your reply now
thanks very much
--
View this message in context:
http://r.789695.n4.nabble.com/working-with-zoo-time-index-tp2255804p2257958.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org maili
thanks
How can I do it without using "aggregate"?
In other languages they use commands like Time[i] or Date[i]<>Date[i-1]
were i is the cell
--
View this message in context:
http://r.789695.n4.nabble.com/working-with-zoo-time-index-tp2255804p2257952.html
Sent from the R help mailing list a
Hi again.
I have several files with data like above. Each file has different periods.
My idea is to use zoo in order to do this...
Converting all data to same period, the smaller one, 5 minutes.
Whenever a datum doesn't exist copy the last one. (carry forward)
Add data of every 5 minutes gettin
What if I use something like
myvalue = coredata[ index[x] == as.Date("2009-03-01") ]
--
View this message in context:
http://r.789695.n4.nabble.com/working-with-zoo-time-index-tp2255804p2258802.html
Sent from the R help mailing list archive at Nabble.com.
__
I've read all these documents and some other.
--
View this message in context:
http://r.789695.n4.nabble.com/working-with-zoo-time-index-tp2255804p2259106.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing li
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
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
--
If I just add them (without merging) I get only the common elements.
rowsum doesn't work for me
--
View this message in context:
http://r.789695.n4.nabble.com/merging-and-adding-time-series-tp2274125p2274131.html
Sent from the R help mailing list archive at Nabble.com.
_
Hello
I have a table of this kind:
functionx1 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.2
Thank you very much, I'll try it.
About my question on graphics with colour...
Imagine I have a function y=y(x1, x2, x3), I'd need four dimensions to graph
x1, x2, x3, and y.
My idea is to use the typical 3D plot adding the information of the
additional fourth variable 'y to the colour of the po
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 t
Something strange.
Your example work but...
I have a zoo object.
I extract its element 21
>> index(test[21])
> [1] (05/12/05 23:00:00)
>
>> index(test[21])+1/24
> [1] (05/12/05 24:00:00)
>
>
Why 24:00 ?
>> packageDescription("chron")$Version
> [1] "2.3-35"
>> R.version.string
> [1] "R
I don't know.
You can look at the file, is very short.
http://r.789695.n4.nabble.com/file/n2533223/test test
--
View this message in context:
http://r.789695.n4.nabble.com/Bug-on-chron-tp2533135p2533223.html
Sent from the R help mailing list archive at Nabble.com.
_
I've tried with other zoo series and I have always the same problem.
--
View this message in context:
http://r.789695.n4.nabble.com/Bug-on-chron-with-zoo-tp2533135p2533287.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-pro
Hello
Imagine I have a vector with ones and zeroes
I write it compactly:
011100101
I need to get a new vector replacing the "N" ones following the zeroes to
new zeroes.
For example for N = 3
011100101 becomes
Hi
I'll study your answers.
I could also try
gsub("01", "00", x) N times
but it could be very slow if N is large
In fact when I wrote 10011I mean a vector
1
1
1
1
1
0
0
1
1
not a string, but I wrote it more compactly.
I also could by shifting the elements of the vector one position and
Hello, Dennis
Do you prefer your way or this one?
http://stackoverflow.com/questions/3686982/r-adding-zeroes-after-old-zeroes-in-a-vector
stackoverflow, Jonathan
http://r.789695.n4.nabble.com/adding-zeroes-after-old-zeroes-in-a-vector-tp2534824p2534995.html
Sent from the R help mailing list arc
Hello
Your code gives a vector with length different to the original one
--
View this message in context:
http://r.789695.n4.nabble.com/adding-zeroes-after-old-zeroes-in-a-vector-tp2534824p2535017.html
Sent from the R help mailing list archive at Nabble.com.
___
Hi
z shifting:
c(1,z[-length(z)])
then for N=1
tmp <- c(1,z[-length(z)])*z
or
c(1,z[-length(z)])&&z
length of the vector
100
(Indeed is more complicated because I need to use the result of all this
with zoo time series)
Typical N
10 to 400
typical number of zeros
10%
I'll try all your new
OK
thanks to all, I don't need, more
Up to this moment the fastest working code is Jonathan Chang's
http://stackoverflow.com/questions/3686982/r-adding-zeroes-after-old-zeroes-in-a-vector/3689360#3689360
rr <- rle(tmp)
## Pad so that it always begins with 1 and ends with 1
if (rr$values[1] == 0)
Hello
How can I substitute all NA values by zero in a R zoo series?
I've been reading about na.locf and na.omit but I think none of them do
what I need.
thanks.
--
View this message in context:
http://r.789695.n4.nabble.com/Substitute-NAs-by-zero-tp2546715p2546715.html
Sent from the R help ma
Hello
How can I change the spacing of tick marks on the axis a plot?
What parameters should I use on base plot or on rgl?
cheers
--
View this message in context:
http://r.789695.n4.nabble.com/change-tick-spacing-on-the-axis-of-a-plot-tp2553149p2553149.html
Sent from the R help mailing list ar
Hello.
How can I write this all in one line?
mydata is a zoo series, limit is a numeric vector of the same size
tmp <- ave(coredata(mydata),as.Date(index(mydata)),FUN = function(x) (
(cummax(x)-x )) )
tmp <- (tmp < limit)
final <- ave(coredata(tmp),as.Date(index(mydata)),FUN = function(x) cumpr
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 divi
It's a problem much bigger.
I use a matrix to store the results of a bigger problem.
I loop through several variables and store the results of a computation on
that matrix.
At the beginning of the problem I initialize the matrix to zeros and I
calculate its size from some input.
And that seems no
Hello
I've seen the answer at stackoverflow.
They also said I must use zapsmall to avoid roundup problems.
I didn't expect this behaviour when division gives an integer number.
--
View this message in context:
http://r.789695.n4.nabble.com/R-Why-this-deosn-t-work-matrix-rounding-error-tp2968527
Hello
I've used read.table to read a file that contains numbers such as 0.1
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-
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 f
Hello
Could anyone explain me the difference between strftime vs strptime, please
?
I've read the help but it's a little bit cionfusing for me.
cheers
--
View this message in context:
http://r.789695.n4.nabble.com/strftime-vs-strptime-tp3018865p3018865.html
Sent from the R help mailing list
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 arch
Hello
How can I get multipanel conditioning graphics with rgl as I do with lattice
"|"
For example I have three variables x, y, z, w. Where x,y,z are continuous
and w is categorical or discrete.
I want to use plot3d(x,y,z) for each value of w in a panel
something like plot3d(z~x*y|w)
cheers
Hello
How can I get multipanel conditioning graphics with rgl as I do with lattice
"|"
For example I have three variables x, y, z, w. Where x,y,z are continuous
and w is categorical or discrete.
I want to use plot3d(x,y,z) for each value of w in a panel
something like plot3d(z~x*y|w)
cheers
Hello everybody.
My question arised from the output of lattice's histogram. But might be
extended to any other object that could be printed.
I think I've understood your answers, print calls the plot function when
the object to be printed is a trellis plot object.
I guess I can always use plot
Hello
I just get one plot
How can I concoct several rgl plots?
--
View this message in context:
http://r.789695.n4.nabble.com/rgl-multiple-graphics-tp3047006p3048434.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.
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-t
OK, thanks
Some time ago I asked in the forum how to read data from a file in order to
use it with zoo.
Someone suggested to use textConnection
That's why I'm a little bit confused.
I guess I don't need to use textConnection in order to read from files, it's
just for text copied from other sourc
Gabor Grothendieck wrote:
>
>
> Note that zoo does have the read.zoo function which can read a file
> returning a zoo object. See help(read.zoo) .
>
>
I know, but there are many different ways to read and I wanted to know
what's the proper in my case.
For example I've seen these ones, what
I've just seen that sep sep cannot be "," because there are not commas in
the file.
but I want it to take the first and second columns (date and time) as a
whole, the index.
--
View this message in context:
http://r.789695.n4.nabble.com/when-to-use-textConnection-tp2327132p2327622.html
Sent fr
Error in .subset(x, j) : invalid subscript type 'list'
Maybe is because I'm using Revolution Analytics and is based on an older
version of R.
I use it because I need to manage very big files and the common version of R
shows me an out of memory error.
--
View this message in context:
http://r.
Oh, I got it with these code:
tmp <- read.table("file.txt")
mydata <- zoo(z$V3, as.chron(paste(z$V1,z$V2)))
but that way I cannot specify the format of the date
cheers
--
View this message in context:
http://r.789695.n4.nabble.com/when-to-use-textConnection-tp2327132p2327656.html
Sent from t
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
I get this message
"character string is not in a standard unambiguous format"
and if I try to use a zoo object
"Error en `$.zoo`(final, V2) : not possible for univariate zoo series"
cheers
--
View this message in context:
http://r.789695.n4.nabble.com/remove-rows-tp2328312p2328487.html
Sent fro
Now it works
I was reading from a file
DF <- read.table("prueba.txt")
DF[!as.POSIXlt(DF$V1)[['min']] %% 10,]
didn't do anything, then I tried
zz[!as.POSIXlt(zz$V2)[['min']] %% 10,]
that caused an error
Error en as.POSIXlt.character(as.character(x)) :
character string is not in a standard unamb
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 2
Phil Spector wrote:
>
>
> For chron objects:
>
> aggregate(thedata$value,list(hour=hours(thedata$date)),mean)
>
>
Ok, thanks, that's what I need. Now it seems so easy...
Could you tell me why we write... ?
aggregate(thedata$value,list(hour=hours(thedata$date)),mean)
instead of just
ag
Hello
I have a time series (with index of type chron) and I need to calculate the
cummax(mydata)-mydata
on every day separately.
I've tried this
aggregate(mydata, as.date, cummax)
but aggregate can only produce a single scalar result for each subset
instead of a vector.
I've tried with tapply
Hi
Just in case somebody could be interested I've found that
unlist(lapply(split(mydata,as.Date), cummax))
could make the job
but I don't know if it's the proper way if I want to use zoo objects.
Any suggestion??
--
View this message in context:
http://r.789695.n4.nabble.com/aggregate-with
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 througho
thanks
I'll try them,
Why do you use the brackets in zz[] ?
--
View this message in context:
http://r.789695.n4.nabble.com/Repeat-the-first-day-data-through-all-the-day-Zoo-tp2338069p2338266.html
Sent from the R help mailing list archive at Nabble.com.
___
# duplicated / na.locf doesn't work
it says Error in fix.by(by.x, x) : 'by' must specify valid column(s)
if I use ifelse instead of ifelse.zoo it works but it gives me a non zoo
vector.
Myabe is because my zoo version is older.
cheers
--
View this message in context:
http://r.789695.n4.nabbl
Hello
Is there any package for rendering or raytracing?
--
View this message in context:
http://r.789695.n4.nabble.com/rendering-or-raytracing-tp4213944p4213944.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mail
Hi
Then OK, I mean raytracing directly with some R package.
Or maybe some optics package
I've seen there exist an optics package called planar but it's only for
reflection and transmission at planar interfaces.
--
View this message in context:
http://r.789695.n4.nabble.com/rendering-or-raytracin
59 matches
Mail list logo