I have some data sets with high enough dimension (14) to be painful to plot pairwise in one go. In that case I'd like to be able to select a subset of the dataframe they're in, but I only know how to address columns by number. This is irritating and unclear when the code is read back:
partimat(MARKER ~ ., trim_data11[,c(1:5,NCOL(trim_data11))],method="qda")
What I would like to do is something like this, which doesn't work:
partimat(MARKER ~ ., trim_data11$(c(AF3,F7,P8,O1,O2,MARKER)),method="qda")
Is there a way to do this?
You can address them with names as you suspect, just pass the names through as a character vector:
partimat(MARKER ~ ., trim_data11[, c("AF3","F7","P8","O1","O2","MARKER") ],method="qda")
As a simple example:
df <- data.frame( x = runif(5) , y =runif(5) , z = runif(5) )
df[,c("x","z")]
# x z
#1 0.5896444 0.1855764
#2 0.3486369 0.4936727
#3 0.1640928 0.1367027
#4 0.3167399 0.6686943
#5 0.7063566 0.6032699
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