statistics - How to extract longitudinal time-series data from a dataframe in R for time-series analysis and imputation -



statistics - How to extract longitudinal time-series data from a dataframe in R for time-series analysis and imputation -

thanks joran helping me grouping info in previous question wanted create info frame in r smaller can time-series analysis on data.

now farther extract info dataframe. dataframe made of 6 columns. columns 1 5 each have discrete names/values, such district, gender, year, month , age group. 6th column number of death counts specific combination. extract looks this:

district gender year month agegroup totaldeaths northern male 2006 11 01-4 0 northern male 2006 11 05-14 1 northern male 2006 11 15+ 83 northern male 2006 12 0 3 northern male 2006 12 01-4 0 northern male 2006 12 05-14 0 northern male 2006 12 15+ 106 southern female 2003 1 0 6 southern female 2003 1 01-4 0 southern female 2003 1 05-14 3 southern female 2003 1 15+ 136 southern female 2003 2 0 6 southern female 2003 2 01-4 0 southern female 2003 2 05-14 1 southern female 2003 2 15+ 111 southern female 2003 3 0 2 southern female 2003 3 01-4 0 southern female 2003 3 05-14 1 southern female 2003 3 15+ 141 southern female 2003 4 0 4

i new time-series, , think need analyse data: need extract smaller 'time-series' info objects unique , longitudinal data. illustration above dataframe, want extract smaller info objects each district, gender , agegroup:

district gender year month agegroup totaldeaths northern male 2003 1 01-4 0 northern male 2003 2 01-4 1 northern male 2003 3 01-4 0 northern male 2003 4 01-4 3 northern male 2003 5 01-4 4 northern male 2003 6 01-4 6 northern male 2003 7 01-4 5 northern male 2003 8 01-4 0 northern male 2003 9 01-4 1 northern male 2003 10 01-4 2 northern male 2003 11 01-4 0 northern male 2003 12 01-4 1 northern male 2004 1 01-4 1 northern male 2004 2 01-4 0

going to

northern male 2006 11 01-4 0 northern male 2006 12 01-4 0

i tried in excel, creating pivot tables data, , tried extract string of info - failed. after discovered reshapein r, either don't know codes or perhaps should not utilize reshape this.

i not if correct/ way analyse cross-sectional time-series data, ie. if there format required analyse info functions such read.ts(), ts() , arima().

my eventual aim utilize info , amelia2 bundle functions impute missing totaldeaths months in 2007 , 2008, info of course of study missing.

any help, how , perhaps suggestions on how tackle problem gratefully appreciated.

for narrow question of how best extract:

subset(dfrm, subset=(district=="northern" & gender=="male" & agegroup=="01-4"))

subset has select argument narrow downwards columns. suspect search on term "extract" using have pulled hits ?extract page surprisingly has no link subset. (i trimmed trailing space before version of agegroup specification.)

r statistics time-series

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -