Displaying 20 results from an estimated 2000 matches similar to: "Day or Month difference between dates???"
2013 Mar 15
3
How to list the all products' information of the latest month?
Hi,
I have data frame like this:
Product Price Year_Month PE
A 100 201012 -2
A 98 201101 -3
A 97 201102 -2.5
B 110 201101 -1
B 100 201102 -2
B 90 201103 -4
How can I achieve the following result
2012 Nov 09
2
Creating yyyymm regexp strings on the fly for aggregation.
Folks,
This question is somewhat related to a previous posting of mine.
I just can't seem to create a generic solution.
Here is a function that I found searching around the internet:
splitIt <- function(x, n) {split(x, sort(rank(x) %% n))}
I use it like so:
> splitIt(1:12, 2)
$`0`
[1] 1 2 3 4 5 6
$`1`
[1] 7 8 9 10 11 12
Or
> splitIt(1:12, 4)
$`0`
[1] 1 2 3
$`1`
[1] 4 5 6
2013 Jan 24
3
how to combine unequal rows and columns in R
HI,
I have the following list:
crosspries
$crosspries[[1]]
Product Year_Month prod1
A 201208 1
B 201208 2
C 201208 1
$crosspries[[2]]
Product Year_Month prod1 prod2
A 201209 1 1
B 201209 2
2013 Mar 14
3
how to change "`Year_Month)201103`" into "Year_Month)201103" using R?
HI,
I have the pattern like "`Year_Month)201103`" I want to delete single quotes within double quetes.
I want to change it into "Year_Month)201103" , how to do it in r?
Thanks a lot.
Tammy
[[alternative HTML version deleted]]
2012 Jul 03
0
missing price datas before launched
HI,
I have the price and volume data from own product and competitor's product:
Year_Month Volume own product's price Volume competitor's price
1 201011 17583 469.03 NA NA
2 201012 33899 489.25 NA NA
3 201101 31306
2010 Apr 12
1
N'th of month working day problem
Dear Gabor,
Thanks for your reply. however:
> tail(DJd)
^DJI.Close
2010-04-01 10927.07
2010-04-05 10973.55
2010-04-06 10969.99
2010-04-07 10897.52
2010-04-08 10927.07
*2010-04-09 10997.35*
> tail(ag)
2009-11-30 10344.84
2009-12-31 10428.05
2010-01-31 10067.33
2010-02-28 10325.26
2010-03-31 10856.63
*2010-04-30 10997.35
*
It seems the script "makes up"
2010 Nov 08
2
finding the last day of the month
Dear R Help,
I am trying to get fields showing the last day of each month for a monthly
closing project. In order to find the last day of the previous month, I
subtract the number of days from the current month. For all months my code
works; however, for October, my code doesn't work...it returns
2010-09-*29* instead
of 2010-09-*30*.
format(strptime("2010-10-31",
2007 Sep 27
1
converting numbers in "YYYYMM" format to last calendar day and last exchange trading day of the month
I have a vector that contains month and year in the format YYYYMM (e.g.“200701”, “200702”)
I wish to do to things:
1. I need to convert to a date that is the last calendar day of each month.
2. I need to convert this to a date that is the last U.S. stock-exchange trading day of each month.
Any advice is appreciated,
mymonths <- c(200701, 200702)
2010 Jul 12
3
How to create sequence in month
Hi all, can anyone please guide me how to create a sequence of months? Here
I have tried following however couldn't get success
> library(zoo)
> seq(as.yearmon("2010-01-01"), as.yearmon("2010-03-01"), by="1 month")
Error in del/by : non-numeric argument to binary operator
What is the correct way to do that?
Thanks for your time.
2009 Sep 13
3
How to get last day of a month?
Is there any R function to calculate automatically the last day of a
particular month? For example "sep2009" should be converted to last day of
September of 2009?
Thanks
--
View this message in context: http://www.nabble.com/How-to-get-last-day-of-a-month--tp25425645p25425645.html
Sent from the R help mailing list archive at Nabble.com.
2011 May 19
1
Creating a "shifted" month (one that starts not on the first of each month but on another date)
Hello!
I have a data frame with dates. I need to create a new "month" that
starts on the 20th of each month - because I'll need to aggregate my
data later by that "shifted" month.
I wrote the code below and it works. However, I was wondering if there
is some ready-made function in some package - that makes it
easier/more elegant?
Thanks a lot!
# Example data:
2011 Jul 22
2
Picking returns from particular days of the month from a zoo object
Hello,
I would like to implement a "turn-of-the-month' trading strategy in R.
Given a daily series of stock market return data as a zoo object, the strategy
would go long (buy) four trading days before the end of the month, and sell the
third trading day of the following month.
How can I select these days, particularly the fourth day before and the third
day after the turn of the
2007 May 10
3
Getting the last day of the month.
Hi,
Given a date, how do I get the last date of that month? I have
data in the form YYYYMM, that I've read as a date using
> x$Date <-
as.Date(ISOdate(substr(x$YearEnd,1,4),substr(x$YearEnd,5,6),1))
But this gives the first day of the month. To get the last day of the
month, I tried
> as.Date(as.yearmon(x$Date,frac=0))
But I don't get the last day of the month here. (Tried
2010 Dec 01
1
Changing the day of the month in a date
Hello, I want to change the day of the month in a date object. What I am
doing at the moment is:
x=as.POSIXlt(x)
x$mday=13
x=as.Date(x)
Does anybody know if there is a more "natural" (eficient) way to do this
Thank you
Felipe Parra
[[alternative HTML version deleted]]
2005 Dec 19
3
given a mid-month date, get the month-end date
I have a vector of dates.
I wish to find the month end date for each.
Any suggestions?
e.g.
For 12/15/05, I want 12/31/05,
For 10/15/1995, I want 10/31/1995, etc
__________________________________________________
[[alternative HTML version deleted]]
2011 Feb 16
1
Timeseries Data Plotted as Monthly Boxplots
Hello, I'm trying to develop a box plot of time series data to look at the
range in the data values over the entire period of record.
My data initially starts out as a list of hourly data, and then I've been
using this code to make this data into the final ts array.
# Read in the station list
stn.list <- read.csv("/home/kbennett/fews/stnlist3", as.is=T, header=F)
# Read in
2010 Jun 17
1
Help with interpolation of time series
I'm quite new to R. I have a time series of annual state population
estimates from census.gov, and I'd like to get a time series of monthly
estimates, by a nonlinear interpolation.
How can I do this in R?
Thanks!
[[alternative HTML version deleted]]
2009 Sep 22
3
how to convert character string with only month and year into date
Dear R helpers.
I am new to plotting time data using R.
wonder how to convert character time info into date in R.
I searched over the web but did not find answer.
the input character string is something like 03_1993 or 03-1993, so the
precision is at month level. I tried the following but failed.
#R code below.
strptime(c("03_1993"),"%m_%Y")
2008 Sep 18
1
Adding 1 month to a dataframe column
Dear R experts,
I have a problem in modifying one column of a dataframe with a datatime
format using a datetime operator.
Here is my dataframe A:
DATACONT PROVINCIA VALORE
1 2007-12-31 MI 1
2 2007-12-31 PV 2
3 2007-12-31 NA 3
4 2007-12-31 MI 4
5 2007-12-31 RM 5
6 2007-12-31 RM 6
7 2007-12-31 MI 7
8
2007 Aug 29
5
Month end calculations
Hi R users,
Is there a function in R, which does some calculation only for the month
end in a daily data?... In other words, is there a command in R,
equivalent to "last." function in SAS?
BR, Shubha
[[alternative HTML version deleted]]