0

I am using the following Balance Sheet data and I am trying to store the two data frames into a list.

I have a vector called firms

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

I can use list(Nokia_BS, Twitter_BS) to create my lists but I am trying to create it from the vector of firms.

when I try list(firms) it returns as expected a list of my firms not the Balance Sheet data I am interested in. I have tried paste0() to create the list without much luck.

So I am trying to add-in the comma in the list() command but coming up short on how to do it.

Data:

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")

Data 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")
user113156
  • 5,113
  • 4
  • 22
  • 46
  • 2
    `mget(firms)` will work, but you should really read [this answer](https://stackoverflow.com/questions/17499013/how-do-i-make-a-list-of-data-frames/24376207#24376207) first – alistaire Sep 17 '18 at 15:49
  • The problem with this method for me is that I have some companies in the list of firms called `ASUStek Computer` and I have saved the data frame as `ASUStek`. – user113156 Sep 17 '18 at 15:53
  • Then how do you plan on connecting them? This is one more reason you should use lists from the start. – alistaire Sep 17 '18 at 15:55
  • I see the problem I am running into here. – user113156 Sep 17 '18 at 16:03

0 Answers0