Этот вопрос состоит из двух похожих частей:
Вопрос 1:
У меня есть список из 2 фреймов данных для Alibaba, Alphabet.Я пытаюсь сделать расчеты для всех двух фирм в списке.Так, например, для всех списков в списке возьмите Sales, General and administrative / Operating income
.
, где я пытаюсь получить выходные данные конкретных соотношений для каждой из фирм за годы (альтернативно только для года 2017-03).
BS
Данные:
BS <- structure(list(Alibaba = structure(list(V1 = c("Fiscal year ends in March. CNY in millions except per share data.",
"Assets", "Current assets", "Cash", "Cash and cash equivalents",
"Short-term investments", "Total cash", "Receivables", "Inventories",
"Deferred income taxes", "Prepaid expenses", "Other current assets",
"Total current assets", "Non-current assets", "Property, plant and equipment",
"Land", "Fixtures and equipment", "Other properties", "Property and equipment, at cost",
"Accumulated Depreciation", "Property, plant and equipment, net",
"Equity and other investments", "Goodwill", "Intangible assets",
"Deferred income taxes", "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", "Accrued liabilities",
"Deferred revenues", "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"
), V2 = c("2018-03", "", "", "", "199309", "10901", "210210",
"25370", "4535", "", "5760", "10980", "256855", "", "", "", "35909",
"51019", "86928", "-20439", "66489", "177892", "162149", "36842",
"2182", "14715", "460269", "717124", "", "", "", "6028", "",
"16071", "66930", "22297", "24484", "135810", "", "119525", "19312",
"", "993", "70616", "5046", "215492", "351302", "", "1", "3854",
"186764", "172353", "-2233", "5083", "365822", "717124"), V3 = c("2017-03",
"", "", "", "143736", "7065", "150801", "21374", "", "652", "4176",
"5513", "182516", "", "", "", "19311", "13156", "32467", "-12261",
"20206", "151820", "125420", "18799", "386", "7665", "324296",
"506812", "", "", "", "14897", "", "7674", "36025", "15052",
"20123", "93771", "", "76835", "10154", "", "641", "42330", "4282",
"134242", "228013", "", "1", "3393", "164585", "108558", "-2823",
"5085", "278799", "506812"), V4 = c("2016-03", "", "", "", "106818",
"8878", "115696", "11738", "", "451", "3891", "2294", "134070",
"", "", "", "13772", "8038", "21810", "-8181", "13629", "120853",
"81645", "8246", "30", "5977", "230380", "364450", "", "", "",
"4304", "1051", "3733", "15352", "10297", "17302", "52039", "",
"53467", "6471", "", "418", "32552", "2516", "95424", "147463",
"", "1", "2356", "132206", "78752", "", "3672", "216987", "364450"
), V5 = c("2015-03", "", "", "", "108193", "17806", "125999",
"11163", "", "256", "815", "3876", "142109", "", "", "", "10259",
"4646", "14905", "-5766", "9139", "48488", "41933", "9680", "157",
"3928", "113325", "255434", "", "", "", "1990", "667", "3368",
"7035", "7914", "18698", "39672", "", "50603", "4493", "", "445",
"11974", "2808", "70323", "109995", "", "1", "1563", "117142",
"24842", "", "1891", "145439", "255434"), V6 = c("2014-03", "",
"", "", "33045", "12029", "45074", "16006", "", "191", "226",
"6336", "67833", "", "", "", "5947", "3214", "9161", "-3580",
"5581", "20689", "11793", "3566", "66", "2021", "43716", "111549",
"", "", "", "10364", "3308", "1972", "7021", "6496", "8223",
"37384", "", "30711", "2136", "18", "428", "1079", "10455", "44827",
"82211", "", "1", "2474", "27043", "1183", "", "-1363", "29338",
"111549"), V7 = c("2013-03", "", "", "", "30396", "2919", "33315",
"4952", "", "208", "186", "4501", "43162", "", "", "", "3882",
"2612", "6494", "-2686", "3808", "1797", "11294", "2229", "52",
"1444", "20624", "63786", "", "", "", "5448", "2012", "1112",
"5318", "4929", "5176", "23995", "", "22462", "643", "60", "389",
"537", "15724", "39815", "63810", "", "1", "1337", "21655", "-20491",
"", "-2526", "-24", "63786"), V8 = c("2012-03", "", "", "", "16857",
"5480", "22337", "1315", "", "97", "139", "4011", "27899", "",
"", "", "3114", "1565", "4679", "-2216", "2463", "1890", "11436",
"2056", "43", "1423", "19311", "47210", "", "", "", "1283", "537",
"745", "2484", "4350", "2352", "11751", "", "", "413", "", "529",
"2895", "134", "3971", "15722", "", "1", "1096", "20778", "12552",
"", "-2939", "31488", "47210"), V9 = c("2011-12", "", "", "",
"3433", "8219", "11652", "559", "", "", "51", "978", "13241",
"", "", "", "756", "594", "1350", "-617", "733", "235", "455",
"224", "", "408", "2054", "15295", "", "", "", "1286", "16",
"472", "362", "3969", "854", "6961", "", "", "240", "", "454",
"102", "120", "917", "7878", "", "0", "", "", "", "", "7417",
"7418", "15295"), V10 = c("2010-12", "", "", "", "3254", "6803",
"10057", "94", "", "", "294", "596", "11040", "", "", "", "696",
"540", "1236", "-455", "781", "64", "368", "232", "101", "119",
"1665", "12705", "", "", "", "93", "16", "105", "", "", "6171",
"6385", "", "", "131", "", "333", "50", "54", "567", "6952",
"", "0", "", "", "", "", "5753", "5753", "12705"), V11 = c("2009-12",
"", "", "", "2749", "4518", "7266", "38", "", "", "309", "529",
"8143", "", "", "169", "568", "327", "1064", "-281", "783", "26",
"203", "166", "73", "63", "1314", "9457", "", "", "", "", "24",
"35", "", "", "4038", "4097", "", "", "70", "", "204", "41",
"68", "383", "4480", "", "0", "", "", "", "", "4977", "4977",
"9457")), .Names = c("V1", "V2", "V3", "V4", "V5", "V6", "V7",
"V8", "V9", "V10", "V11"), class = "data.frame", row.names = c(NA,
-56L)), Alphabet = structure(list(V1 = c("Fiscal year ends in December. USD in millions except per share data.",
"Assets", "Current assets", "Cash", "Cash and cash equivalents",
"Short-term investments", "Total cash", "Receivables", "Inventories",
"Deferred income taxes", "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", "Other long-term assets",
"Total non-current assets", "Total assets", "Liabilities and stockholders' equity",
"Liabilities", "Current liabilities", "Short-term debt", "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",
"Deferred revenues", "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"
), V2 = c("2017-12", "", "", "", "10715", "91156", "101871",
"18336", "749", "", "", "3352", "124308", "", "", "59647", "-17264",
"42383", "7813", "16747", "2692", "680", "2672", "72987", "197295",
"", "", "", "", "", "3137", "881", "5464", "1432", "13269", "24183",
"", "3943", "26", "430", "340", "15871", "20610", "44793", "",
"40247", "", "113247", "-992", "152502", "197295"), V3 = c("2016-12",
"", "", "", "12918", "73415", "86333", "14137", "268", "", "4575",
"95", "105408", "", "", "47527", "-13293", "34234", "5878", "16468",
"3307", "383", "1819", "62089", "167497", "", "", "", "", "",
"2041", "554", "4198", "1099", "8864", "16756", "", "3935", "",
"226", "202", "7342", "11705", "28461", "", "36307", "", "105131",
"-2402", "139036", "167497"), V4 = c("2015-12", "", "", "", "16549",
"56517", "73066", "11556", "", "", "3139", "2353", "90114", "",
"", "40146", "-11130", "29016", "5183", "15869", "3847", "251",
"3181", "57347", "147461", "", "", "", "3000", "225", "1931",
"302", "7097", "788", "5967", "19310", "", "1995", "", "189",
"151", "5485", "7820", "27130", "", "32982", "", "89223", "-1874",
"120331", "147461"), V5 = c("2014-12", "", "", "", "18347", "46048",
"64395", "9383", "", "1322", "3412", "2173", "80685", "", "",
"32746", "-8863", "23883", "3079", "15599", "4607", "", "3280",
"50448", "131133", "", "", "", "1999", "10", "1715", "96", "6386",
"752", "5847", "16805", "", "2992", "236", "1971", "104", "4525",
"9828", "26633", "", "28767", "", "75706", "27", "104500", "131133"
), V6 = c("2013-12", "", "", "", "18898", "39819", "58717", "8882",
"426", "1526", "2827", "508", "72886", "", "", "23837", "-7313",
"16524", "1976", "11492", "6066", "", "1976", "38034", "110920",
"", "", "", "3000", "9", "2453", "24", "5484", "1062", "3876",
"15908", "", "1990", "246", "1947", "139", "3381", "7703", "23611",
"", "25922", "", "61262", "125", "87309", "110920"), V7 = c("2012-12",
"", "", "", "14778", "33310", "48088", "7885", "505", "1144",
"2132", "700", "60454", "", "", "17697", "-5843", "11854", "1469",
"10537", "7473", "", "2011", "33344", "93798", "", "", "", "2549",
"", "2012", "240", "4729", "895", "3912", "14337", "", "2988",
"", "1872", "100", "2786", "7746", "22083", "", "22835", "",
"48342", "538", "71715", "93798"), V8 = c("2011-12", "", "",
"", "9983", "34643", "44626", "5427", "", "215", "1745", "745",
"52758", "", "", "14400", "-4797", "9603", "790", "7346", "1578",
"", "499", "19816", "72574", "", "", "", "1218", "", "588", "197",
"2538", "547", "3825", "8913", "", "2986", "", "287", "44", "2199",
"5516", "14429", "", "20264", "", "37605", "276", "58145", "72574"
), V9 = c("2010-12", "", "", "", "13630", "21345", "34975", "4252",
"", "259", "1326", "750", "41562", "", "", "11771", "-4012",
"7759", "523", "6256", "1044", "265", "442", "16289", "57851",
"", "", "", "3465", "", "483", "37", "3256", "394", "2361", "9996",
"", "", "", "", "35", "1579", "1614", "11610", "", "18235", "",
"27868", "138", "46241", "57851"), V10 = c("2009-12", "", "",
"", "10198", "14287", "24485", "3178", "", "644", "836", "23",
"29167", "", "", "8130", "-3286", "4845", "129", "4903", "775",
"263", "416", "11330", "40497", "", "", "", "", "", "216", "",
"1264", "285", "982", "2747", "", "", "", "", "42", "1703", "1745",
"4493", "", "0", "15817", "20082", "105", "36004", "40497"),
V11 = c("2008-12", "", "", "", "8657", "7189", "15846", "2642",
"", "286", "1404", "", "20178", "", "", "7576", "-2342",
"5234", "85", "4840", "997", "", "434", "11589", "31768",
"", "", "", "", "", "178", "82", "1013", "218", "812", "2302",
"", "", "", "13", "30", "1184", "1227", "3529", "", "0",
"14450", "13562", "227", "28239", "31768")), .Names = c("V1",
"V2", "V3", "V4", "V5", "V6", "V7", "V8", "V9", "V10", "V11"), class = "data.frame", row.names = c(NA,
-51L))), .Names = c("Alibaba", "Alphabet"))
Вопрос 2:
Второй вопрос аналогичен, но делает вычисления по спискам, например, взяв Depreciation & amortization
из IS
список делится на Revenue
из списка BS
.
IS
Данные 2:
IS <- structure(list(Alibaba = structure(list(V1 = c("Cash Flows From Operating Activities",
"Depreciation & amortization", "Amortization of debt discount/premium and issuance costs",
"Investment/asset impairment charges", "Investments losses (gains)",
"Deferred income taxes", "Stock based compensation", "Prepaid expenses",
"Accounts payable", "Accrued liabilities", "Income taxes payable",
"Other working capital", "Other non-cash items", "Net cash provided by operating activities",
"Cash Flows From Investing Activities", "Investments in property, plant, and equipment",
"Property, plant, and equipment reductions", "Acquisitions, net",
"Purchases of investments", "Sales/Maturities of investments",
"Purchases of intangibles", "Other investing charges", "Net cash used for investing activities",
"Cash Flows From Financing Activities", "Short-term borrowing",
"Long-term debt issued", "Long-term debt repayment", "Excess tax benefit from stock based compensation",
"Common stock issued", "Preferred stock issued", "Redemption of preferred stock",
"Repurchases of treasury stock", "Cash dividends paid", "Other financing activities",
"Net cash provided by (used for) financing activities", "Effect of exchange rate changes",
"Net change in cash", "Cash at beginning of period", "Cash at end of period",
"Free Cash Flow", "Operating cash flow", "Capital expenditure",
"Free cash flow", "Supplemental schedule of cash flow data"),
TTM = c("", "", "", "", "", "", "", "", "", "", "", "", "135415",
"135415", "", "", "", "", "", "", "", "-141637", "-141637",
"", "", "", "", "", "", "", "", "", "", "33534", "33534",
"-2192", "25120", "148355", "173475", "", "135415", "", "105579",
""), `2018-03` = c("", "22020", "264", "3111", "", "976",
"20075", "-14765", "23158", "", "6610", "7079", "56643",
"125171", "", "-25809", "", "-547", "-12602", "7223", "-4027",
"-48128", "-83890", "", "-4199", "46996", "-9452", "", "399",
"", "", "", "", "-13385", "20359", "-6067", "55573", "143736",
"199309", "", "125171", "-29836", "95335", ""), `2017-03` = c("",
"14292", "264", "3155", "", "281", "15995", "-8237", "5312",
"", "4698", "5486", "39080", "80326", "", "-12220", "", "-33204",
"2321", "4354", "-5326", "-34289", "-78364", "", "1127",
"28381", "-175", "1369", "14694", "", "", "-13182", "", "700",
"32914", "2042", "36918", "106818", "143736", "", "80326",
"-17546", "62780", ""), `2016-03` = c("", "6701", "264",
"2319", "", "1226", "16082", "-4012", "", "", "1237", "10567",
"22452", "56836", "", "-5438", "", "3395", "-52988", "16826",
"-5407", "781", "-42831", "", "1859", "765", "-146", "1120",
"693", "", "", "-19795", "", "-342", "-15846", "466", "-1375",
"108193", "106818", "", "56836", "-10845", "45991", ""),
`2015-03` = c("", "4415", "166", "175", "", "1659", "13028",
"-2253", "", "", "1410", "2697", "19920", "41217", "", "-4770",
"", "-11526", "-36360", "1038", "-2935", "1099", "-53454",
"", "1070", "156781", "-131807", "", "61831", "", "", "-270",
"-104", "-4", "87497", "-112", "75148", "33045", "108193",
"", "41217", "-7705", "33512", ""), `2014-03` = c("", "1654",
"", "44", "-90", "1466", "2844", "-3567", "", "3992", "1008",
"-5926", "24954", "26379", "", "-3285", "", "-778", "-27891",
"461", "-1491", "-13", "-32997", "", "258", "83348", "-70817",
"", "2080", "", "-5131", "-157", "-208", "-9", "9364", "-97",
"2649", "30396", "33045", "", "26379", "-4776", "21603",
""), `2013-03` = c("", "935", "", "175", "", "104", "1259",
"-354", "", "", "-116", "3606", "8867", "14476", "", "-1046",
"301", "499", "-512", "2770", "-1457", "-10", "545", "",
"-145", "33684", "-6607", "", "16792", "10542", "", "-40111",
"-103", "-15458", "-1406", "-76", "13539", "16857", "30396",
"", "14476", "-2503", "11973", ""), `2012-03` = c("", "870",
"", "135", "138", "150", "1254", "-240", "", "1332", "230",
"466", "4940", "9275", "", "-749", "1", "-211", "-1269",
"5935", "-1419", "-2413", "-125", "", "121", "229", "-229",
"", "618", "", "", "-421", "", "157", "475", "-54", "9571",
"7286", "16857", "", "9275", "-2168", "7107", ""), `2011-12` = c("",
"253", "1", "3", "-6", "", "336", "-161", "0", "", "", "168",
"1587", "2182", "", "-160", "3", "9", "-9529", "7937", "-12",
"167", "-1585", "", "", "1426", "-279", "", "55", "", "",
"-418", "-948", "-81", "-244", "-5", "347", "3086", "3433",
"", "2182", "-172", "2010", ""), `2010-12` = c("", "227",
"", "", "", "", "341", "", "", "", "", "1031", "-1599", "",
"", "-288", "1", "-276", "-8114", "5805", "-6", "131", "-2747",
"", "94", "", "", "", "10", "", "", "-53", "", "", "51",
"-6", "-2702", "2749", "47", "", "", "-294", "", ""), `2009-12` = c("",
"127", "", "", "", "", "238", "", "", "", "", "926", "950",
"2240", "", "-411", "3", "-415", "-1426", "850", "-411",
"587", "-1222", "", "", "", "", "", "0", "", "", "-70", "-888",
"", "-958", "-0", "60", "2689", "2749", "", "2240", "-411",
"1829", "")), .Names = c("V1", "TTM", "2018-03", "2017-03",
"2016-03", "2015-03", "2014-03", "2013-03", "2012-03", "2011-12",
"2010-12", "2009-12"), row.names = 2:45, class = "data.frame"),
Alphabet = structure(list(V1 = c("Cash Flows From Operating Activities",
"Net income", "Depreciation & amortization", "Investment/asset impairment charges",
"Investments losses (gains)", "Deferred income taxes", "Stock based compensation",
"Change in working capital", "Accounts receivable", "Inventory",
"Prepaid expenses", "Accounts payable", "Accrued liabilities",
"Income taxes payable", "Other working capital", "Other non-cash items",
"Net cash provided by operating activities", "Cash Flows From Investing Activities",
"Investments in property, plant, and equipment", "Property, plant, and equipment reductions",
"Acquisitions, net", "Purchases of investments", "Sales/Maturities of investments",
"Purchases of intangibles", "Other investing activities",
"Net cash used for investing activities", "Cash Flows From Financing Activities",
"Debt issued", "Debt repayment", "Common stock issued", "Common stock repurchased",
"Excess tax benefit from stock based compensation", "Other financing activities",
"Net cash provided by (used for) financing activities", "Effect of exchange rate changes",
"Net change in cash", "Cash at beginning of period", "Cash at end of period",
"Free Cash Flow", "Operating cash flow", "Capital expenditure",
"Free cash flow"), TTM = c("", "16308", "7887", "", "-3888",
"-437", "8537", "13586", "-2811", "", "", "589", "8450",
"", "7358", "-79", "41914", "", "-20621", "94", "", "-77343",
"66850", "-1578", "", "-32598", "", "10527", "-10588", "320",
"-6326", "", "-4772", "-10839", "-40", "-1563", "15711",
"14148", "", "41914", "-22199", "19715"), `2017-12` = c("",
"12662", "6915", "", "194", "258", "7679", "9246", "-3768",
"", "", "731", "5846", "", "6437", "137", "37091", "", "-13184",
"99", "", "-93940", "74492", "-287", "1419", "-31401", "",
"4291", "-4377", "800", "-4846", "", "-4166", "-8298", "405",
"-2203", "12918", "10715", "", "37091", "-13471", "23620"
), `2016-12` = c("", "19478", "6144", "", "275", "-38", "6703",
"3300", "-2578", "", "312", "110", "2108", "", "3348", "174",
"36036", "", "-10212", "240", "", "-85618", "67839", "-986",
"-2428", "-31165", "", "8729", "-10064", "", "-3693", "",
"-3304", "-8332", "-170", "-3631", "16549", "12918", "",
"36036", "-11198", "24838"), `2015-12` = c("", "16348", "5063",
"", "334", "-179", "5203", "-409", "-2094", "", "-318", "203",
"1936", "", "-136", "-336", "26024", "", "-9915", "", "",
"-76540", "63330", "-236", "-350", "-23711", "", "13705",
"-13728", "", "-1780", "548", "-2422", "-3677", "-434", "-1798",
"18347", "16549", "", "26024", "-10151", "15873"), `2014-12` = c("",
"14444", "4979", "", "-285", "-104", "4279", "364", "-1641",
"", "459", "436", "1002", "", "108", "-1301", "22376", "",
"-10959", "", "386", "-58312", "51315", "-4888", "1403",
"-21055", "", "11625", "-11643", "", "", "648", "-2069",
"-1439", "-433", "-551", "18898", "18347", "", "22376", "-15847",
"6529"), `2013-12` = c("", "12920", "3939", "", "", "-437",
"3343", "-31", "-1307", "-234", "-696", "605", "967", "",
"634", "-1075", "18659", "", "-7358", "", "2525", "-46013",
"38914", "-1448", "-299", "-13679", "", "10768", "-11325",
"", "", "481", "-781", "-857", "-3", "4120", "14778", "18898",
"", "18659", "-8806", "9853"), `2012-12` = c("", "10737",
"2962", "", "", "-266", "2692", "898", "-787", "301", "-833",
"-499", "1061", "", "1655", "-404", "16619", "", "-3273",
"", "", "-34106", "35225", "-10568", "-334", "-13056", "",
"16109", "-14781", "", "", "188", "-287", "1229", "3", "4795",
"9983", "14778", "", "16619", "-13841", "2778"), `2011-12` = c("",
"9737", "1851", "110", "", "343", "1974", "630", "-1156",
"", "-262", "101", "1054", "", "893", "-80", "14565", "",
"-3438", "", "-1900", "-62095", "48746", "", "-354", "-19041",
"", "10905", "-10179", "", "", "86", "-5", "807", "22", "-3647",
"13630", "9983", "", "14565", "-3438", "11127"), `2010-12` = c("",
"", "1396", "", "", "9", "1376", "-99", "-1129", "", "-414",
"272", "959", "102", "111", "8399", "11081", "", "-4018",
"", "-1067", "-45055", "37099", "", "2361", "-10680", "",
"5246", "-1783", "", "-801", "94", "294", "3050", "-19",
"3432", "10198", "13630", "", "11081", "-4018", "7063"),
`2009-12` = c("", "6520", "1524", "", "", "-268", "1164",
"486", "-504", "", "262", "34", "401", "217", "76", "-111",
"9316", "", "-810", "", "-108", "-29204", "22103", "",
"", "-8019", "", "", "", "", "", "90", "143", "233",
"11", "1541", "8657", "10198", "", "9316", "-810", "8506"
), `2008-12` = c("", "4227", "1500", "1095", "", "-225",
"1120", "327", "-334", "", "-147", "-212", "353", "",
"667", "-191", "7853", "", "-2358", "", "-3320", "-15403",
"15763", "", "", "-5319", "", "", "", "", "", "159",
"-72", "88", "-46", "2575", "6082", "8657", "", "7853",
"-2358", "5494")), .Names = c("V1", "TTM", "2017-12",
"2016-12", "2015-12", "2014-12", "2013-12", "2012-12", "2011-12",
"2010-12", "2009-12", "2008-12"), row.names = 2:43, class = "data.frame")), .Names = c("Alibaba",
"Alphabet"))
Я могу опубликовать то, что у меня есть, но это никуда меня не приведет.