r – How to overcome error:attempt to set colnames on an object with less than two dimension in xts object
r – How to overcome error:attempt to set colnames on an object with less than two dimension in xts object
You probably want:
q <- data.frame(100,200,200,200,200,200)
colnames(q) <- colnames(SPY)
q <- xts(q, as.Date(2016-01-26))
# SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted
# 2016-01-26 100 200 200 200 200 200
class(SPY)
# [1] xts zoo
class(q)
# [1] xts zoo
tail(rbind(SPY, q))
# SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted
# 2016-01-19 189.96 190.11 186.20 188.06 190196000 188.06
# 2016-01-20 185.03 187.50 181.02 185.65 280016900 185.65
# 2016-01-21 186.21 188.87 184.64 186.69 189174000 186.69
# 2016-01-22 189.78 190.76 188.88 190.52 163849600 190.52
# 2016-01-25 189.92 190.15 187.41 187.64 122676200 187.64
# 2016-01-26 100.00 200.00 200.00 200.00 200 200.00
r – How to overcome error:attempt to set colnames on an object with less than two dimension in xts object
Related posts on R Error :
- vba – Variable Not Defined Compiler Error
- amazon web services – AWS IAM Policy Grammar Error with Multiple Conditions
- c++ – AdjustTokenPrivileges error ERROR_NOT_ALL_ASSIGNED
- asp.net – Deploying website: 500 – Internal server error
- java – import au.com.bytecode.opencsv.CSVReader Error
- ggplot2 – R error could not find function multiplot using Cookbook example
- linux – Tar error: Unexpected EOF in archive
- php – Mailer Error: SMTP connect() failed.
- C++ compiler error: return type specification for constructor invalid