SHARE
TWEET

Untitled




Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- Pquestao = function(datat){
- print(data.frame(datat))
- }
- Qquestao = function(datat){
- aux = which(duplicated(datat$Artista))
- for(i in 1:length(aux)){
- for(k in 1:nrow(datat)){
- if(datat$Artista[aux[i]] == datat$Artista[k]){
- aux[length(aux) + 1] = k;
- k = nrow(datat);
- }
- }
- }
- artist = 0;
- desvioartist = 0;
- aux = (unique(aux))
- length(aux)
- pararloop = 0
- #print(aux)
- aux = sort(aux)
- #print(aux)
- #print(aux[13])
- for(i in 1:length(aux)){
- if(pararloop == 0){
- added = 1;
- auxdesvio <- c(-1)
- mds = i + 1;
- mds2 = length(aux)
- for(k in mds:mds2){
- #print(i)
- #print(k)
- #print(aux[i])
- #print(aux[k])
- #print(datat$Artista[aux[i]])
- #print(datat$Artista[aux[k]])
- if(k > length(aux) || i > length(aux)){
- #print('j')
- }else if (aux[k] < 0 || aux[i] < 0){
- }else{
- if(datat$Artista[aux[i]] == datat$Artista[aux[k]] && i != k){
- auxdesvio[added] = aux[k]
- aux[k] = -1;
- added = added + 1;
- }
- }
- }
- if(i == length(aux)){
- pararloop = 1;
- }
- auxdesvio1 <- c(-1)
- auxdesvio[added] = aux[i]
- #print(auxdesvio)
- if(auxdesvio[1] == -1){
- }else{
- for(i in 1:length(auxdesvio)){
- auxdesvio1[i] = datat$Qnt..de.Albuns.Vendidos[auxdesvio[i]]
- }
- #print(auxdesvio1)
- desvioatual = sd(auxdesvio1, na.rm = FALSE)
- #print(desvioatual)
- if(desvioatual < desvioartist || desvioartist == 0){
- desvioartist = desvioatual;
- artist = auxdesvio[1]
- }
- }
- }
- }
- #print(desvioartist)
- print(datat$Artista[artist])
- }
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.