SHARE
TWEET

Untitled

a guest Jun 25th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. group_exports_g.rate <- baci_exports %>% ungroup() %>%
  2.   group_by(group,sna,t) %>% summarise(exports = sum(exports),
  3.                                       n= sum(n)) %>% ungroup() %>%
  4.   group_by(group,sna,t) %>% arrange(group,sna,t) %>%
  5.   mutate(gr.exports = 100*((exports/lag(exports,1))-1))
  6.      
  7. dput(baci_exports)
  8.  
  9. structure(list(t = c(1995, 1995, 1995, 1995, 1995, 1995, 1995,
  10. 1995, 1995, 1995, 1995, 1995, 1995, 1995, 1995, 1995, 1995, 1995,
  11. 1995, 1995), i = c(4, 4, 4, 4, 4, 4, 4, 8, 8, 8, 8, 8, 8, 8,
  12. 8, 12, 12, 12, 12, 12), sna = c("Capital goods", "Consumer goods",
  13. "Fuels and lubricants", "Intermediate goods", "Parts and accessories of capital goods",
  14. "Passenger motor cars", "Primary goods", "Capital goods", "Consumer goods",
  15. "Fuels and lubricants", "Goods not elsewhere specified", "Intermediate goods",
  16. "Parts and accessories of capital goods", "Passenger motor cars",
  17. "Primary goods", "Capital goods", "Consumer goods", "Fuels and lubricants",
  18. "Intermediate goods", "Parts and accessories of capital goods"
  19. ), exports = c(1195.2624224154, 22997.0533036558, 5.3693833059,
  20. 9720.564817782, 183.9809856813, 111.2556313572, 47976.2051093033,
  21. 5711.1685900189, 120659.569187797, 2264.5410811663, 75.806, 60184.2530566294,
  22. 2249.821, 280.439, 36458.4499193458, 30316.017597217, 150361.471507771,
  23. 8686043.01945958, 448718.59940394, 6633.9115459232), n = c(36L,
  24. 207L, 1L, 137L, 30L, 5L, 58L, 143L, 654L, 5L, 3L, 322L, 57L,
  25. 12L, 143L, 270L, 364L, 106L, 563L, 150L), name_baci = c("Afghanistan",
  26. "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan",
  27. "Afghanistan", "Albania", "Albania", "Albania", "Albania", "Albania",
  28. "Albania", "Albania", "Albania", "Algeria", "Algeria", "Algeria",
  29. "Algeria", "Algeria"), cntry = c("Afghanistan", "Afghanistan",
  30. "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan",
  31. "Albania", "Albania", "Albania", "Albania", "Albania", "Albania",
  32. "Albania", "Albania", "Algeria", "Algeria", "Algeria", "Algeria",
  33. "Algeria"), group = c("Afghanistan", "Afghanistan", "Afghanistan",
  34. "Afghanistan", "Afghanistan", "Afghanistan", "Afghanistan", "SE",
  35. "SE", "SE", "SE", "SE", "SE", "SE", "SE", "Algeria", "Algeria",
  36. "Algeria", "Algeria", "Algeria")), row.names = c(NA, -20L), class = c("grouped_df",
  37. "tbl_df", "tbl", "data.frame"), groups = structure(list(t = c(1995,
  38. 1995, 1995), i = c(4, 8, 12), .rows = list(1:7, 8:15, 16:20)), row.names = c(NA,
  39. -3L), class = c("tbl_df", "tbl", "data.frame"), .drop = TRUE))
  40. >
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top