Displaying 20 results from an estimated 40000 matches similar to: "seq"
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
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 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
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 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
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)
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 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?
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
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 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 17
1
as.POSIXct before and after 1970
Can someone, please, explain the difference in as.POSIXct results
before 1970 and on and after 1970 as illustrated below.
After 1970, the use of 'EST' or "EST+5EDT' as the timezone does not
affect the result of asPOSIXct, but before 1970 on 10/28 the results
are different.
> as.POSIXct('1970-10-29', tz='EST')+1
[1] "1970-10-29 00:00:01 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 May 18
1
align
Is there a function in R that is similar to Splus's align?
The idea is, if I have a data.frame, or an its object that is like this:
2002-01-03 5
2002-01-04 NA
2002-01-05 7
2002-01-06 NA
I want to align it by the last value to this:
2002-01-03 5
2002-01-04 5
2002-01-05 7
2002-01-06 7
TITLE:
Function align
USAGE:
align(x, pos, how, error.how, localzone,
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
2020 Oct 01
3
timezone tests and R-devel
The return value of Sys.time() today with a timezone of US/Eastern is
unchanged between 4.0.3-patched and devel, but on devel the following test
fails
all.equal(x, as.POSIXlt(x))
with
x = Sys.time()
This means that devel does not complete make tests (failure on
tests/reg-tests-2.R)
It is entirely possible that it is an error on my end, I use
export TZ="US/Eastern"
but I have been
2020 Oct 02
2
timezone tests and R-devel
Yes, the potential issue I see is that
make check
fails when I explicitly set TZ. However, I set it to be the same as what
the system reports when I login.
Details: The system (RHEL) I am working on has
$ strings /etc/localtime | tail -n 1
EST5EDT,M3.2.0,M11.1.0
$ date +%Z
EDT
$ echo $TZ
US/Eastern
On Fri, Oct 2, 2020 at 9:48 AM Sebastian Meyer <seb.meyer at fau.de> wrote:
> Thank
2016 Dec 06
6
segfault with POSIXlt zone=NULL zone=""
Hi all,
I ran into a segfault while playing with dates.
$ R --no-init-file
...
> library(lubridate); d=as.POSIXlt(floor_date(Sys.time(),"year")); d$zone=NULL; d$zone=""; d
Attaching package: ?lubridate?
The following object is masked from ?package:base?:
date
Warning message:
package ?lubridate? was built under R version 3.4.0
2005 Aug 11
3
signal handling
Is ther a signal handling model in R? similar to Perl's %SIG hash.
I want to do fast clean up in my R code before exit when a kill signal
is issued.