创建数据框列表,每个数据框的名称均来自列表

时间:2018-09-17 15:45:05

标签: r

我正在使用以下资产负债表数据,并且试图将两个数据框存储到列表中。

我有一个叫做“商号”的向量

firms <- c("Nokia_BS", "Twitter_BS")

我可以使用list(Nokia_BS, Twitter_BS)创建我的列表,但是我正试图从公司的载体中创建它。

当我尝试list(firms)时,它会按预期返回我的公司列表,而不是我感兴趣的资产负债表数据。我尝试paste0()创建该列表时运气不佳。

因此,我尝试在comma命令中添加list(),但在操作方法上却有不足之处。

数据:

Nokia_BS <- structure(list(c("", "Assets", "Current assets", "Cash", "Cash and cash equivalents", 
"Short-term investments", "Total cash", "Receivables", "Inventories", 
"Prepaid expenses", "Other current assets", "Total current assets", 
"Non-current assets", "Property, plant and equipment", "Gross property, plant and equipment", 
"Accumulated Depreciation", "Net property, plant and equipment", 
"Equity and other investments", "Goodwill", "Intangible assets", 
"Deferred income taxes", "Prepaid pension benefit", "Other long-term assets", 
"Total non-current assets", "Total assets", "Liabilities and stockholders' equity", 
"Liabilities", "Current liabilities", "Short-term debt", "Accounts payable", 
"Taxes payable", "Accrued liabilities", "Deferred revenues", 
"Other current liabilities", "Total current liabilities", "Non-current liabilities", 
"Long-term debt", "Deferred taxes liabilities", "Deferred revenues", 
"Pensions and other benefits", "Minority interest", "Other long-term liabilities", 
"Total non-current liabilities", "Total liabilities", "Stockholders' equity", 
"Common stock", "Other Equity", "Additional paid-in capital", 
"Retained earnings", "Treasury stock", "Accumulated other comprehensive income", 
"Total stockholders' equity", "Total liabilities and stockholders' equity"
), `2017-12` = c("2017-12", "", "", "", "7369", "1213", "8582", 
"6880", "2646", "948", "808", "19864", "", "", "3906", "-2053", 
"1853", "1159", "5248", "3971", "4582", "3979", "368", "21160", 
"41024", "", "", "", "309", "3996", "836", "1551", "3513", "2539", 
"12744", "", "3457", "413", "2204", "4440", "80", "1548", "12142", 
"24886", "", "", "16710", "693", "1147", "-1480", "-932", "16138", 
"41024"), `2016-12` = c("2016-12", "", "", "", "7497", "2125", 
"9622", "6972", "2506", "1105", "514", "20719", "", "", "3895", 
"-1914", "1981", "1410", "5724", "5236", "5701", "3802", "328", 
"24182", "44901", "", "", "", "370", "3781", "996", "1576", "3178", 
"2704", "12605", "", "3657", "403", "1171", "5000", "881", "1090", 
"12202", "24807", "", "", "16219", "685", "3588", "-881", "483", 
"20094", "44901"), `2015-12` = c("2015-12", "", "", "", "6995", 
"2961", "9956", "3913", "1014", "523", "418", "15824", "", "", 
"2229", "-1534", "695", "1088", "237", "323", "2634", "", "125", 
"5102", "20926", "", "", "", "51", "1910", "760", "925", "1857", 
"888", "6391", "", "2023", "61", "1235", "423", "21", "269", 
"4032", "10423", "", "", "4024", "626", "6279", "-718", "292", 
"10503", "20926"), `2014-12` = c("2014-12", "", "", "", "2527", 
"5454", "7981", "3430", "1275", "640", "398", "13724", "", "", 
"2352", "-1636", "716", "879", "2563", "350", "2720", "", "111", 
"7339", "21063", "", "", "", "116", "2313", "763", "1009", "1829", 
"1258", "7288", "", "2576", "32", "1573", "", "58", "925", "5164", 
"12452", "", "", "3105", "685", "4710", "-988", "1099", "8611", 
"21063"), `2013-12` = c("2013-12", "", "", "", "3676", "5580", 
"9256", "2901", "804", "613", "5569", "19143", "", "", "2148", 
"-1582", "566", "806", "3295", "296", "890", "", "195", "6048", 
"25191", "", "", "", "3376", "1842", "796", "944", "1163", "6057", 
"14178", "", "3286", "195", "", "", "192", "872", "4545", "18723", 
"", "", "3195", "861", "2581", "-603", "434", "6468", "25191"
), `2012-12` = c("2012-12", "", "", "", "3504", "6869", "10373", 
"5551", "1538", "3236", "180", "20878", "", "", "4973", "-3542", 
"1431", "747", "4876", "647", "1254", "", "116", "9071", "29949", 
"", "", "", "462", "4394", "821", "1031", "2256", "5682", "14646", 
"", "5087", "700", "", "", "1386", "69", "7242", "21888", "", 
"", "3259", "692", "3995", "-629", "744", "8061", "29949"), `2011-12` = c("2011-12", 
"", "", "", "9236", "1666", "10902", "7181", "2330", "4488", 
"554", "25455", "", "", "5595", "-3776", "1819", "708", "4838", 
"1429", "1848", "", "108", "10750", "36205", "", "", "", "1352", 
"5532", "", "7450", "", "3110", "17444", "", "3969", "800", "", 
"", "2043", "76", "6888", "24332", "", "", "3302", "608", "7836", 
"-644", "771", "11873", "36205"), `2010-12` = c("2010-12", "", 
"", "", "7592", "4683", "12275", "7570", "2523", "4360", "417", 
"27145", "", "", "5573", "-3675", "1898", "669", "5723", "1984", 
"1596", "", "108", "11978", "39123", "", "", "", "1037", "6101", 
"", "7365", "", "3037", "17540", "", "4242", "1022", "", "", 
"1847", "88", "7199", "24739", "", "", "3164", "558", "10500", 
"-663", "825", "14384", "39123"), `2009-12` = c("2009-12", "", 
"", "", "5926", "2947", "8873", "7981", "1865", "4551", "343", 
"23613", "", "", "5447", "-3580", "1867", "623", "5171", "2762", 
"1507", "", "195", "12125", "35738", "", "", "", "771", "4950", 
"", "6504", "", "2963", "15188", "", "4432", "1303", "", "", 
"1661", "66", "7462", "22650", "", "246", "3239", "279", "10132", 
"-681", "-127", "13088", "35738"), `2008-12` = c("2008-12", "", 
"", "", "5561", "1275", "6836", "9466", "2539", "4549", "1137", 
"24528", "", "", "5665", "-3570", "2095", "", "6272", "4167", 
"1968", "", "647", "15148", "39676", "", "", "", "3600", "5237", 
"", "7040", "", "4526", "20403", "", "863", "1792", "", "", "2307", 
"70", "5031", "25434", "", "246", "3376", "443", "11720", "-1886", 
"342", "14242", "39676")), .Names = c("", "2017-12", "2016-12", 
"2015-12", "2014-12", "2013-12", "2012-12", "2011-12", "2010-12", 
"2009-12", "2008-12"), row.names = c(NA, -53L), class = "data.frame")

