Re: [R] Date format conversion from 2012-09-20 to 2012:09:20

2012-11-03 Thread veepsirtt
Hi,
thanks A.K
try this not working

#*
# Load historical data
#**
library('quantmod')
endDate =Sys.Date()
startDate = as.Date(endDate-10, order=ymd)

dataspy = getSymbols(SPY, from = startDate, to=endDate, auto.assign =
FALSE) 

myStDt- startDate
while (myStDt = endDate){
startEndDate-paste(startDate,myStDt,sep=::)
print(dataspy)
dataspy=Cl(dataspy[startEndDate])
#display the subseted data 
print(dataspy)
myStDt=myStDt+1 
}




--
View this message in context: 
http://r.789695.n4.nabble.com/Date-format-conversion-from-2012-09-20-to-2012-09-20-tp4643710p4648327.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Date format conversion from 2012-09-20 to 2012:09:20

2012-11-02 Thread veepsirtt
Hi R,
How to get the range of values form startDate to lastDate as given below?.

#*
# Load historical data
#** 
library('quantmod')
endDate =Sys.Date()
startDate = as.Date(endDate-30, order=ymd)

dataspy = getSymbols(SPY, from = startDate, to=endDate, auto.assign =
FALSE)
lastDate=startDate+5

#subset first 5 days
dataspy['startDate::lastDate']
print(dataspy)

Thanks
veepsirtt




--
View this message in context: 
http://r.789695.n4.nabble.com/Date-format-conversion-from-2012-09-20-to-2012-09-20-tp4643710p4648258.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Date format conversion from 2012-09-20 to 2012:09:20

2012-11-02 Thread arun


Hi, 
This works: 
dataspy['20121003/20121009'] 
 #          SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted 
#2012-10-03   144.89   145.43  144.13    145.09  121283100       145.09 
#2012-10-04   145.64   146.34  145.44    146.13  124311600       146.13 
#2012-10-05   146.91   147.16  145.70    146.14  124842100       146.14 
#2012-10-08   145.60   146.12  145.31    145.64   78415400       145.64 
#2012-10-09   145.53   145.65  144.15    144.20  148872900       144.20 
This also works: 
startDate-2012-10-03 
 endDate-2012-10-08 
 startEndDate-paste(startDate,endDate,sep=::) 
 dataspy[startEndDate,] 
#           SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted 
#2012-10-03   144.89   145.43  144.13    145.09  121283100       145.09 
#2012-10-04   145.64   146.34  145.44    146.13  124311600       146.13 
#2012-10-05   146.91   147.16  145.70    146.14  124842100       146.14 
#2012-10-08   145.60   146.12  145.31    145.64   78415400       145.64 
A.K. 


- Original Message -
From: veepsirtt veepsi...@gmail.com
To: r-help@r-project.org
Cc: 
Sent: Friday, November 2, 2012 2:41 PM
Subject: Re: [R] Date format conversion from 2012-09-20 to  2012:09:20

Hi R,
How to get the range of values form startDate to lastDate as given below?.

#*
# Load historical data
#** 
library('quantmod')
endDate =Sys.Date()
startDate = as.Date(endDate-30, order=ymd)

dataspy = getSymbols(SPY, from = startDate, to=endDate, auto.assign =
FALSE)
lastDate=startDate+5

#subset first 5 days
dataspy['startDate::lastDate']
print(dataspy)

Thanks
veepsirtt




--
View this message in context: 
http://r.789695.n4.nabble.com/Date-format-conversion-from-2012-09-20-to-2012-09-20-tp4643710p4648258.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Date format conversion from 2012-09-20 to 2012:09:20

2012-11-02 Thread R. Michael Weylandt
head(dataspy, 6) seems easiest.

Cheers,
Michael

On Fri, Nov 2, 2012 at 6:41 PM, veepsirtt veepsi...@gmail.com wrote:
 Hi R,
 How to get the range of values form startDate to lastDate as given below?.

 #*
 # Load historical data
 #**
 library('quantmod')
 endDate =Sys.Date()
 startDate = as.Date(endDate-30, order=ymd)

 dataspy = getSymbols(SPY, from = startDate, to=endDate, auto.assign =
 FALSE)
 lastDate=startDate+5

 #subset first 5 days
 dataspy['startDate::lastDate']
 print(dataspy)

 Thanks
 veepsirtt




 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Date-format-conversion-from-2012-09-20-to-2012-09-20-tp4643710p4648258.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Date format conversion from 2012-09-20 to 2012:09:20

2012-11-02 Thread R. Michael Weylandt
D'oh -- won't work in general (weekends!) -- serves me right for being
lazy on a Friday.

What your problem is that variables aren't extrapolated into strings,
so you'll need to construct the subset string directly:

dataspy[paste(startDate, endDate, sep=/)]

or some such. (Untested!)

Cheers,
Michael

On Fri, Nov 2, 2012 at 8:06 PM, R. Michael Weylandt
michael.weyla...@gmail.com wrote:
 head(dataspy, 6) seems easiest.

 Cheers,
 Michael

 On Fri, Nov 2, 2012 at 6:41 PM, veepsirtt veepsi...@gmail.com wrote:
 Hi R,
 How to get the range of values form startDate to lastDate as given below?.

 #*
 # Load historical data
 #**
 library('quantmod')
 endDate =Sys.Date()
 startDate = as.Date(endDate-30, order=ymd)

 dataspy = getSymbols(SPY, from = startDate, to=endDate, auto.assign =
 FALSE)
 lastDate=startDate+5

 #subset first 5 days
 dataspy['startDate::lastDate']
 print(dataspy)

 Thanks
 veepsirtt




 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Date-format-conversion-from-2012-09-20-to-2012-09-20-tp4643710p4648258.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.