similar to: converting numbers in "YYYYMM" format to last calendar day and last exchange trading day of the month

Displaying 20 results from an estimated 700 matches similar to: "converting numbers in "YYYYMM" format to last calendar day and last exchange trading day of the month"

2012 Nov 17
3
Reshaping a dataframe
Seems like this should be easy but I'm struggling a bit. How do I rearrange a data frame to go from the first one to the second shown below ? State Date lbs TX 200701 400 TX 200702 650 TX 200703 950 TX 200704 1000 FL 200701 200 FL 200702 300 FL 200703 500 FL 200704 333 NJ 200701 409 NJ 200702 308 NJ 200703 300 NJ 200704 800 Date TX FL NJ 200701 400 200 409 200702 650
2012 Nov 18
3
Replace <NA> with something else
I am reading some data into R from an Excel spreadsheet using read.csv. Some of the original data that comes into column 1 from the spreadsheet is text that says NA. The NA stands for north america. As it comes in, R converts the NA over to <NA>. What is the cleanest way to change the <NA> values to something else. In other words, get rid of the brackets ? Maybe convert <NA>
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
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
2011 Jan 29
1
Basic Help with Zoo objects and trading days
All, I have been just recently working with zoo objects for trading systems. Can someone please help with these basic questions? Given a daily time series downloaded using get.hist.quote() from the tseries package, ie...... startDate= as.Date("2000-01-01") endDate= as.Date("2011-01-29") frequency= 'd' s= get.hist.quote('IWF', start= startDate, end=
2008 Feb 07
5
"revision control software" for managing R-code?
Does anyone use "revision control software" to manage their R-code? Any suggestions? Ideally, I'm looking for a, effective yet easy to implement/maintain package. http://en.wikipedia.org/wiki/Revision_control http://en.wikipedia.org/wiki/Comparison_of_revision_control_software --------------------------------- [[alternative HTML version deleted]]
2012 Mar 14
3
Help: problem converting character to numeric
Dear R experts, I have a dataframe imported from a csv file (with read.csv). Here is an example: yyyymm<- c("19860228", "19860331","19860430","19860531") id<-c("10000","10000","10000","10000") re<- c("C","0.25", "0.98", "1.34") mret<-data.frame(yyyymm, id, re)
2011 Jan 28
4
Months in alphabetical order rather than chronological order in graph
Greetings Though I have months in chronological order in my data table, the data were sampled every other month (i.e., February, April, June, August, October, December), every time I try to plot them (on the x-axis) they are plotted in alphabetical order. What am I missing? Cheers Kurt *************************************************************** Kurt Lewis Helf, Ph.D. Ecologist EEO
2010 Jan 22
2
Question on Merge/Lookup
I need to merge three datasets and don't know how. If I were using SQL, I would use df3, look up the characteristics of each date in df1 and the value for each observation in df2. df1 - unique list of Dates and characteristics of those dates Date, YYYYMM, YYYYWW, DOW df2 - the raw data Date, Place, Value df3 - all posibile combinations of Date + Place (via
2010 Apr 21
4
Converting daily data series to monthly series
Hi Users, I have daily series of data from 1962 - 2000, with the data for February 29th in leap years excluded, leaving 365 daily values for each year. I wish to convert the daily series to monthly series. How can I do this using the zoo package or any other package? Thanks ZABLONE OWITI GRADUATE STUDENT Nanjing University of Information, Science and Technology College of International
2008 Apr 08
2
"preferred" version of Linux for R?
Is there a recommended/preferred version of Linux for using with R? Is there one version of Linux that R-users prefer, and/or that works "better" with R? I am working with "large" datasets, and hope to take advantage of as much RAM as reasonable (8-32gb?). Thanks in advance! --------------------------------- [[elided Yahoo spam]] [[alternative HTML version
2008 May 21
2
automation of R? running an R script at a certain time each night?
I am using R in a Windows environment. I store my data in a Microsoft SQL database that gets updated automatically nightly. Once my SQL db is updated, I wish to automatically run an R "script" Any tips on "good" ways to approach this task? Is there an easy way to "launch" an R script using the Windows or other "scheduler"? Can I have an R-script run
2008 Jan 03
2
retaining formatting when converting a vector to a matrix/data.frame?
Please see example code below. I have a vector ("mydata") of length 10. "mydata" can have various formats (e.g. numeric, text, POSIXct, etc) I use the matrix and data.frame functions to convert "mydata" to a dataframe ("mydf") of 2 columns and 5 rows. What is a "good" way to ensure that the format is retained when I create the
2008 Jan 08
1
retaining "POSIXct" formatting when using apply(muff, FUN=MAX) on POSIXct dataframe?
How do I retain "POSIXct" formatting when using apply, with FUN=max? #example: mydata <- rep(Sys.time(), 10) mydf <- data.frame(matrix(data=mydata, nrow=2, ncol=length(mydata) ) ) for(i in seq(mydf))class(mydf[[i]]) <- class(mydata) str(mydf) maxdates <- apply(mydf,2,max,na.rm=T) str(maxdates) #Why is the formattign now "chr", and not
2008 Jun 29
1
Calculating quarterly statistics for time series object
I have time series observation on daily frequencies : library(zoo) SD=1 date1 = seq(as.Date("01/01/01", format = "%m/%d/%y"), as.Date("12/31/02", format = "%m/%d/%y"), by = 1) len1 = length(date1); data1 = zoo(matrix(rnorm(len1, mean=0, sd=SD*0.5), nrow = len1),  date1) plot(data1) Now I want to calculate 1. Quarterly statistics like mean, variance etc
2009 Dec 07
1
Subset of time observations where timediff > 60 secs
Dear list members I have a rather large vector (part of a data frame) giving the time (date + time, POSIXct) of observations. The times are irregular (with both small and large jumps) but increasing, and there are several millions of them. I now wish to reduce my data set, so that I only have observations which are at least (for example) 60 seconds apart. Basically, I need (all) the indices
2006 Apr 30
3
Ruby Reference
Hello all, What Ruby reference is everybodies favorite? When I''ve been looking around for documentation I haven''t found any that quite compares to php.net''s and cppreference.com''s function references. I''ve been using the one found on rubycentral, but I think that it is missing quite a bit and doesn''t have very good examples. ri is fine, but
2007 Dec 06
3
using "eval(parse(text)) " , gsub(pattern, replacement, x) , to process "code" within a loop/custom function
R-help users, Thanks in advance for any assistance ... I truly appreciate your expertise. I searched help and could not figure this out, and think you can probably offer some helpful tips. I apologize if I missed something, which I'm sure I probably did. I have data for many "samples". (e.g. 1950, 1951, 1952, etc.) For each "sample", I have many data-frames.
2003 May 18
1
TS data frames
hi chaps: apologies, more naive beginner's questions. my data sets contain multiple time series and look like date x y 196211 12 1 196212 4 2 196301 44 5 so dataset <- read.table("data.dat", header=T); works well enough. tsdataset<- ts(dataset, freq=12, start=c(1962,11)) also seems to work. summary(tsdataset) and print(tsdataset) show that this
2011 Oct 31
1
googleVis motionchart - slow with Date class
Hi, I am trying to create a googleVis motion chart with monthly data. When formatting the date column as a Date class variable, the plot as presented in the browser becomes considerably slower and very prone to crashing the browser. To illustrate this issue I have modified the WorldBank demo. ### objects from demo("WorldBank", package = "googleVis") M <-