Guest User

Untitled

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