数据2:

Twitter_BS <- structure(list(c("", "Assets", "Current assets", "Cash", "Cash and cash equivalents", 
"Short-term investments", "Total cash", "Receivables", "Deferred income taxes", 
"Prepaid expenses", "Total current assets", "Non-current assets", 
"Property, plant and equipment", "Gross property, plant and equipment", 
"Accumulated Depreciation", "Net property, plant and equipment", 
"Goodwill", "Intangible assets", "Other long-term assets", "Total non-current assets", 
"Total assets", "Liabilities and stockholders' equity", "Liabilities", 
"Current liabilities", "Capital leases", "Accounts payable", 
"Taxes payable", "Accrued liabilities", "Deferred revenues", 
"Other current liabilities", "Total current liabilities", "Non-current liabilities", 
"Long-term debt", "Capital leases", "Deferred taxes liabilities", 
"Other long-term liabilities", "Total non-current liabilities", 
"Total liabilities", "Stockholders' equity", "Common stock", 
"Additional paid-in capital", "Retained earnings", "Accumulated other comprehensive income", 
"Total stockholders' equity", "Total liabilities and stockholders' equity"
), `2017-12` = c("2017-12", "", "", "", "1638", "2765", "4403", 
"664", "", "255", "5322", "", "", "1928", "-1154", "774", "1189", 
"50", "78", "2091", "7412", "", "", "", "85", "171", "36", "165", 
"28", "99", "583", "", "1627", "81", "13", "60", "1782", "2365", 
"", "0", "7751", "-2672", "-32", "5047", "7412"), `2016-12` = c("2016-12", 
"", "", "", "989", "2786", "3775", "651", "", "227", "4652", 
"", "", "1642", "-858", "784", "1185", "95", "154", "2218", "6870", 
"", "", "", "81", "122", "30", "235", "34", "82", "584", "", 
"1539", "67", "8", "68", "1681", "2265", "", "0", "7225", "-2550", 
"-69", "4605", "6870"), `2015-12` = c("2015-12", "", "", "", 
"911", "2584", "3495", "639", "", "248", "4382", "", "", "1314", 
"-579", "735", "1123", "141", "62", "2061", "6442", "", "", "", 
"88", "134", "26", "143", "24", "91", "506", "", "1455", "60", 
"3", "51", "1568", "2074", "", "0", "6507", "-2093", "-46", "4368", 
"6442"), `2014-12` = c("2014-12", "", "", "", "1511", "2111", 
"3622", "418", "26", "190", "4256", "", "", "888", "-331", "557", 
"623", "105", "43", "1327", "5583", "", "", "", "112", "53", 
"18", "123", "19", "68", "394", "", "1376", "119", "25", "43", 
"1563", "1957", "", "0", "5209", "-1572", "-10", "3626", "5583"
), `2013-12` = c("2013-12", "", "", "", "841", "1393", "2234", 
"247", "62", "31", "2575", "", "", "500", "-167", "333", "363", 
"78", "18", "792", "3366", "", "", "", "87", "28", "10", "56", 
"14", "30", "225", "", "", "111", "60", "21", "191", "416", "", 
"0", "3945", "-995", "-0", "2950", "3366"), `2012-12` = c("2012-12", 
"", "", "", "203", "222", "425", "112", "", "17", "554", "", 
"", "259", "-73", "186", "69", "4", "19", "277", "832", "", "", 
"", "49", "8", "6", "38", "", "8", "110", "", "", "66", "", "904", 
"970", "1080", "", "0", "102", "-349", "-1", "-248", "832"), 
    `2011-12` = c("2011-12", "", "", "", "219", "331", "550", 
    "40", "", "7", "596", "", "", "85", "-23", "62", "37", "6", 
    "19", "125", "721", "", "", "", "23", "5", "5", "12", "", 
    "3", "48", "", "", "21", "", "854", "875", "923", "", "0", 
    "68", "-270", "-0", "-202", "721"), `2010-12` = c("2010-12", 
    "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
    "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
    "", "", "", "", "", "", "", "", "", "", "", "", "", ""), 
    `2009-12` = c("2009-12", "", "", "", "", "", "", "", "", 
    "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
    "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
    "", "", "", "", "", ""), `2008-12` = c("2008-12", "", "", 
    "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
    "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 
    "", "", "", "", "", "", "", "", "", "", "", "")), .Names = c("", 
"2017-12", "2016-12", "2015-12", "2014-12", "2013-12", "2012-12", 
"2011-12", "2010-12", "2009-12", "2008-12"), row.names = c(NA, 
-45L), class = "data.frame")

0 个答案:

没有答案
相关问题