Displaying 20 results from an estimated 1000 matches similar to: "align"
2005 Jun 07
3
without a loop
tmp <- c(-1,NA,NA,1,1,NA,NA,1)
without using a loop, how can I replace all NAs in the list above with
the previous none NA value in the list?
2005 Oct 27
3
its dates masked by chron
I built R 2.2.0 from source on my debian machine yesterday and updated
all packages. My problem is that "dates" function from its, that my
code heavely uses is now masked by "dates" from chron.
How can I specify tehat I want to use dates from its or how can I
prevent it from being masked?
> library(its)
Loading required package: Hmisc
Hmisc library by Frank E Harrell Jr
2006 Apr 10
3
timeAlign
I use POSIXct for datetimes. Is thee a timeAlign function that I can
use where :
align by year
direction -1 ==> start of this year
direction 1 ==> start of next year
align by week
direction -1 ==> date on last sunday
direction 1 ==> date on next sunday
align by day
direction -1 ==> time at past midnight
direction 1 ==> time at this comming
2005 May 13
2
without the loop
Can this be re-implemented to run faster (without the loop) ?
r <- list()
n = nrow(prices)
for (i in (w+1):n) {
window <- prices[(i-w):(i-1),]
if (prices[i,]$settle > max(window$high)) r <-
append(r, 1)
else if (prices[i,]$settle < min(window$low)) r <-
append(r, -1)
2005 Jun 24
2
seq in R
I want to generate a sequence from 1 to x by 1
seq(1,x,by=1)
I want the above to return an empty list if x is zero
In other languages I can do 1:x:1 to force the increment by to be a
positive 1. This syntax does not work in R. In R 1:x gives me
1 0
when x is zero, this is not what I want.
The seq statement above throws an error when x is 0.
How can I generate a sequence where if the
2006 May 26
2
Too many open files
This may be more of an OS question ...
I have this call
r = get.hist.quote(symbol, start= format(start, "%Y-%m-%d"), end=
format(end, "%Y-%m-%d"))
which does a url request
in a loop and my program runs out of file handlers after few hundred
rotations. The error message is: 'Too many open files'. Other than
increasing the file handlers assigned to my process, is there
2005 May 25
5
precision problem
I have prices that I am finding difficult to compare with ==, > and >,
due to precision. For example: the numbers should match, with '==',
but they differ in the magnitude of 1e-14 due to bunch of calculations
that I run on them. Programming with java, I am used to implementing a
function that compares the difference between the numbers to a pre
determined precision factor. This
2005 Feb 15
2
how many 7th of the month is there between two dates
This is a eaeir way to ask my prior question:
I want to caculate how many an exact day of the month there is between
two dates.
For example; How many 7th of the month is there between "1998/12/17"
and "2000/1/7". To make the problem simple, the day of the month (7)
is the day in the 2nd date.
2005 Apr 28
2
how to construct an empty data.frame
> r
[1] open settle
<0 rows> (or 0-length row.names)
> class(r)
[1] "data.frame"
this is an empty data.frame I get back from a sql statement that
returns an empty result set. How can I create such an empty data.frame
using the data.frame() constructor?
I want to have a data.frame with 0 rows but named empty columns.
Thanks in advance for any help.
2005 Oct 06
2
isdst
Can someone, please, explain the difference is results below (notice
the isdst value)
> unlist(as.POSIXlt('2005-7-1'))
sec min hour mday mon year wday yday isdst
0 0 0 1 6 105 5 181 1
> unlist(as.POSIXlt(as.Date('2005-7-1')))
sec min hour mday mon year wday yday isdst
0 0 0 1 6 105 5 181 0
2006 Apr 10
2
seq
Can someone, please, help explain to me why the following two calls
return the same set:
> seq(from=as.POSIXlt('2005-12-4'), to=as.POSIXlt('2006-4-2'), by='weeks')
[1] "2005-12-04 EST" "2005-12-11 EST" "2005-12-18 EST" "2005-12-25 EST"
[5] "2006-01-01 EST" "2006-01-08 EST" "2006-01-15 EST"
2005 May 13
1
where is aggregateSeries
What package is aggregateSeries in?
It is referred to in the fCalendar document but I do not see it in the package.
2005 Jul 07
1
q() ==> Segmentation fault
I created the simple library, attached. When I terminate an R session
where the library has been loaded with q() a segmentation fault is
thrown. Is there any cleaning that I should be doing?
>From R session:
> q()
Segmentation fault
or from shell:
$ R CMD BATCH r.in
/usr/lib/R/bin/BATCH: line 55: 17359 Done ( echo
"invisible(options(echo = TRUE))"; cat ${in};
2005 Aug 27
1
better than sapply
I have the following two mapping data frames (r) and (h). I want to
fill teh value of r$seid with the value of r$seid where r$cid==h$cid.
I can do it with sapply as such:
> r$seid = sapply(r$cid, function(cid) h[h$cid==cid,]$seid)
Is ther a better (faster) way to do this?
> r <- data.frame(seid=NA, cid= c(2181,2221,2222))
> r
seid cid
1 NA 2181
2 NA 2221
3 NA
2006 May 26
1
R.oo question
This is a simple R.oo question but I, thankfully, hope that someone
would explain it to me so I would better understand this work frame.
I create this class:
setConstructorS3("MyExample", function(param=0) {
print(paste("called with param=", param))
extend(Object(), "MyExample",
.param = param
);
})
>From what is printed out, who made the second call to
2006 Oct 31
3
zfs: zvols minor #''s changing and causing probs w/ volumes
Team,
**Please respond to me and my coworker listed in the Cc, since neither
one of us are on this alias**
QUICK PROBLEM DESCRIPTION:
Cu created a dataset which contains all the zvols for a particular
zone. The zone is then given access to all the zvols in the dataset
using a match statement in the zoneconfig (see long problem description
for details). After the initial boot of the zone
2005 May 04
1
help track a segmentation fault
I have an R script that I run using
nohup R CMD BATCH r.in r.out &
The code loops through data from the database and takes hours. The
problem is, in about an hour and a half after I start the script the
program stops and I get
/usr/lib/R/bin/BATCH: line 55: 14067 Done ( echo
"invisible(options(echo = TRUE))"; cat ${in}; echo "proc.time()" )
14068
2008 Sep 09
1
'xtfrm' performance (influences 'order' performance) in R devel
Hello everybody,
it looks like the presense of some (do know know which) S4 methods for a
given S4 class degrades the performance of xtfrm (used in 'order' in new
R-devel) by a factor of millions. This is for classes that ARE derived
from numeric directly and thus should be quite trivial to convert to
numeric.
Consider the following example:
setClass("TimeDateBase",
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 Nov 02
1
R timeDate does not allow seconds?
Hello, Sorry if anyone gets this message twice, as my mailserver may not
be working.
Thanks for your response. Your idea makes a lot of sense to me, but I've
been unable to get seconds to work.
I ended up with this format finally:
"2007-10-31_16:20:22"
Problem is I am unable to get it recognized as a date using timeDate():
R>