• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

HugoCzerniawski Feb 14th, 2020 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. library(ggplot2)
2. library(tidyverse)
3. library(zoo)
4. #pd <- import('pandas')
5.
6.
7. dataFramesConversion <- function(index){
8.   df <- data.frame()
9.   start=3+14*(index -1)
10.   end=16+14*(index -1)
11.
12.   for(i in 1:12)
13.     df <- rbind(df,data.frame(matrix(unlist(AAAdata[(start+14*10*(i-1)):(end+14*10*(i-1))]),nrow = 17)))
14.
15.   return(df)
16. }
17.
18.
19. voivodeshipYearAverage <- function(Frame){
20.   means <- data.frame()
21.   for(j in 1:17){
22.     numbers <- list(0,0,0,0,0,0,0,0,0,0,0,0,0,0)
23.     for(i in 1:12){
24.       numbers <- mapply("+", numbers, Frame[j+17*(i-1),] , SIMPLIFY = FALSE)
25.     }
26.     #  print(data.frame(matrix(unlist(numbers),nrow =1)))
27.     means <- rbind(means,data.frame(matrix(unlist(numbers),nrow =1)))
28.   }
29.
30.   return (list(unlist(numbers)/12))
31. }
32.
33.
34. #View(data)
35. #name(data)
36.
37. #df <- data.frame(matrix(unlist(data[3:16]),nrow = 17))
38. #view(df)
39. main <- function(){
40.   AAAdata<-(read.csv(file = ".\\CENY_2917_CTAB_20200213132521.csv",header = TRUE,sep = ';', dec = ',', stringsAsFactors = FALSE, encoding = 'UTF-8'))
43.                     "Warminsko-Mazurskie","Wielkopolskie","Zachodniopomorskie")
44.   years <- c("2006","2007","2008","2009","2010","2011","2012","2013","2014","2015","2016","2017","2018","2019")
45.
46.   Ryz <- dataFramesConversion(1)
47.   RyzAvg <- voivodeshipYearAverage(Ryz)
48.
49.   Rostbef <- dataFramesConversion(2)
50.   RostbefAvg <- voivodeshipYearAverage(Rostbef)
51.
52.   Szynka <- dataFramesConversion(3)
53.   SzynkaAvg <- voivodeshipYearAverage(Szynka)
54.
55.   Mleko <- dataFramesConversion(4)
56.   MlekoAvg <- voivodeshipYearAverage(Mleko)
57.
58.   Jaja <- dataFramesConversion(5)
59.   JajaAvg <- voivodeshipYearAverage(Jaja)
60.
61.   Garnitur <- dataFramesConversion(6)
62.   GarniturAvg <- voivodeshipYearAverage(Garnitur)
63.
64.   Rajstopy <- dataFramesConversion(7)
65.   RajstopyAvg <- voivodeshipYearAverage(Rajstopy)
66.
67.   Spodnie <- dataFramesConversion(8)
68.   SpodnieAvg <- voivodeshipYearAverage(Spodnie)
69.
70.   podzelowanieObuwia <- dataFramesConversion(9)
71.   podzelowanieObuwiaAvg <- voivodeshipYearAverage(podzelowanieObuwia)
72.
73.   Pasta <- dataFramesConversion(10)
74.   PastaAvg <- voivodeshipYearAverage(Pasta)
75.
76.   return()
77. }
78.
79. main()
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.
Top