I am sending this again as they told me that the data was unreadable, so really 
hope that this will work...so sorry all
note: matrix contains a lot of empty entities 

Greeting R helpers
I am not familiar with R but I have to use it to analyze data set that I have 
(30,000 20,000)
I want to change the structure of the dataset and I am wondering how that might 
be possible in R

>          Age  No.  Age  No.  Age    No.
> 
> Center1    5  2  8      7
> 
> Center2    10  7  20      9    4    10
> 
> column name = sequence of age-no.
> 
> 
> 
> But what I want the data to look like is this
> 
> Age      1    2    3    4    5    6    7    8      9    10 ..      20
> 
> Center1                        2              7
> 
> Center2                  10                                   7 ..      9
>
> the rest of the matrix is empty == center1(2,7) and center2(4,10,20) are full
> column name= age of ppl
> 
> entries = number of ppl with that age in on center
It should read the entities one by one
when j is in age column take its value and consider it as the column number for 
new matrix
then go to next entity (j No. columns) and put that entity under the columns 
number identified in previous step.
In other word
it should get the each element in No. columns (one by one) and place them in a 
new matrix under the column number which are equal to entity of age columns of 
first matrix
i have tired ncol, and cbind and things like that but I guess im on the wrong 
path because it is not working.  I am reading this fine with read.csv and 
writing back the same way.
do you know how I can make this work?? Is it even possible to do something like 
this?
Thank you in advance
Natasha


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

Reply via email to