Currently, I am doing this. It subsets data from an aggregate. Running the part aggregate[which(aggregate$resolution == keys[i]), ]
gives me the part of the aggregate data set that I want. However, when I attempt to do this in a for loop, it gives me a pile of key strings.
Why does this happen?
How can I get the subset to be put into the list?
keys <- c()
keys[1] <- "2016_01_12_ban_on_booby-trapped_aid.tsv"
keys[2] <- "2014_11_20_anti-counterfeiting_pact.tsv"
keys[3] <- "2015_08_06_access_to_humanitarian_aid.tsv"
keys[4] <- "2017_03_22_world_assembly_central_library_compact.tsv"
keys[5] <- "2017_08_31_national_sovereignty_act.tsv"
keys[6] <- "2015_10_21_repeal_renewable_research_commitment.tsv"
keys[7] <- "2017_07_29_limitations_on_banishment.tsv"
keys[8] <- "2016_10_04_nuclear_weapons_accord.tsv"
keys[9] <- "2017_03_07_international_patent_agreement.tsv"
keys[10] <- "2016_04_30_repeal_law_enforcement_education.tsv"
subsets <- list()
for (i in 1:length(keys)) {
subsets[i] = aggregate[which(aggregate$resolution == keys[i]), ]
}