similar to: Using string to call/manipulate an object

Displaying 20 results from an estimated 3000 matches similar to: "Using string to call/manipulate an object"

2012 Oct 19
1
to.yearly()
v="IBM" library(quantmod) v v1=getSymbols(v) to.yearly(v1) =============================== when i pass the value through a variable in to.yearly() function it shows the error msg like "Error in try.xts(x) : Error in UseMethod("as.xts") : no applicable method for 'as.xts' applied to an object of class "character"" i need the result of OHLC
2012 Jul 07
1
Getting objects from quantmod ticker list
Hi all, I would need to put datas downloaded with quantmod into a matrix or a data frame. Suppose to start from here: *require(quantmod) ticker.list <- c('AAA', 'ALTSALES', 'AMBNS', 'AMBSL', 'BAA', 'EMRATIO', 'FEDFUNDS', 'GASPRICE', 'GS1', 'GS10', 'GS20', 'LNS14100000', 'MORTG',
2011 Dec 07
1
scatterplotting stock returns using quantmod and pairs()
I want to get data for a set of ticker symbols and compute the daily return of the adjusted close using quantmod, and then scatterplot returns using pairs(). The following gets data for the list of tickers: tickers <- c("SHY","TLT","SPY","IWM","GLD","IEV","ILF","EWJ","EPP","SAF","ASA")
2010 Sep 10
2
[xts, quantmod] segfault probelm when I work with memcpy function
Hi, I work with SEXP C code and with xts and quantmod packages. I try to touch how xts internal works. So we have R session and: > ls() character(0) > getSymbols('AAPL') # quantmod package [1] "AAPL" > ls() [1] "AAPL" > str(AAPL) An ?xts? object from 2007-01-03 to 2010-09-09 containing: Data: num [1:929, 1:6] 86.3 84 85.8 86 86.5 ... - attr(*,
2017 Aug 07
1
tidyquant error downloading symbols for Index
Hi R Helpers, I recently tried to take advantage of the ability to download all the tickers in the S&P 500 using the functionality of tidyquant, but it threw an error. For summary, the set of commands that I ran was library(tidyquant) tq_index_options() tq_index("SP500") sessionInfo() R feedback including error message and sessionInfo are provided below. Guidance would be
2011 Nov 10
2
Error in axis ????
I did an update of both rstudio and my packages. I had some trouble but was able to move a lot of the packages so most troubles seem to be behind me. But having a problem with code that previously ran fine. See below: require(quantmod) Loading required package: quantmod Loading required package: Defaults Loading required package: xts Loading required package: zoo Attaching package: ?zoo? The
2018 Jan 18
0
Split charts with ggplot2, tidyquant
Hi Charlie, I am comfortable to put the data in any way that works best. Here are two possibilities: an xts and a data frame. library(quantmod) quantmod::getSymbols("SPY") # creates xts variable SPY SPYxts <- SPY[,c("SPY.Close","SPY.Volume")] SPYdf <- data.frame(Date=index(SPYxts),close=as.numeric(SPYxts$SPY.Close),
2018 Jan 07
1
help needed on quantmod....
dear members, I am using quantmod to work with stock prices... I am trying to append the data got from getQuote to the one got by getSymbols. The function is named "apnd". The code is as follows: function(x){ if ((class(x) == "xts") || (class(x) == "zoo")){ sym <- deparse(substitute(x))
2012 May 22
1
Quantmod, Xts, TTR and Postgresql
Hi Everyone, I'm currently using the latest build of R and R-Studio server (both are amazing products) I'm still very new to this but I came across this issue: I'm trying to do a select from postgres and put the data into and xts object like so: # Libs library('RPostgreSQL') # http://code.google.com/p/rpostgresql/ library('quantmod') library('TTR')
2018 Jan 18
3
Split charts with ggplot2, tidyquant
Could you provide some information on your data structure (e.g., are the two time series in separate columns in the data)? The solution is fairly straightforward once you have the data in the right structure. And I do not think tidyquant is necessary for what you want. Best, Charlie -- Charles Redmon GRA, Center for Research Methods and Data Analysis PhD Student, Department of Linguistics
2017 Sep 01
3
How to use getSymbols() to get annual data
Dear Sir/Madam, How to use getSymbols() to get annual data? For example, I need the annual stock price of APPLE from the year 2000 to 2016. How to write the command? I only know how to get the daily data. It is: getSymbols("AAPL",from="2000-01-01",to="2016-12-31") Thank you very much. Have a good week! Best regards, Yingrui Liu [[alternative HTML
2011 Jan 03
4
using "plot" with time series object - "axes = FALSE" option does not appear to work
Dear R-help, I am attempting to plot data using standard R plot utilities. The data was retrieved from FRED (St. Louis Federal Reserve) using the package quantmod. My question is NOT about quantmod. While I retrieve data using quantmod, I am not using its charting utility. I have been having success using the standard R "plot" utilities to this point with this type of data.
2011 Mar 12
3
pass character vector in instrument field of get.hist.quote function
I am new to R so I apologize if my question is trivial. I have not been able to figure out whether what I want to do is even possible. I have a data frame of stock ticker symbols which I store into R space from a txt file as follows: tickers <- read.csv("stocks.txt", header=FALSE, sep=",") tickers <- tickers[1] / the tickers are stored in the first column >
2012 Aug 01
1
Time Series Have Date Show Days of the Week
I used quantmod to pull in price data from the ticker SPY. The data has date and closing price. I would like to show the day of the week for each closing price. Is that possible? Also, I would like to add the back into the data frame in a new column without changing the structure of the data set if possible. SPY 2009-01-02 92.96 2009-01-05 92.85 2009-01-06 93.47
2012 Aug 05
1
R: Help xts object Subset Date by Day of the Week
I have a xts object made of daily closing prices I have acquired using quantmod. Here is my code: library(xts) library(quantmod) library(lubridate) # Gets SPY data getSymbols("SPY") # Subset Prices to just closing price SP500 <- Cl(SPY) # Show day of the week for each date using 2-6 for monday-friday SP500wd <- wday(SP500) # Add Price and days of week together
2011 Mar 10
2
using lapply
I have a function with the follow signare: apply.strategy(instr, strat) where instr and strat are both objects of classes instrument and strategy respectively. I want to apply this function to a list that holds objects of the class instrument. Currently I am doing this by explicit looping: for(i in length(instr.list) ) { apply.strategy(instr.list[[i]], my.strat) } Is it possible to
2009 Sep 24
1
Downloading currency data from from Yahoo
Hi, I wanted to download some currency data using "quantmod" package, however got following error : > getSymbols('USD/GBP',src='yahoo') Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, : cannot open URL
2018 Jan 19
2
Split charts with ggplot2, tidyquant
So the general strategy for getting these into separate panels in ggplot is to have a single variable that will be your response and a factor variable that indexes which original variable it came from. This can be accomplished in many ways, but the way I use is with the melt() function in the reshape2 package. For example, library(reshape2) plotDF <- melt(SPYdf, ??? ??? ??? ??? ??? ???
2009 Jun 25
1
apply on xts
Hi, I do not understand why after I called apply on a function that returns an xts (getIdvAdjSeries) it returns a matrix whose columns are just numeric value of time series in xts instead of a list of xts objects. Basically, I called the following: apply(matrix(tickers,ncol=1),1,FUN=getDivAdjSeries) getDivAdjSeries <- function(ticker) { seriesName <-
2009 Aug 03
3
Help with data type
Hi there, Using a quantmod function, I calculate the daily change between two points in a time series. However, I don't think I am using the data correctly. Code: getSymbols("^GSPC", src="yahoo") CloseData <- Cl(GSPC) Delta <- diff(CloseData, lag=1) for (i in 3:length(Delta)) { if (Delta[i]>Delta[i-1]) sum <- sum + Delta } I can't seem to use the Delta