Displaying 20 results from an estimated 20000 matches similar to: "is.weekend() odd behaviour"
2004 May 26
1
FW: is.weekend() odd behaviour
Kurt,
Uwe suggested I write to you as maintainer of chron ... at the start of
is.weekend, in the check on the argument type, maybe just change chron() to
as.chron()? This would ensure as.chron.POSIXt gets called on POSIXt
arguments, and (I think) fixes the problem. I tested and it seems ok. No
warning/error required.
> is.weekend
function(x)
{
if(!inherits(x, "dates"))
2003 Nov 12
3
Chron, as.POSIXct problem
Dear R list,
I noticed the following 'problem' when changing the format of dates
created with seq.dates() (from the Chron library) using as.POSIXct()
(R 1.8.0 on OSX 10.2.8):
> datesTest<-seq.dates(from="10/01/1952", length=3, by="days");
> datesTest
[1] 10/01/52 10/02/52 10/03/52
# Now changing the format to show year as 1952.
>
2006 Mar 02
5
Deparsing '...'
Hi,
The following function works, but is there a neater way to write it?
f = function(x,...)
{
# return a character vector of the arguments passed in after 'x'
gsub("
","",unlist(strsplit(deparse(substitute(list(...))),"[(,)]")))[-1]
}
> f(x,a,b,c*d)
[1] "a" "b" "c*d"
>
Thanks.
[[alternative HTML
2005 Dec 09
3
[R] data.frame() size
Hi,
Please see below for post on r-help regarding data.frame() and the
possibility of dropping rownames, for space and time reasons.
I've made some changes, attached, and it seems to be working well. I see the
expected space (90% saved) and time (10 times faster) savings. There are no
doubt some bugs, and needs more work and testing, but I thought I would post
first at this stage.
Could some
2004 Aug 17
3
Fwd: strptime() problem?
Hi all;
I've already send a similar e-mail to the list and Prof. Brian Ripley
answered me but my doubts remain unresolved. Thanks for the clarification,
but perhaps I wasn't clear enough in posting my questions.
I've got a postgres database which I read into R. The first column is
Timestamp with timezone, and my data are already in UTC format. An 'printed'
extract of R
2004 Nov 26
2
Tcl error - brace in argument?
Hi all,
Does anyone know a solution for this error ?
> tkwidget(dlg, "iwidgets::spinint", range="{0 23}")
Error in structure(.External("dotTclObjv", objv, PACKAGE = "tcltk"), class =
"tclObj") :
[tcl] wrong # args: should be ".31.1.19 configure -range {begin
end}".
Thanks,
Matthew
[[alternative HTML version
2005 Dec 08
2
data.frame() size
Hi,
In the example below why is d 10 times bigger than m, according to
object.size ? It also takes around 10 times as long to create, which fits
with object.size() being truthful. gcinfo(TRUE) also indicates a great deal
more garbage collector activity caused by data.frame() than matrix().
$ R --vanilla
....
> nr = 1000000
> system.time(m<<-matrix(integer(1), nrow=nr, ncol=2))
[1]
2006 May 23
4
Avoiding a memory copy by [[
Hi,
n = 10000000
L = list(a=integer(n), b=integer(n))
L[[2]][1:10] gives me the first 10 items of the 2nd vector in the list L.
It works fine. However it appears to copy the entire L[[2]] vector in
memory first, before subsetting it. It seems reasonable that "[[" can't
know that all that is to be done is to do [1:10] on the result and therefore
a copy in memory of the entire
2001 Sep 07
1
chron is.weekend() function
Hello,
I have a dataset which has fields giving both calendar date and weekday. I
know better functions are now available, but I am still using chron because
of the is.holiday() function and a homemade (even Heath Robinson would be
ashamed) is.daylight() function.
As a check for typos in the data input, I checked that the dates matched the
weekdays. I'm getting some confusing results
2006 Aug 10
2
day, month, year functions
Hi list,
I'm trying to turn a date into something productive. (Not what you may be thinking....)
I want three functions so I could take a "date" object and get the day of week, month, and year from it.
xx <- as.Date("2006-01-05")
month(xx) equal 1
day(xx) equal 5
year(xx) equal 2006
I'm aware of the weekdays() and months() functions in the base package. But
2018 May 16
2
Date method of as.POSIXct does not respect tz
R 3.5.0
Is it intended that the Date method of as.POSIXct does not respect the
tz parameter? I suggest changing as.POSIXct.Date to this:
function (x, tz = "", ...)
.POSIXct(unclass(x) * 86400, tz = tz)
Currently, the best workaround seems to be using the character method if
one doesn't want the default timezone (which is often an annoying DST
timezone).
This came up on
2006 May 02
4
"a"+"b"
Hi,
Is there a way to define "+" so that "a"+"b" returns "ab" ?
> setMethod("+",c("character","character"),paste)
Error in setMethod("+", c("character", "character"), paste) :
the method for function '+' and signature e1="character",
e2="character" is sealed
2003 Dec 15
3
Julian Dates
Hi,
I'm a bit confused how julian() works. If I understand right, it returns
the number of days since the origin.
I have a vector:
> SLDATX[1:10]
[1] "1986-01-06" "1986-01-17" "1986-02-02" "1986-02-04"
[5] "1986-02-04" "1986-02-21" "1986-03-06" "1986-03-25"
[9] "1986-04-06"
2006 Mar 31
3
Function dependency function
Hi,
Is there a function taking a function as an argument, which returns all the
functions it calls, and all the the functions those functions call, and so
on? I could use Rprof, but that would involve executing the function,
which may miss some branches of code. I'd really like a function which
looks at the source code to work out all the functions that could possibly
be called. When I
2004 Jun 07
7
Vectors of years, months, and days to dates?
The interface for dates in R is a little confusing to me.
I want to create a vector of Date objects from vectors of years, months, and
days.
One solution I found is:
years <- c(1991, 1992)
months <- c(1, 10)
days <- c(1, 2)
dates <- as.Date(ISOdate(years, months, days))
But, in this solution the ISOdate function converts the vectors into
characters,
which can cause serious
2003 Sep 17
3
Using POSIX?t rather than "chron" or "date"
The problem with POSIXt is that you must consider timezones
and daylight vs. standard time issues even if you don't want
to. This violates modularity (viz. your routines becomes coupled
to unrelated information) and leads to subtle errors where different
routines are assuming different time zones.
The problem is that the time, date, day of the week, month, etc.
of a date depend on its
2001 Jan 02
1
chron blues
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1599 bytes
Desc: not available
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20010102/cf0e43dd/attachment.bin
2009 Oct 15
2
forwarded: bug (?) in cut.POSIXt with "breaks"=integer
From: Vitalie S. <vitosmail <at> rambler.ru>
Subject: Bug in cut.POSIXt
Newsgroups: gmane.comp.lang.r.general
Date: 2009-10-15 15:47:48 GMT (1 hour and 29 minutes ago)
Hello Everyone,
Before reporting decided to post here first:
tt <- structure(c(1254238817, 1254238859, 1254238969, 1254239080), class =
c("POSIXt",
2005 Aug 02
1
cut.Date functionality for chron date/time objects
Hello,
I've encountered the need to cut some chron objects of the form:
R> mychron <- chron(sort(runif(10, 0, 10)))
R> mychron
[1] (01/01/70 16:36:20) (01/02/70 00:08:46) (01/03/70 16:54:49)
[4] (01/04/70 06:45:00) (01/07/70 06:21:24) (01/07/70 18:28:44)
[7] (01/08/70 00:47:05) (01/08/70 05:11:44) (01/10/70 01:07:53)
[10] (01/10/70 17:46:53)
into arbitrary (e.g. a given number
2006 Nov 14
4
c.factor
Hi,
Given factors x and y, c(x,y) does not seem to return a useful result :
> x
[1] a b c d e
Levels: a b c d e
> y
[1] d e f g h
Levels: d e f g h
> c(x,y)
[1] 1 2 3 4 5 1 2 3 4 5
>
Is there a case for a new method c.factor as follows? Does something
similar exist already? Is there a better way to write the function?
> c.factor = function(x,y)
{
newlevels =