<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div style="font-size: 12pt; "><span>Boa tarde a todos, tenho um bd com estas variáveis</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><span><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; ">> names(ccq)</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "> [1] "Grupo" "EA"    "EB"    "EC"    "ED"    "EE"    "EF"    "EG"
    "EH"    "EI"    "EJ"    "PA"    "PB"    "PC"    "PD"    "PE"    "PF"    "PG"    "PH"    "PI"    "PJ"    "AA"   </div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; ">[23] "AB"    "AC"    "AD"    "AE"    "AF"    "AG"    "AH"    "AI"    "AJ"    "Nome"  "Turno" "cargo" "Sexo"  "te"    "tc"    "t_ccq" "esc"   "Tipo" </div><div><br></div></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><span>Criei uma funçao: </span></div><div style="color: rgb(0, 0, 0); font-size: 16px;
 font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><span><div style="margin: 0.0px 0.0px 0.0px 0.0px; font: 24.0px Helvetica; color: #c3892a"><span style="color: #000000">eda</span><span style="color: #0d2099"><-</span>function<span style="color: #0d2099">(</span><span style="color: #000000">x</span><span style="color: #0d2099">){</span></div>
<div style="margin: 0.0px 0.0px 0.0px 0.0px; font: 24.0px Helvetica"><span class="Apple-tab-span" style="white-space:pre">    </span>média<span style="color: #0d2099"><-mean(</span>x<span style="color: #0d2099">,</span>na.rm<span style="color: #0d2099">=</span><span style="color: #c3892a">T</span><span style="color: #0d2099">)</span></div>
<div style="margin: 0.0px 0.0px 0.0px 0.0px; font: 24.0px Helvetica"><span class="Apple-tab-span" style="white-space:pre">    </span>desvio<span style="color: #0d2099"><-sd(</span>x<span style="color: #0d2099">,</span>na.rm<span style="color: #0d2099">=</span><span style="color: #c3892a">T</span><span style="color: #0d2099">)</span></div>
<div style="margin: 0.0px 0.0px 0.0px 0.0px; font: 24.0px Helvetica"><span class="Apple-tab-span" style="white-space:pre">    </span>cv<span style="color: #0d2099"><-</span>desvio<span style="color: #0d2099">/</span>média<span style="color: #0d2099">*</span><span style="color: #065118">100</span></div>
<div style="margin: 0.0px 0.0px 0.0px 0.0px; font: 24.0px Helvetica"><span class="Apple-tab-span" style="white-space:pre">    </span><span style="color: #0d2099">cbind(</span>média<span style="color: #0d2099">,</span>desvio<span style="color: #0d2099">,</span>cv<span style="color: #0d2099">)</span></div>
<div style="margin: 0.0px 0.0px 0.0px 0.0px; font: 24.0px Helvetica; color: #0d2099">}</div><div><br></div></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><span>Como faço para obter estas medidas de uma única vez para todas variáveis numérias por exemplo por turno que tem 3 níveis: 1,2,Com.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><span>Fiz no aggregate e me dar esta saída(pequena
 amostra)</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><span><br></span></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><span><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; ">> ag<-aggregate(. ~ Turno, data = ccq, eda)</div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; ">> ag</div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><span
 class="Apple-style-span" style="font-size: 16px; "> </span><font class="Apple-style-span" size="1">Turno Grupo.1 Grupo.2 Grupo.3 EA.1 EA.2 EA.3  EB.1  EB.2  EB.3 EC.1 EC.2 EC.3  ED.1  ED.2  ED.3 EE.1 EE.2 EE.3  EF.1  EF.2  EF.3  EG.1  EG.2  EG.3  EH.1  EH.2  EH.3 EI.1 EI.2</font></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><font class="Apple-style-span" size="1"><b>1 </b>    1       1       0       0  8.0  1.4 17.8  7.83  2.31 29.51  7.8  1.7 21.3  8.48  1.20 14.17  8.3  1.7 20.0  9.13  0.97 10.60  9.00  1.21 13.40  8.43  1.62 19.19  7.6  1.5</font></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif;
 background-color: transparent; font-style: normal; "><font class="Apple-style-span" size="1"><b>2</b>     2       1       0       0  8.2  1.1 13.3  9.44  0.88  9.34  8.9  1.4 15.3  8.78  0.83  9.49  8.8  1.3 14.8  8.78  1.72 19.55  8.67  1.66 19.13  9.56  0.88  9.23  8.6  1.5</font></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><font class="Apple-style-span" size="1"><b>3</b>   Com       1       0       0  7.8  1.1 14.2  8.11  1.50 18.52  8.0  1.2 15.4  8.33  1.21 14.51  8.2  1.7 20.3  9.15  0.95 10.37  9.22  0.93 10.12  8.81  1.18 13.36  8.0  1.3</font></div><div
 style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><font class="Apple-style-span" size="1">  EI.3  EJ.1  EJ.2  EJ.3 PA.1 PA.2 PA.3 PB.1 PB.2 PB.3 PC.1 PC.2 PC.3 PD.1 PD.2 PD</font></div></div><div style="font-size: 16px; "><br></div></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><span>Vejam que por exemplo, EA.1 EA.2 EA.3 são respectivamente a média, desvio e cv.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><span><br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; ">Como melhorar esta saída, dando nomes a EA.1, EA.2,EA.3</div><div
 style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; "><br></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: arial, helvetica, sans-serif; background-color: transparent; font-style: normal; ">Talvez um loop?</div><div style="font-size: 12pt; "></div><div style="font-size: 12pt; "> </div><div style="font-size: 12pt; ">[ ]'s.</div><div style="font-size: 12pt; ">Edson Lira<br>Estatístico<br>Manaus-Amazonas</div></div></body></html>