我正在使用Hyperledger Fabric和Composer进行编程,并且现在也正在使用IBM-Blockchain。由于教程的原因,我克隆了这个仓库:https://github.com/IBM-Blockchain/marbles
现在我想做 date concat prev_avgL1
>>2014-10-17 10 - 2014 avg10
>>2014-10-24 10 - 2014 avg10
>>2014-10-31 10 - 2014 avg10
>>2014-11-07 11 - 2014 avg11
>>2014-11-17 11 - 2014 avg11
>>2014-11-26 11 - 2014 avg11
>>2014-12-26 12 - 2014 avg12
>>2015-01-22 1 -2015 avg1(for the new year and new month)
eastern$Date=as.Date(eastern$Date,format="%d-%m-%Y")
eastern$year=year(eastern$Date)
eastern$Month=month(eastern$Date)
eastern$concat=paste(eastern$Month,"-",eastern$year)
monthly_agg=aggregate( L1_BID_PRICE ~ Month+year , agg , mean )
monthly_agg$concat=paste(monthly_agg$Month,"-",monthly_agg$year)
eastern1=left_join(eastern,monthly_agg,by="concat")
The expected result should be :
>date concat prev_avgL1
>>2014-10-17 10 - 2014 NA
>>2014-10-24 10 - 2014 NA
>>2014-10-31 10 - 2014 NA
>>2014-11-07 11 - 2014 avg10
>>2014-11-17 11 - 2014 avg10
>>2014-11-26 11 - 2014 avg10
>>2014-12-26 12 - 2014 avg11
>>2015-01-22 1 -2015 avg12...and so on
**Here the average for October is NA since the data-set has dates starting from October 2014.
The actual result is after doing left_join():
>date concat prev_avgL1
>>2014-10-17 10 - 2014 avg10
>>2014-10-24 10 - 2014 avg10
>>2014-10-31 10 - 2014 avg10
>>2014-11-07 11 - 2014 avg11
>>2014-11-17 11 - 2014 avg11
>>2014-11-26 11 - 2014 avg11
>>2014-12-26 12 - 2014 avg12
>>2015-01-22 1 -2015 avg1
,但出现此错误:
npm install