Hello,

Try

df1 <- read.table(text="
County 1990 1991 1992 1993
Alachua 1 1 1 1
Baker 0 0 0 0
Bay 0 0 1 0
Bradford 0 0 0 0
", header=TRUE)

df1$Total <- rowSums(df1[ , -1]) # Not column 1
df1$Total <- rowSums(df1[ , 2:5])# Explicit column numbers

Hope this helps,
Rui Barradas


--
View this message in context: 
http://r.789695.n4.nabble.com/Sum-part-of-row-and-add-this-as-a-new-column-vector-tp4566097p4566155.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to