Remove quotes from a character vector in R

前端 未结 10 2258
盖世英雄少女心
盖世英雄少女心 2020-11-29 01:06

Suppose you have a character vector:

char <- c(\"one\", \"two\", \"three\")

When you make reference to an index value, you get the follo

10条回答
  •  迷失自我
    2020-11-29 01:31

    I think I was trying something very similar to the original poster. the get() worked for me, although the name inside the chart was not inherited. Here is the code that worked for me.

    #install it if you dont have it
    library(quantmod)
    
    # a list of stock tickers
    myStocks <- c("INTC", "AAPL", "GOOG", "LTD")
    
    # get some stock prices from default service
    getSymbols(myStocks)
    
    # to pause in between plots
    par(ask=TRUE)
    
    # plot all symbols
    for (i in 1:length(myStocks)) {
        chartSeries(get(myStocks[i]), subset="last 26 weeks")
    }
    

提交回复
热议问题