R:以groupBy的方式将数据帧拆分为数据帧列表

时间:2016-08-30 18:53:11

标签: r

我想以groupBy的方式将数据帧拆分为数据帧列表。我目前有以下代码:

from Spotfire.Dxp.Data import CalculatedColumn
cols = Document.Data.Tables["TIBER"].Columns
cols.AddCalculatedColumn("NEWCOLUMN","[oldcolumn] * 3.289");

然而,这给了我一份清单。

infrastructure_by_day <- read.csv("allInfrastructure.csv")

countries <- levels(infrastructure_by_day$country)
categories <- levels(infrastructure_by_day$category)

segregate <- function(country, category) {
  infrastructure_by_day[
    which(infrastructure_by_day$country == country & 
            infrastructure_by_day$category == category), ]
}

infrastructure_data_frames <- mapply(segregate, countries, categories)

如何获取数据框列表?

0 个答案:

没有答案