Displaying 20 results from an estimated 6000 matches similar to: "Vectors of years, months, and days to dates?"
2004 Jun 20
9
A way to list only variables or functions?
I am curious if there is any way to list only variables or functions in
current environment, rather than listing all objects? Thanks.
--
Daehyok Shin (Peter)
Geography Department
Univ. of North Carolina-Chapel Hill
2004 Jun 20
9
A way to list only variables or functions?
I am curious if there is any way to list only variables or functions in
current environment, rather than listing all objects? Thanks.
--
Daehyok Shin (Peter)
Geography Department
Univ. of North Carolina-Chapel Hill
2004 Jun 14
4
Quirks with system.time and simulations
I tried the code that Richard O'Keefe posted last week, to wit:
library(chron)
ymd.to.POSIXlt <-
function (y, m, d) as.POSIXlt(chron(julian(y=y, x=m, d=d)))
n <- 100000
y <- sample(1970:2004, n, replace=TRUE)
m <- sample(1:12, n, replace=TRUE)
d <- sample(1:28, n, replace=TRUE)
system.time(ymd.to.POSIXlt(y, m, d))
[1] 8.78 0.10
2004 Jul 10
6
where does R search when source()?
Exactly where does R search for foo.R if I type source("foo.R")?
Only from current working directory (same as getwd()), from all directories
specified by e.g. $PATH? Thanks.
Daehyok Shin
2004 Jul 10
6
where does R search when source()?
Exactly where does R search for foo.R if I type source("foo.R")?
Only from current working directory (same as getwd()), from all directories
specified by e.g. $PATH? Thanks.
Daehyok Shin
2004 Apr 12
4
Only referenc copy when calling C routine?
What happens when I pass an array to a dynamically linked C routine?
Is only its reference copied when an array is passed and returned?
Or, is its whole content copied?
In R extension manual, I found the following description.
But, I can't know exactly which is true.
"There can be up to 65 further arguments giving R objects to be passed to
compiled code.
Normally these are copied before
2004 Apr 07
3
More user-friendly error message needed.
When I tried the following commands, I got a strange message.
> x<-data.frame(y=c(1:10))
> plot(x$z)
Error in xy.coords(x, y, xlabel, ylabel, log) :
x and y lengths differ
"The data frame, x, does not have a field named z."
may be better user-friendly message for this kind of common error.
Daehyok Shin
2004 Apr 07
3
More user-friendly error message needed.
When I tried the following commands, I got a strange message.
> x<-data.frame(y=c(1:10))
> plot(x$z)
Error in xy.coords(x, y, xlabel, ylabel, log) :
x and y lengths differ
"The data frame, x, does not have a field named z."
may be better user-friendly message for this kind of common error.
Daehyok Shin
2004 Apr 20
1
Can't find memory.size()
I try memory.size function to find out available memory size,
but surprisingly R complains it can't find the function.
?memory.size also failed.
Is it not in the base library? If so, why can't my R find it?
I am using the binary 1.9.0 version for Mandrake 9.1.
Thanks in advance.
Daehyok Shin
Terrestrial Hydrological Ecosystem Modellers
Geography Department
University of North
2012 Jun 08
3
day of the year for chron objects
Hi!
Is not there an standard R function to retrieve the day of the year
(since 1st Jan of the same year)?
I know I can make my own using julian, but find it weird that having
days(), months() etc doy() does not exist as an standard function.
Also, is the following not a bit inconsistent?
> a <- chron("20100506",format="ymd")
> a
[1] 100506
> years(a)
[1] 2010
2004 Feb 23
6
Need help on parsing dates
I know this:
> library(date)
> x="1979-04-04"
> try=as.date(x, "ymd")
> print(try)
[1] 4Apr79
and that `x' here has to be a string, e.g.:
> x=1979-04-04
> print(x)
[1] 1971
I'm stuck in reading from a file. I say:
> A <- read.table(file="try")
> print(A)
V1 V2
1 1979-04-04
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
2003 Dec 04
5
Processing calendar dates with R
I am a beginner in R with a background in SAS.
Are there built-in R methods of reading dates for calculating elapsed days
between two calendar dates? If so, are there any examples I can browse?
Thanks in anticipation.
John Byrne.
Lecturer in Information Systems.
Australian Catholic University.
2004 Apr 06
2
A package to read and write NetCDF?
I am looking for a package to read and write NetCDF files.
NetCDF package says it can only read, not write.
Another package for the standard binary file format?
Daehyok Shin
2004 Apr 05
1
Deep copy in R
I am handling spatial data of huge volumes,
so sensitive to the silent duplication of data in script programs.
In the following R program, exactly when is the vector data deeply copied?
Thanks in advance.
1 v <- 1:10000
2 z <- f(v)
--------- function f ----------
3 f <- function(x) {
4 y = x
5 y[10] = 1
6 xf = date.frame(x=x)
7 xf$x[10] = 1
8
2009 Jul 20
1
Problem with as.POSIXct on dates object
Dear R-helpers,
I have a problem converting an object made with the 'chron' function
to a POSIXct object:
# Make date based on DOY
dat <- chron(dates=232, origin.=c(month=1, day=1, year=2008))
dat
#[1] 08/20/08
# Converting to POSIXct uses current timezone (Sydney):
as.POSIXct(dat)
#[1] "2008-08-20 10:00:00 EST"
# Setting GMT timezone has no effect?
as.POSIXct(dat,
2003 Jul 31
4
timezones
I have some questions and comments on timezones.
Problem 1.
# get current time in current time zone
> (now <- Sys.time())
[1] "2003-07-29 18:23:58 Eastern Daylight Time"
# convert this to GMT
> (now.gmt <- as.POSIXlt(now,tz="GMT"))
[1] "2003-07-29 22:23:58 GMT"
# take difference
> now-now.gmt
Time difference of -5 hours
Note that the difference
2011 Mar 24
5
subset and as.POSIXct / as.POSIXlt oddness
Dear R users,
Given this data:
x <- seq(1,100,1)
dx <- as.POSIXct(x*900, origin="2007-06-01 00:00:00")
dfx <- data.frame(dx)
Now to play around for example:
subset(dfx, dx > as.POSIXct("2007-06-01 16:00:00"))
Ok. Now for some reason I want to extract the datapoints between hours
10:00:00 and 14:00:00, so I thought well:
subset(dfx, dx >
2004 Mar 08
5
years from as.POSIXlt
Hi,
how it's possible to extract the year and the number
of days from Julian date. i'm little confused about the last two
functions and ?years .
EDATE comes from sqlQuery with as.is=T
EDATE <- as.POSIXlt(datvears$ENROLLDAY)
Many thanks, Christian
> EDATE[1:5]
[1] "2000-06-30 11:25:01" "2000-06-30 11:39:55" "2000-06-30 12:11:11"
[4]
2004 Jul 22
2
Files and classes in a package?
While installing my small package, I met a tricky problem.
For clarity, let me explain it with the following simplified example.
In ~/pkg/R/aclass.R,
setClass("aclass", contains="bclass", representation(i="numeric"))
In ~/pkg/R/bclass.R,
setClass("bclass", representation(j="numeric"))
After building a "pkg" package, the file