• API
• FAQ
• Tools
• Archive
SHARE
TWEET

Untitled

a guest Nov 12th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. Pquestao = function(datat){
2. print(data.frame(datat))
3. }
4.
5. Qquestao = function(datat){
6. aux = which(duplicated(datat\$Artista))
7.
8. for(i in 1:length(aux)){
9.   for(k in 1:nrow(datat)){
10.
11.     if(datat\$Artista[aux[i]] == datat\$Artista[k]){
12.       aux[length(aux) + 1] = k;
13.       k = nrow(datat);
14.     }
15.   }
16. }
17. artist = 0;
18. desvioartist = 0;
19.
20. aux = (unique(aux))
21. length(aux)
22. pararloop = 0
23. #print(aux)
24. aux = sort(aux)
25. #print(aux)
26. #print(aux[13])
27. for(i in 1:length(aux)){
28.   if(pararloop == 0){
30.   auxdesvio <- c(-1)
31.   mds = i + 1;
32.   mds2 = length(aux)
33.   for(k in mds:mds2){
34.     #print(i)
35.     #print(k)
36.     #print(aux[i])
37.     #print(aux[k])
38.     #print(datat\$Artista[aux[i]])
39.     #print(datat\$Artista[aux[k]])
40.     if(k > length(aux) || i > length(aux)){
41.       #print('j')
42.       }else if (aux[k] < 0 || aux[i] < 0){
43.       }else{
44.     if(datat\$Artista[aux[i]] == datat\$Artista[aux[k]] && i != k){
46.       aux[k] = -1;
48.     }
49.   }
50.   }
51.   if(i == length(aux)){
52.     pararloop = 1;
53.   }
54.
55.   auxdesvio1 <- c(-1)
57.   #print(auxdesvio)
58.   if(auxdesvio[1] == -1){
59.
60.   }else{
61.   for(i in 1:length(auxdesvio)){
62.     auxdesvio1[i] = datat\$Qnt..de.Albuns.Vendidos[auxdesvio[i]]
63.   }
64.   #print(auxdesvio1)
65.   desvioatual = sd(auxdesvio1, na.rm = FALSE)
66.   #print(desvioatual)
67.   if(desvioatual < desvioartist || desvioartist == 0){
68.     desvioartist = desvioatual;
69.     artist = auxdesvio[1]
70.   }
71.   }
72.
73.
74. }
75. }
76. #print(desvioartist)
77. print(datat\$Artista[artist])
78.
79.
80. }
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