Dear all, I'm new here, I'm starting to learn R (oh my God!!). So, now I'm in panic because I have this situation: TIPO Avariato A 0.05 B 0.09 A 9 B 8 A 9 B 3 and this is what I would like to do: Avariato A B Avariato 0.05 0.09 Avariato 9 8 Avariato 9 3 I don't know how to do it. I need to use reshape? how? thanks for your reply. Spigo -- View this message in context: http://r.789695.n4.nabble.com/Reshape-I-need-it-tp2314700p2314700.html Sent from the R help mailing list archive at Nabble.com.
Hello, For that simple case you could just do... newdf <- data.frame(A=df[df$TIPO == "A",2], B=df[df$TIPO == "B",2]) where df is the name of your existing data.frame Michael On 5 August 2010 20:57, spigo <nicola.spigolon at gmail.com> wrote:> > Dear all, > I'm new here, I'm starting to learn R (oh my God!!). So, now I'm in panic > because I have this situation: > > ?TIPO ? Avariato > A ? ? ? 0.05 > B ? ? ? 0.09 > A ? ? ? 9 > B ? ? ? 8 > A ? ? ? 9 > B ? ? ? 3 > > and this is what I would like to do: > > Avariato ? ? ? ?A ? ? ? B > Avariato ? ? ? ?0.05 ? ?0.09 > Avariato ? ? ? ?9 ? ? ? 8 > Avariato ? ? ? ?9 ? ? ? 3 > > I don't know how to do it. I need to use reshape? how? > thanks for your reply. > Spigo > -- > View this message in context: http://r.789695.n4.nabble.com/Reshape-I-need-it-tp2314700p2314700.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Try this: unstack(DF, Avariato ~ TIPO) On Thu, Aug 5, 2010 at 7:57 AM, spigo <nicola.spigolon@gmail.com> wrote:> > Dear all, > I'm new here, I'm starting to learn R (oh my God!!). So, now I'm in panic > because I have this situation: > > TIPO Avariato > A 0.05 > B 0.09 > A 9 > B 8 > A 9 > B 3 > > and this is what I would like to do: > > Avariato A B > Avariato 0.05 0.09 > Avariato 9 8 > Avariato 9 3 > > I don't know how to do it. I need to use reshape? how? > thanks for your reply. > Spigo > -- > View this message in context: > http://r.789695.n4.nabble.com/Reshape-I-need-it-tp2314700p2314700.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]