Displaying 20 results from an estimated 1000 matches similar to: "Problems with weekday extraction from zoo objects"
2010 May 20
2
Time problems (POSIXct)
Hello,
I have a zoo time series object (say a) with the following time
stamp/format
[1] "1950-01-03 GMT" "1950-01-04 GMT" "1950-01-05 GMT" "1950-01-06 GMT"
[5] "1950-01-09 GMT" "1950-01-10 GMT"
and another (say b) with
[1] "1950-01-05" "1950-01-06" "1950-01-09" "1950-01-10"
2008 Jan 24
1
Error using Rmetrics to read data
Hi folks. This set of code used to work, but after upgrading to the
latest version of Rmetrics it no longer does. Any ideas?
SP500<-read.table("SP500.csv",header=TRUE,sep=",")
> head(SP500)
Date Open High Low Close Volume Close2
1 8/4/2006 1280.26 1292.92 1273.82 1279.40 2530970112 1279.40
2 8/3/2006 1278.22 1283.96 1271.25 1280.27
2007 Nov 09
1
Problem reading data in Rmetrics
Hi folks - After upgrading to the latest version of Rmetrics, I can't
read in data like I used to. Is anyone seeing the following? It seems
to truncate the dates after I use "as.timeSeries".
-John
SP500<-read.table("SP500.csv",header=TRUE,sep=",")
> head(SP500)
Date Open High Low Close Volume
1 08/04/06 1280.26 1292.92
2007 Dec 13
1
counting weekday in a month in R
Hi,
I am trying to count weekday of the month using R. For example, 1/4/2001
is the 4th weekday of Jan, and 1/5/2001 is the 5th weekday of the month, and
1/8/2001 is the 6th weekday of the month, etc. I get as far as extracting
the weekdays from a sequence of dates (see below). But I have not yet
figured out a fast way of counting without using a For Loop. Does anyone
know how to do such counting
2011 Jul 22
1
Summing values by weekday and weekend - based on daily dates
Hi, all
Here I created a data frame like
mydates<- seq(as.Date("2010-05-29"), length = 43, by = "day")
myvalues<-runif(43,0,1)
myframe<-data.frame(dates=mydates, day=weekdays(dates), value=myvalues)
dates day value
1 2010-05-29 Saturday 0.14576143
2 2010-05-30 Sunday 0.37669604
3 2010-05-31 Monday 0.74813943
4 2010-06-01 Tuesday
2011 Jul 22
1
Summing daily values by weekday and weekend
(Sorry for reposting. Please delete previous msgs. Thanks!)
Hi, all
Here I created a data frame like
mydates<- seq(as.Date("2010-05-29"), length = 43, by = "day")
myvalues<-runif(43,0,1)
myframe<-data.frame(dates=mydates, day=weekdays(dates), value=myvalues)
dates day value
1 2010-05-29 Saturday 0.14576143
2 2010-05-30 Sunday 0.37669604
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]
2008 Sep 22
1
Help for SUR model
I am an R beginner and trying to run a SUR model in R framework.
subset(esasp500, Obs <=449 & Obs>=197, select = -Date) ->ev13sub
c(Obs>=397) & c(Obs<=399) ->d13
c(Obs>=400) & c(Obs<=449) ->f13
SP500*f13 ->SP500f13
BBC~SP500+d13+SP500f13 ->sur132
BOW~SP500+d13+SP500f13 ->sur133
CSK~SP500+d13+SP500f13 ->sur134
2010 Oct 04
2
Generating weekdays only
Dear all, can anyone please tell me how to generate a sequence of days continuously, however without considering weekends i.e. Saturday and Sunday? I am aware of following code:
> seq(as.Date("2010-01-01"), as.Date("2010-02-01"), by="1 day")
[1] "2010-01-01" "2010-01-02" "2010-01-03" "2010-01-04" "2010-01-05"
2013 Aug 26
2
Partial correlation test
Dear all,
I'm writing my manuscript to publish after analysis my final data with
ANOVA, ANCOVA, MANCOVA. In a section of my result, I did correlation of my
data (2 categirical factors with 2 levels: Quantity & Quality; 2 dependent
var: Irid.area & Casa.PC1, and 1 co-var: SL). But as some traits (here
Irid.area) are significantly influenced by the covariate (standard length,
SL), I
2002 Feb 22
1
Weekdays
Hello,
I'm trying to write a function that returns the number of weekdays between a
vector of start dates and a vector of end dates.
Subtracting the 2 times the number of whole weeks is the easy part and works
if the number of days is a multiple of 7.
However, the number of weekend days in the tail is a little harder. It
depends on both the start date of the tail and the number of days in
2008 Sep 11
5
How to obtain a sequence of dates consisting of only weekdays
Dear R-users,
How do I obtain a sequence of dates consisting of only weekdays without the weekends in R?
In S, I can do the following:
timeSeq(from="12/17/2007", to="8/25/2008", by="weekdays")
I tried using looking at timeSequence (fSeries package) and seq.Date (base package) but I do not know if I can specify "weekdays" rather than "day".
2012 May 11
1
summary for weekdays()
Hi all,
probably really simple: I seem to be lacking some understanding for the
character class: I have a bunch of dates in a dataframe and I want to add a
string variable with the weekday for each date. If I use something like
mydata$day <- weekdays (mydata$date), I can create subsets for each weekday
(eg mydata=="Monday"), but summary (mydata$day) doesn't count the instances
for
2010 Jul 15
2
How to plot a histogram of weekday frequencies in a list of dates?
Question from an [R] novice...
Hi,
I have a vector of date/times like the one shown below (a truncated
sample of a much longer list...)
> dates[1:4]
[1] "2006-03-16 08:41:00" "2006-03-16 10:28:00" "2006-03-16 11:03:00"
[4] "2006-03-16 11:04:00"
I would like to generate a weekday histogram showing the frequency of
dates falling on each weekday. I know
2006 Jun 21
5
colClasses
Hi Folks!
I'm reading in some data from a .csv file that has a date column.
How do I use colClasses to get read.csv to recognize the date column?
The documentation on this seems to be nil -
And yes, I've read help and R Data Import/Export and can't figure out
what the colClasses syntax is.
Thanks,
john
[[alternative HTML version deleted]]
2017 Jun 05
2
months not working with local language (weekdays does)
Hi,
I want to reporte some strange behaviour with the "months" function, from
base R.
When using "months" to extract months from a date column, I'm getting the
months in english, when I was expecting months in spanish.
When using "weekdays" to extract days of week from a date column, I'm
getting the the days in spanish (as expected).
My understanding is
2006 May 15
3
Dyn or Dynlm and out of sample forecasts
All:
How do I obtain one step ahead out-of-sample forecasts from a model
using "dyn" or "dynlm" ?
Thanks!
Best,
John
[[alternative HTML version deleted]]
2017 Jun 05
2
months not working with local language (weekdays does)
For what it's worth, I tried setting my Region | Formats setting to
Spanish (Peru) in Windows 10 Control Panel, and got Spanish weekday and
month results.
I believe on Windows we use the Microsoft C strftime function to produce
these strings, with the %A (for weekday) or %B (for month) formats. So
this question probably needs to be addressed to Microsoft.
Duncan Murdoch
On 05/06/2017
2017 Jun 05
0
months not working with local language (weekdays does)
Hello,
This doesn't answer the question, but in portuguese it works as expected.
> x <- as.Date("2017-06-05")
> months(x)
[1] "junho"
> weekdays(x)
[1] "segunda-feira"
> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
2011 Feb 19
4
Accessing DF index
I have a dataframe called x2. It seems to have a date column but I can't
access it or give it a name or convert it to a date. How do I refer to that
first column and make it a date ? When I try x2[1,] I get the second column.
head(x2)
FAIRX SP500 delta
2000-08-31 0.010101096 0.007426964 0.002674132
2000-09-29 0.096679730 -0.054966292 0.151646023
2000-10-31