[R] Help Transforming sums into observations

kbrownk kbrownk at gmail.com
Tue Dec 20 23:45:21 CET 2011

I need to measure kurtosis, skew, and maybe dip test on some
distributions I have. Currently my data is in the form of 2 vectors x
and y. Where x is 10 bins and y is the number of observations found in
that bin. It seems that the measures I want to run require the actual
observations laid out rather than already summed like I have them. Any
suggestions on how to transform the data automatically? I have a semi-
automated method in Excel but I think r will do a better job. I
provide a more specific example below:

My csv file with the data looks like this:
Bin: 1,2,3, ... ,10     #Observations:  23,42,1,...  56

I need this transformed into a single vector like this:
c(1,1,1,1...2,2,2,2...3,...10,10,10,10...) The vector would have 23
"1"s, 42 "2s", 1 "3", etc.

I actually have 68 of these vectors laid out in rows that I will
measure separately, so my csv file actually looks like this:
Bin: 1,2,3, ... ,10     #Observations:  23,42,1,... 56
Bin: 1,2,3, ... ,10     #Observations:  13,33,32,...98
Bin: 1,2,3, ... ,10     #Observations:  11,76,55,...46

I want to automate the process.

Thanks for any advice,

More information about the R-help mailing list