Re: [R] Time Series Have Date Show Days of the Week

2012-08-11 Thread G See
Alternatively, xts has a convenience function for this .indexwday(SPY) will give weekdays as numbers with Sunday being 0 and Saturday being 6. There are also several similar functions .indexDate(x) .indexday(x) .indexmday(x) .indexwday(x) .indexweek(x) .indexmon(

Re: [R] Installing packages from RProfile.site file

2012-07-18 Thread G See
abhisarihan, Please don't crosspost! http://stackoverflow.com/questions/11530800/installing-packages-from-rprofile-site-file Thanks, Garrett On Tue, Jul 17, 2012 at 2:34 PM, abhisarihan wrote: > I am trying to install custom packages upon starting R. A lot of the code > that is written by us ri

Re: [R] moving averages on specific interval and merge

2012-05-12 Thread G See
Dear R-help, Please direct answers to this question to the R-sig-finance list copy of this question (http://stat.ethz.ch/pipermail/r-sig-finance/2012q2/010209.html) Thank you, Garrett On Sat, May 12, 2012 at 4:39 AM, Jim Green wrote: > Greetings! > > I am using quantstrat and xts to do some int

Re: [R] setwd et chaines de caracteres

2012-03-17 Thread G See
R> tmp <- tempdir() R> dir.create(file.path(tmp, "a space")) R> setwd(file.path(tmp, "a space")) R> getwd() [1] "/private/var/folders/ss/9z_gwf2j5bbbrhnv67_gh770gp/T/Rtmpg1MLIT/a space" On Sat, Mar 17, 2012 at 8:08 AM, David Winsemius wrote: > > On Mar 17, 2012, at 3:43 AM, André Smolarz wro

Re: [R] subsetting by cell value with a list

2012-03-15 Thread G See
rovide sample data? What is the output of dput(head(my.df)) On Thu, Mar 15, 2012 at 3:38 PM, G See wrote: >> my.df <- data.frame(IDX=1:42, x=rnorm(1:42)) >> my.df[my.df$IDX %in% c(17, 42), ] >   IDX          x > 17  17 -0.5110095 > 42  42 -1.0686427 > > Garrett >

Re: [R] subsetting by cell value with a list

2012-03-15 Thread G See
> my.df <- data.frame(IDX=1:42, x=rnorm(1:42)) > my.df[my.df$IDX %in% c(17, 42), ] IDX x 17 17 -0.5110095 42 42 -1.0686427 Garrett On Thu, Mar 15, 2012 at 3:25 PM, Ed Siefker wrote: > I would like to subset by dataframe by matching all rows that have any value > from a list of valu

Re: [R] pasting several things

2012-03-02 Thread G See
Try this: x <- structure(list(day = 19, C1 = structure(1L, .Label = c("", "C1" ), class = "factor"), C2 = structure(2L, .Label = c("", "C2"), class = "factor"), C3 = structure(1L, .Label = c("", "C3"), class = "factor"), Q1 = structure(2L, .Label = c("", "Q1"), class = "factor"), Q2 = str

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread G See
On Fri, Feb 3, 2012 at 10:39 AM, peter dalgaard wrote: > > So that's a nonbreak space alright. Next question: How did it get there? I'm > mildly surprised that it crept into the data frame, I would expect it to > happen much easier with things typed on the keyboard (Alt-Spc on my Mac > keyboard

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread G See
ToRaw(x) [1] 6e 2f 61 Thanks to all for the help, Garrett On Fri, Feb 3, 2012 at 10:19 AM, Duncan Murdoch wrote: > On 12-02-03 11:10 AM, G See wrote: >> >> Sorry, I meant >> Do you know of a way to print a string such that I can see whether it >> contains a *space

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread G See
Sorry, I meant Do you know of a way to print a string such that I can see whether it contains a *space* or a no-break space? On Fri, Feb 3, 2012 at 10:10 AM, G See wrote: > Petr, > > Thank you!  That is great. > > Do you know of a way to print a string such that I can see whethe

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread G See
Petr, Thank you! That is great. Do you know of a way to print a string such that I can see whether it contains a string or a no-break space? Thanks, Garrett On Fri, Feb 3, 2012 at 10:01 AM, Petr Savicky wrote: > On Fri, Feb 03, 2012 at 09:25:10AM -0600, G See wrote: >> I have a d

Re: [R] Cannot get "==" operator to return TRUE

2012-02-03 Thread G See
test should be TRUE. > > (I renamed the dput object rdata, because df() is a base function.) > > df[df == "n/a"] <- NA > shouldn't work on Mac, or any other system, because no elements of > your data frame are "n/a", but are instead "n/a " &

[R] Cannot get "==" operator to return TRUE

2012-02-03 Thread G See
I have a data.frame named "df". The dput of df is at the bottom of this e-mail. What I'd like to do is replace the "n/a " values with NA. On Mac OSX, it works to do this: df[df == "n/a"] <- NA However, it does not work on Ubuntu. See below. Thanks in advance, Garrett > x <- df[27, 4] # complet

Re: [R] [R-SIG-Finance] how do I make a movie out of a timeseries of 2D data?

2012-01-12 Thread G See
Michael, Please don't cross post to both lists. If it doesn't have to do with finance, don't send it it r-sig-finance. Thanks, Garrett On Thu, Jan 12, 2012 at 8:38 AM, Michael wrote: > Hi all, > > I have an array of 1 x 200 x 200 numbers... which is a time-series of > 200x200 2D data... >

Re: [R] Problem installing tweetR on Ubuntu

2011-10-19 Thread G See
This will help you solve your problem http://www.omegahat.org/RCurl/FAQ.html -Garrett On Wed, Oct 19, 2011 at 8:16 PM, Axel Urbiz wrote: > Dear List, > > When I try to install tweetR on Ubuntu, I get the error message below. It > is > a problem with the dependency RCurl. This package is not ava

Re: [R] problem with quantmod package

2011-10-18 Thread G See
I'm not sure how to easily get that data from google (see Michael's message), but it's available from yahoo. getSymbols('TCS.NS', src='yahoo') I've found that historical stock data from Yahoo is typically cleaner and more reliable than from Google. The other main difference is that Yahoo provide