r - Going from a frequency table to a burt table -


i need transform dataset burt table, don't know how because know how indicator matrix.

this data looks like

          geo                    identity            age  sex value 3649 atlantic total , aboriginal identity 18 24 years male   950 3653 atlantic total , aboriginal identity 18 24 years male   506 3657 atlantic total , aboriginal identity 18 24 years male     0 3661 atlantic total , aboriginal identity 18 24 years male     0 3665 atlantic total , aboriginal identity 18 24 years male     0 3669 atlantic total , aboriginal identity 18 24 years male   950 3673 atlantic total , aboriginal identity 18 24 years male     0 3677 atlantic total , aboriginal identity 18 24 years male     0 3681 atlantic total , aboriginal identity 18 24 years male     0 3685 atlantic total , aboriginal identity 18 24 years male     0 

there thousand combinations frequency in last column , don't know how manipulate data frame indicator matrix or burt table directly.

more info on data after trying use

 matdata2 = model.matrix(mydata2) error in terms.default(object) : no terms component nor attribute 

to transform indicator matrix.

 dput(head(mydata2)) structure(list(ref_date = c(2012l, 2012l, 2012l, 2012l, 2012l,  2012l), geo = structure(c(2l, 2l, 2l, 2l, 2l, 2l), .label = c("alberta",  "atlantic", "british columbia", "canada", "manitoba", "northwest territories",  "nunavut", "ontario", "quebec", "saskatchewan", "yukon"), class = "factor"),      identity = structure(c(1l, 1l, 1l, 1l, 1l, 1l), .label = c("first nations (north american indian)",      "first nations (north american indian), not registered or treaty indian",      "first nations (north american indian), registered or treaty indian",      "inuk (inuit)", "métis", "total , aboriginal identity"), class = "factor"),      age = structure(c(1l, 1l, 1l, 1l, 1l, 1l), .label = c("18 24 years",      "25 54 years", "55 years , over", "total, 18 years , over"     ), class = "factor"), sex = structure(c(3l, 3l, 3l, 3l, 3l,      3l), .label = c("both sexes", "female", "male"), class = "factor"),      health = structure(c(2l, 4l, 3l, 12l, 1l, 10l), .label = c("ever considered committing suicide",      "excellent or perceived mental health", "fair or poor perceived mental health",      "good perceived mental health", "never considered committing suicide",      "not specified, considered committing suicide",      "not specified, considered committing suicide in past 12 months",      "perceived mental health not specified", "seriously considered committing suicide not in past 12 months",      "seriously considered committing suicide in past 12 months",      "total, perceived mental health", "total, suicidal thoughts"     ), class = "factor"), value = c(2190, 2572, 2572, 355, 2572,      2572)), .names = c("ref_date", "geo", "identity", "age",  "sex", "health", "value"), row.names = c(4229l, 4233l, 4237l,  4245l, 4249l, 4253l), class = "data.frame") 


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -