Displaying 14 results from an estimated 14 matches for "xdate".
Did you mean:
date
2012 Aug 28
3
date in plot, can't add regression line
...40 2 2009-02-12 6
The plot displays the x column as the yaxis and the date as the x axis, grouped by the tradetype column.
The timestamp column:
> class(tradeflavorbyday$timestamp)
[1] "POSIXlt" "POSIXt"
So in this case I want to plot tradetype 1 (method 1):
xdates <- tradeflavorbyday$timestamp[tradeflavorbyday$tradeflavor == 1]
ydata <- tradeflavorbyday$x[tradeflavorbyday$tradeflavor == 1]
plot(xdates, ydata, col="black", xlab="Dates", ylab="Count")
Up to here it works great.
Now a abline through lm:
xylm <- lm(yda...
2009 Mar 25
1
Creating date seq in data frame
Hi,
I have the following type of data:
myData <- data.frame(x = 1:5, y = letters[1:5], xDate =
seq(as.Date("2001/2/1"), as.Date("2005/2/1"), by="year") )
> myData
x y xDate
1 a 2001-02-01
2 b 2002-02-01
3 c 2003-02-01
4 d 2004-02-01
5 e 2005-02-01
What I need is a new column, say xDate2, that for each xDate (or for each
unique combination...
2019 Mar 06
1
as.Date(Inf) displays as 'NA' but is actually 'Inf'
...more principled code to show the
phenomenon, including the fact noticed by Bill that both
as.Date() and format.Date() should probably be tweaked such as
to signal warnings (e.g. on integer overflow for too large numbers).
## -------------------------------------------------------------------------
xDates <- lapply(c(-Inf, Inf, NA, NaN,
1e9, 4e9, 1e100, .Machine$double.xmax),
as.Date, origin = "2000-01-01")
str(xDates) # --> first 4 *all* show as NA
sapply(xDates, is.na) # the two +-Inf are not NA
(f.D <- sapply(xDates, format))# 1..4: NA, the...
2010 Jul 29
2
multiple graphics windows open
...h in turns generates a subset plot and an EWMA subset
plot. Finally, if things worked right, the user should be able to
click on "Tile Vertically" and see all 3 windows. Also, there should
be a line segment on the original plot connecting the two selected
points.
> library(zoo)
> xdate <- seq(as.Date("1998-01-01"),as.Date("2010-06-30"),by="day")
> length(xdate)
[1] 4564
> xt <- zoo(rnorm(4564),order=xdate)
> eplot
function (x)
{
x11()
plot(x)
z <- locator(2)
x11()
plot(window(x, start = min(z$x), end = max(z$x)))...
2007 Jun 13
5
Confusion with sapply
Hi,
I have some confusion in applying a function over a column.
Here's my function. I just need to shift non-March month-ends to March
month-ends. Initially I tried seq.dates, but one cannot give a negative
increment (decrement) here.
return(as.Date(seq.dates(format(xdate,"%m/%d/%Y"),by="months",len=4)[4])
)
Hence this simple function:
> mydate <- as.Date("2006-01-01")
>
> # Function to shift non-March company-reporting dates to March.
> Set2March <- function(xdate){
+ # Combines non-March months into March months:...
2010 Aug 01
1
aggregating a daily zoo object to a weekly zoo object
Dear R People:
I'm trying to convert a daily zoo object to a weekly zoo object:
xdate <- seq(as.Date("2002-01-01"),as.Date("2010-07-10"),by="day")
library(zoo)
length(xdate)
xt <- zoo(rnorm(3113),order=xdate)
xdat2 <- seq(index(xt)[1],index(xt)[3113],by="week")
xt.w <- aggregate(xt,by=xdat2,mean)
Error: length(time(x)) == length...
2010 Jul 29
1
multiple graphics windows open with sessionInfo
....
The last step is to produce an EWMA chart from the subset series.
Fair enough. I've tried all sort of things, but can only have 2
graphics windows open with "stuff" in them. If I go into the blank
window and maximize it, then it appears. But other than that, it does
not.
> xdate <- seq(as.Date("1998-01-01"),as.Date("2010-06-30"),by="day")
> length(xdate)
[1] 4564
> xt <- zoo(rnorm(4564),order=xdate)
> #Here is the function itself:
> eplot
function (x)
{
require(zoo)
require(qcc)
windows()
plot(x)
z <- l...
2019 Mar 06
2
as.Date(Inf) displays as 'NA' but is actually 'Inf'
Hi Gabriel,
The point is that it *visually* displays as NA, but is.na() still
responds as FALSE.
When I (and I am sure many people) see an NA, we then use is.na(). If we
see Inf displayed, we then use is.infinite(). With as.Date() this breaks
down.
I'm not arguing that as.Date(Inf) should be coerced to NA. I'm arguing
that as.Date(Inf) should be *visually* displayed as Inf (i.e. the
2002 Apr 11
6
extract week from date
Hello R-users,
Does anyone know how obtain the week of a date?
(in SPPS the instruction is "xdate.week")
Thanks,
Juan Ramon
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subje...
2015 Nov 06
0
Puzzled by eval
...te1 <= date2, etc
> # It returns the tidied up id, date1, date2 vectors.
> list(ldata=ldata, mf=mf)
> }
>
> test:
> library(puzzle)
> tdata <- data.frame(id=1:10,
> start=as.Date(paste0("1999/", 1:10, "/25")))
> xdate <- as.Date(paste0(2001:2010, "/03/10"))
>
> joe(id, tdata, date1= "2001/10/11", date2= xdate[2])
> joe(id, tdata, date1=start, date2=xdate)
>
> sqrt <- xdate
> cos <- tdata
>
> joe(id, cos, date1=start, date2=sqrt)
>
> DESCRIPTION:
> Tit...
2015 Nov 06
4
Puzzled by eval
...the real routine has checks for legal dates, date1 <= date2, etc
# It returns the tidied up id, date1, date2 vectors.
list(ldata=ldata, mf=mf)
}
test:
library(puzzle)
tdata <- data.frame(id=1:10,
start=as.Date(paste0("1999/", 1:10, "/25")))
xdate <- as.Date(paste0(2001:2010, "/03/10"))
joe(id, tdata, date1= "2001/10/11", date2= xdate[2])
joe(id, tdata, date1=start, date2=xdate)
sqrt <- xdate
cos <- tdata
joe(id, cos, date1=start, date2=sqrt)
DESCRIPTION:
Title: A puzzle
Priority: optional
Package: puzzle
Ver...
2014 Jul 04
1
DESCRIPTION.in file causes R CMD check to fail?
...default permissions.
#
# This archive contains:
#
# DESCRIPTION
# DESCRIPTION.in
#
echo x - DESCRIPTION
sed 's/^X//' >DESCRIPTION << 'END-of-DESCRIPTION'
XPackage: image2k
XType: Package
XTitle: interface between pixmap and Imlib2 and/or MagickWand
XVersion: 0.1
XDate: 2014-06-24
XAuthor: Greg Minshall
XMaintainer: Greg Minshall <minshall at acm.org>
XDescription: image2k creates pixmaps from any image file that is
X supported by the Imlib2 and/or MagickWand libraries (assuming one or
X both of these libraries are available on your machine). similarly,...
2006 Jan 31
1
retrieving attributes of searchresults
...###########################
my $doc = Search::Xapian::Document->new();
$doc->set_data($data->{article_id});
_add_attr($doc, { # pass fields with multifield values as arrayref
'XAID' => $data->{article_id},
'XTITLE' => $title, # arrayref
'XDATE' => $data->{publicationdate},
'XTYPE' => $data->{articletype},
'XTID' => $tid, # arrayref
'XTXC' => $txc, # arrayref
});
my @words = _get_text($data,$title);
for my $i (0 .. $#words) {
my $w = $words[$i]; $w =~ s/[\.-]...
2014 Nov 14
1
file.copy
...id.data.frame.R"
[5] "create_xd2012.R" "file.copy.R"
[7] "further.data.R" "mrj.in.scope_111214.R"
[9] "oid.in.scope_111114.R" "oid_cohort.R"
[11] "warning.max.R" "xdate.R"
[13] "years.before.anl.init.R" "years.before.mrj.init.R"
[15] "years.before.oid.init.R"
> options(warn=1)
>
> # copy the files to the toFolder - THIS DOES NOT WORK WHILE EVERYTHING PRIOR HAS WORKED
> file.copy(list.of.files, toFold...