Consider the following data:
subjectName <- c("John Doe", "Jane Doe")
temperature <- c(98.1, 98.6)
gender <- factor(c('male', 'female'), levels = c('male','female'))
ptData <- data.frame(subjectName, temperature, gender, stringsAsFactors = F)
When I call:
ptData[,1]
I receive the first column, as expected. However, when I call:
ptData[,-1]
R fails to give me the last column. Instead, it outputs the last two:
temperature gender
1 98.1 male
2 98.6 female
Why doesn't my call work as expected?