Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- x %>%
- group_by(firm) %>%
- select(Var) %>%
- mutate(revenues = price*qty)
- df <- structure(list(firm = c("firm1", "firm1", "firm1", "firm2", "firm2",
- "firm2"), Var = c("price", "qty", "package", "price", "qty",
- "package"), `2018-03` = c("199309", "10901", "210210", "25370",
- "4535", ""), `2017-03` = c("143736", "7065", "150801", "21374",
- "", "652"), `2016-03` = c("106818", "8878", "115696", "11738",
- "", "451"), `2015-03` = c("108193", "17806", "125999", "11163",
- "", "256"), `2014-03` = c("33045", "12029", "45074", "16006",
- "", "191"), `2013-03` = c("30396", "2919", "33315", "4952", "",
- "208"), `2012-03` = c("16857", "5480", "22337", "1315", "", "97"
- ), `2011-12` = c("3433", "8219", "11652", "559", "", ""), `2010-12` = c("3254",
- "6803", "10057", "94", "", ""), `2009-12` = c("2749", "4518",
- "7266", "38", "", "")), .Names = c("firm", "Var", "2018-03",
- "2017-03", "2016-03", "2015-03", "2014-03", "2013-03", "2012-03",
- "2011-12", "2010-12", "2009-12"), row.names = 5:10, class = "data.frame")
Add Comment
Please, Sign In to add comment