私はxtsを作成するためにデータフレームを使用しています。 xtsは作成されますが、xts内のインデックスを除くすべての値は引用内にあります。これは、合計などの多くの関数が機能しないため、データを使用できないことにつながります。R - データフレームをxtsに変換すると、引用が追加されます(xts)
どのように私はxtsを引用なしで生産することができますか?ここで
は私のコードは[によるデータフレームの/のXTSのinconsisty名のコメントを更新]である:
# creates a dataframe with dates and currency
mydf3 <- data.frame(date = c("2013-12-10", "2015-04-01",
"2016-01-03"), plus = c(4, 3, 2), minus = c(-1, -2, -4))
# transforms the column date to date-format
mydf3 = transform(mydf3,date=as.Date(as.character(date),format='%Y-%m-%d'))
# creates the xts, based on the dataframe mydf3
myxts3 <- xts(mydf3, order.by = mydf3$date)
# removes the column date, since date is now stored as index in the xts
myxts3$date <- NULL
んこのヘルプあなたは? 't = transform(mydf3、date2 = as.Date(mydf3 $ date、format = '%Y-%m-%d')); myxts3 < - xts(t、order.by = t $ date2) ' – nilsole
あなたの変数名と矛盾しています。 'myxts3 <-xts(t [、-1]、order.by = t $ date)'を試してください。 – wici