What is the purpose of this trailing comma in R? What is the purpose of this trailing comma in R? r r

What is the purpose of this trailing comma in R?


The trailing comma in the first line indicates you're subsetting by rows (remember [ is a function that means subset)

The lack of a trailing comma in the second line indicates you're subsetting by columns. The second row would be equivalent to using a leading comma inside the brackets.

sigData <- data[, which(abs(data$wc2) > 3*wc2_sd)]