Skip to content
Prev 42680 / 398506 Next

extract data from a data.frame

#one way
res$cyx.1

#as in:
sum(res$cyx.1)

#another way:
attach res
sum(cyx.1)

#or by row index
res[1, ]

#as in
for (i in 1:nrow(res)) {
  print(sum(res[i,]))
}

#or by column index
for (i in 1:ncol(res)) {
  print(sum(res[,i]))
}

hope that helps.
-Eric
This email message, including any attachments, is for the so...{{dropped}}