Skip to content
Prev 247425 / 398503 Next

how to add a derived column to a data frame?

On Sun, Jan 16, 2011 at 03:01:49PM +0800, r-help wrote:
I am sorry for an error in the previous solution for a general
matrix. It should be, for example

  x <- as.numeric(rowSums(a %% 13 == 0) != 0)
  b <- cbind(a, x)

or

  x <- (rowSums(a %% 13 == 0) != 0) + 0

Petr Savicky.