[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-help
Subject:    Re: [R] reshaping data
From:       David Winsemius <dwinsemius () comcast ! net>
Date:       2010-03-31 19:21:22
Message-ID: 0E64E5A1-52F7-43E7-9B53-F7DC97D59313 () comcast ! net
[Download RAW message or body]


On Mar 31, 2010, at 2:37 PM, Kim Jung Hwa wrote:

> Thanks Henrique and Stephan for your reply!
>
> Henrique, I'm planning to do some arthitmetic operations on tranformed
> (matrix) data and then would like to convert it back to original  
> format (as
> a data frame)... is there an equivalent easy command for this too?  
> Thanks,
>


Read the xtabs help page more thoroughly.

-- 
David.


> On Wed, Mar 31, 2010 at 2:26 PM, Henrique Dallazuanna <wwwhsd@gmail.com 
> >wrote:
>
>> Try this:
>>
>> xtabs(Val ~ Var1 + Var2, data = x)
>>
>> On Wed, Mar 31, 2010 at 3:23 PM, Kim Jung Hwa <kimhwamaillist@gmail.com 
>> >
>> wrote:
>>> Hi All,
>>>
>>> Can someone help me reshape following data:
>>>
>>> Var1 Var2 Val
>>> A X 1
>>> A Y 2
>>> A Z 3
>>> B X 4
>>> B Y 5
>>> B Z 6
>>>
>>> to some kind of matrix/tabular format (preferably as a matrix),  
>>> may be
>> like
>>>
>>> Var1 X Y Z
>>> A 1 2 3
>>> B 4 5 6
>>>
>>> Any help would be greatly appreciated,
>>> Kim
>>>
>>>       [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> 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<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@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.

David Winsemius, MD
West Hartford, CT

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic