Q:

Calculate row sum but exclude a column in R

I want to calculate the sum of the columns, but exclude one column.How can I specify what column to exclude while adding the sum of each row. 
hd_total<-rowSums(hd) #hd is where the data is that is read is being held 
hn_total<-rowSums(hn)

A:

rowSums(hd[, -n])

where n is the column you want to exclude.

