I'm trying to do an analysis of the BTC price here in Brazil, and compare it with other 4 countries..
我正在尝试对巴西的BTC价格进行分析,并将其与其他4个国家进行比较。
So I've found quandl and downloaded their .csv data for both countries.
所以我找到了quandl并为这两个国家下载了他们的.csv数据。
Each .csv has 6 columns:
每个.csv有6列:
- Date
- 日期
- 24h.Average
- 24h.Average
- Ask
- 问
- Bid
- 出价
- Last
- 持续
- Total.Volume
- 总容积
Well, I'm trying to make a new table with:
好吧,我正在尝试制作一个新表:
BTCBRL$Date
- BTCBRL $日期
BTCBRL$Last
- BTCBRL $最后
BTCUSD$Last
- BTCUSD $最后
BTCCNY$Last
- BTCCNY $最后
BTCEUR$Last
- BTCEUR $最后
So I wrote:
所以我写道:
lastPrices <- cbind(BTCBRL$Date, BTCBRL$Last, BTCUSD$Last, BTCCNY$Last, BTCEUR$Last)
But then my date that once was 2015-07-05
, just became 656
..
但那时我的约会曾经是2015-07-05,刚刚成为656 ..
What's an efficient to deal with it? Preferably overwriting it in the same table..
处理它有什么效率?最好在同一张表中覆盖它..
1 个解决方案
#1
1
Use data.frame()
rather than cbind()
if you want to preserve mixed types (ie have both dates and numeric values). The latter returns a matrix and a matrix can only hold a single atomic data type so it converts everything to numeric.
如果要保留混合类型(即同时具有日期和数值),请使用data.frame()而不是cbind()。后者返回一个矩阵,矩阵只能保存一个原子数据类型,因此它将所有内容转换为数字。
#1
1
Use data.frame()
rather than cbind()
if you want to preserve mixed types (ie have both dates and numeric values). The latter returns a matrix and a matrix can only hold a single atomic data type so it converts everything to numeric.
如果要保留混合类型(即同时具有日期和数值),请使用data.frame()而不是cbind()。后者返回一个矩阵,矩阵只能保存一个原子数据类型,因此它将所有内容转换为数字。