avatar
Untitled

Oaspete 168 18th Apr, 2019

                                           
                         x = scan("sample1.txt")

stem(x)

tablou1 = read.csv("unemploy2012.csv", header = T, sep = ';')

rate = tablou1[['rate']]



interval = c(0, 4, 6, 8, 10, 12, 14, 30)

hist(rate, breaks = interval, right = T, freq = F, col = "blue")



tablou = read.csv("life_expect.csv", header = T, sep = ",")

life_man = tablou[['male']]

life_female = tablou[['female']]



hist(life_man, breaks = 7, right = F, freq = F, col = "green")

hist(life_female, breaks = 7, right = F, freq = F, col = "pink")


temp = scan("sample1.txt")

mean(temp)

median(temp)


mean(life_man)  

median(life_man)



mean(life_female)

median(life_female)


maxim=0
d = sort(temp)
answer=d[1]
cont=1
val=d[1]
for(i in 2:length(temp))
{
  if(d[i] == val) cont = cont+1
  if(d[i] != val)
  {
    if(cont > maxim)
    {
      maxim = cont
      answer= d[i-1]
    }
    cont = 1
  }
}
print(answer)
sort(temp)


outliers_mean = function(esantion)
{
  medie = mean(esantion)
  derivatiaStandard = sd(esantion)
  aux = vector()
  j = 0
  for( i in 1 : length(esantion))
  {
    if(esantion[i] < medie - 2 * derivatiaStandard | esantion[i] > medie + 2 * derivatiaStandard)
    {
      j = j + 1
      aux[j]=esantion[i]
    }
  }
  return(aux)
}
sample = c(1, 91, 38, 72, 13, 27, 11, 19, 5, 22, 20, 19, 8, 17, 11, 15, 13, 23, 14, 17)
outliers_mean(sample)
                      
                                       
Pentru a distribui această postare, copiați această adresă URL și trimiteți-o prietenilor
RAW Paste Data