<div dir="ltr">Antonio,<br><div><br>Seu subset não está definido corretamente... deve ser: variable %in% c("ninfa", "pulpa").<br><br></div><div>att,<br></div><div>FH<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-08-16 12:11 GMT-05:00 Antonio Moita via R-br <span dir="ltr"><<a href="mailto:r-br@listas.c3sl.ufpr.br" target="_blank">r-br@listas.c3sl.ufpr.br</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:13px"><div id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6331" dir="ltr"># Suponha o sequinte experimento em blocos ao acaso<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6476"># com tamanho da parcela experimental de 4 plantas<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6477"># no qual se conta o número pulpas ninfas e ovos.<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6478"><br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6479"># GOSTARIA DE OBTER O CONJUNTO DE DADOS QUE FOSSE A SOMA DE PLANTAS POR CULTIVAR BLOCOS,<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6480"># QUANDO USO TODO CONJUNTO DE DADOS FUNCIONA BEM<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6481"><br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6482"><br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6483"><br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6484">require(reshape)<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6485"> <br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6486"><br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6487">x<-factor(LETTERS[1:3])<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6488">cultivar<-rep(x, each=6)<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6489">bloco<-rep(1:2,each=3)<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6490">planta<-rep(1:3)<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6491"> <br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6492">ninfa<-c(0,0,0,1,1,1,0,0,0,1,<wbr>2,3,0,1,2,0,0,1)<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6493">pulpa<-c(1,0,1,1,0,1,0,0,0,0,<wbr>0,0,0,2,1,0,0,4)<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6494">ovos<-c(2,2,0,3,0,0,0,0,4,0,0,<wbr>0,0,2,0,0,0,0)<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6495"><br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6496">df<-data.frame(cultivar, bloco, planta, ninfa, pulpa, ovos)<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6497"><br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6498"><br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6499">df.m<-melt(df, id=c("cultivar","bloco","<wbr>planta"))<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6500">df.m<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6501"><br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6502">df.c<-cast(df.m, cultivar + bloco ~ variable, sum, na.rm=TRUE )<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6503">df.c<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6504"><br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6505"># MAS QUANDO SELECIONO SÓ UMA PARTE<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6506"># OS VALORES NÃO BATEM COM O QUADRO ANTERIOR, ALGUEM SABERIA EXPLICAR ????<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6507">df.c1<-cast(df.m, cultivar + bloco ~ variable, subset=variable==c("ninfa","<wbr>pulpa"), sum)<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6508">df.c1<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6509"><br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6510"># a SOMA DE ninfa e pulpa tambem esta errada<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6511">df.c0<-cast(df.m, cultivar + bloco ~ ., subset=variable==c("ninfa","<wbr>pulpa"), sum)<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6512">df.c0<br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6513"><br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6514"> <br id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6515">Att</div><div dir="ltr" id="m_780526725815165376yui_3_16_0_ym19_1_1502903380287_6524">Antonio W Moita</div><div dir="ltr">Embrapa Hortaliças<br></div></div></div><br>______________________________<wbr>_________________<br>
R-br mailing list<br>
<a href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a><br>
<a href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br" rel="noreferrer" target="_blank">https://listas.inf.ufpr.br/<wbr>cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a href="http://www.leg.ufpr.br/r-br-guia" rel="noreferrer" target="_blank">http://www.leg.ufpr.br/r-br-<wbr>guia</a>) e forneça código mínimo reproduzível.<br></blockquote></div><br></div>