Advertisement
Guest User

Untitled

a guest
Jun 15th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. > df
  2. NO2 Month
  3. 1 23 01
  4. 2 27 01
  5. 3 16 01
  6. 4 13 01
  7. 5 26 01
  8. 6 23 01
  9. 7 51 01
  10. 8 46 01
  11. 9 21 01
  12. 10 18 01
  13. 11 13 01
  14. 12 22 01
  15. 13 47 01
  16. 14 60 01
  17. 15 49 01
  18. 16 76 01
  19. 17 38 01
  20. 18 24 01
  21. 19 15 01
  22. 20 20 01
  23. 21 33 01
  24. 22 17 01
  25. 23 19 01
  26. 24 20 01
  27. 25 25 01
  28. 26 46 01
  29. 27 53 01
  30. 28 41 01
  31. 29 54 01
  32. 30 28 01
  33. 31 28 01
  34. 32 51 02
  35. 33 61 02
  36. 34 56 02
  37. 35 57 02
  38. 36 30 02
  39. 37 12 02
  40. 38 27 02
  41. 39 13 02
  42. 40 35 02
  43. 41 40 02
  44. 42 40 02
  45. 43 47 02
  46. 44 72 02
  47. 45 55 02
  48. 46 30 02
  49. 47 10 02
  50. 48 29 02
  51. 49 50 02
  52. 50 39 02
  53. 51 61 02
  54. 52 56 02
  55. 53 44 02
  56. 54 46 02
  57. 55 35 02
  58. 56 34 02
  59. 57 41 02
  60. 58 39 02
  61. 59 39 02
  62. 60 27 03
  63. 61 48 03
  64. 62 36 03
  65. 63 40 03
  66. 64 41 03
  67. 65 45 03
  68. 66 46 03
  69. 67 43 03
  70. 68 55 03 (...)
  71.  
  72. df=data.frame(data)
  73. df$Month=as.numeric(format(data$date,format="%m"))
  74. df=df%>%select(c("NO2","Month"))
  75.  
  76. df=reshape(df,idvar=c("NO2","Month"),direction="wide",timevar="Month")
  77. warnings() ## here i have first errors (will show them in below)
  78.  
  79. df=spread(df,Month,NO2) ## have problems here also
  80.  
  81. df=spread(df,df$Month,df$NO2) ## and here also
  82.  
  83. 1: In reshapeWide(data, idvar = idvar, timevar = timevar, ... :
  84. multiple rows match for Month=1: first taken
  85.  
  86. Error in eval_tidy(enquo(var), var_env) : object 'Month' not found
  87.  
  88. Error: "var" must evaluate to a single number or a column name, not NULL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement