First I have a slightly embarrassing question. What do the commas in R represent?
For example, whenever there's code that's like unique[x3,]
or something similar, What is the comma doing before the bracket?
Second,
mosaicplot(UCBAdmissions[,,i],)
what do the two commas inside the square bracket mean?
The best way to understand these things is to try them out on your own and see what they do!
In general:
mydf[1, ] ## Get the first row
mydf[, 3] ## Get the third column
The UCBAdmissions has more than two dimensions, so
UCBAdmissions[, , 1] ## Get the first table in the 3D array
Of course, these can be combined. The UCBAdmissions sample data is a set of 6 two-by-two table:
dim(UCBAdmissions)
# [1] 2 2 6
Let's imagine you wanted the first row from just the first two tables:
UCBAdmissions[1, , c(1, 2)]
# Dept
# Gender A B
# Male 512 353
# Female 89 17
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With