I have an input data file (say, pets.csv)as a contingency table
As for example, so
Animal
Dog Cat
Color
Black 15 20
White 30 60
So, the dimension names are Animal and Color. Is there a way to read this into R with the dimension names?
Currently, I input the file as simply
Dog Cat
Black 15 20
White 30 60
and do
mytable<-read.csv("pets.csv", header = TRUE, row.names=1)
But that loses the names of these variables (Color
and Animal)
.
I see that I can input the file completely as numbers and input the names in dimnames, but I would rather just read the file. I get tons of tables in files.