Function

コメント・参照等
  • tidy dataを時系列データフレームに変換する関数

FUN = f_convert_to_ts_dataframe.r
function (obj0) 
{
    keylist <- as.vector(unique(obj0$key))
    obj2 <- Reduce(function(x, y) merge(x, y, by = "Date", all = T), lapply(keylist, function(x) {
        obj1 <- obj0[obj0$key == x, c("Date", "value")]
        colnames(obj1)[2] <- x
        return(obj1)
    }))
    return(obj2)
}