qsslearnr
qsslearnr copied to clipboard
Add additional solution of table() to allow for naming col/row
Add colnames and rownames to table()
solution to address #13 .
Yes, this is one approach, but I worry that we would have to check all possible names. What about using something like the following:
tt <- table(resume$sex, resume$call)
jj <- table(sex = resume$sex, call = resume$call)
all.equal(tt, jj, check.attributes = FALSE)
We would still have to check both ordering. I didn't know about the check.attributes
argument in the all.equal
function, but honestly might be very useful in other checks throughout the package.
Yes, this is one approach, but I worry that we would have to check all possible names. What about using something like the following:
tt <- table(resume$sex, resume$call) jj <- table(sex = resume$sex, call = resume$call) all.equal(tt, jj, check.attributes = FALSE)
We would still have to check both ordering. I didn't know about the
check.attributes
argument in theall.equal
function, but honestly might be very useful in other checks throughout the package.
This looks much better. I didn't find the use of table()
in the following two tutorials, but this way seems more robust and applicable to other settings.