Re: [R] Transform values from one column into column names of new dataframe

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Fri, 02 May 2008 13:45:19 -0300

Try this also:

noquote(with(x, tapply(VALUE, list(ITEM, STEP), paste)))

On Fri, May 2, 2008 at 1:05 PM, Matt <mvgnyc_at_gmail.com> wrote:

> Hi, I have a question about reformatting data. It looks like it should
> be simple, but I've been working at it for awhile now and it's about
> time I ask for help.
>
> My data look like this:
>
> ITEM VALUE STEP
> item1 A first
> item2 C first
> item2 D second
> item1 A second
> item3 A first
> item3 B second
> item3 A third
>
> I just want to transform it so they look like this:
>
> ITEM FIRST SECOND THIRD
> item1 A A NA
> item2 C D NA
> item3 A B A
>
> Basically taking the values of the "STEP" column and using those as
> the column names and merging together the items.
>
> I appreciate your help,
> -Matt
>
> ______________________________________________
> 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.
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]


______________________________________________ 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.

Received on Fri 02 May 2008 - 17:57:05 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 02 May 2008 - 18:30:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive