dat2fre {confreq} | R Documentation |
dataset to pattern frequency conversion
Description
Given a dataset this function returns a (response) pattern frequencies table representation of it.
Usage
dat2fre(
x,
katorder = FALSE,
caseorder = TRUE,
kat = NULL,
codes = NULL,
wgt = NULL,
...
)
Arguments
x |
an object of class "matrix" or "data.frame". If |
katorder |
logical with default set to |
caseorder |
logical with default set to |
kat |
ignored when |
codes |
a list with character vectors containing coding for integers in matrix (if |
wgt |
a numerical vector of survey weights to weight the cases (rows) in |
... |
other parameters passed through to |
Details
To use survey weights a vector of positive numeric values with length matching the number of rows in x
must be assigned to the argument wgt
. The individual case weights are then aggregated (respective sum of weights) for each pattern observed in the data (assigned to argument x
).
Value
An object of class c("data.frame","Pfreq") containing the (response) pattern frequencies table representation of the given dataset in the argument x
.
References
No references in the moment
Examples
#######################################
data(suicide)# loading data in data frame (702 cases) representation
dat2fre(suicide) # converting it into a pattern frequencies table
###########
#######################################
data(LienertLSD)# loading example pattern frequencies table ..
test<-fre2dat(LienertLSD)# and coverting it into a simple (data) matrix
test<-test[sample(c(1:65),65),] # making a messy order
############
dat2fre(test) # making a proper ordered pattern frequencies table again
##### try it with a data.frame too!
#######################################