Load your data by (for others to easily do that for your reproducible example):
> text <- textConnection(" datay dataz
+ [1,] 0 100
+ [2,] 2 101
+ [3,] 3 102
+ [4,] 4 103
+ [5,] 10 0
+ [6,] 11 0
+ [7,] 0 0
+ [8,] 0 0
+ [9,] 0 0
+ [10,] 12 11
+ [11,] 45 12")
> df <- read.table(text, header=TRUE)
Or by using the output of dput
applied to your data frame:
> df <- structure(list(datay = c(0L, 2L, 3L, 4L, 10L, 11L, 0L, 0L, 0L,
12L, 45L), dataz = c(100L, 101L, 102L, 103L, 0L, 0L, 0L, 0L,
0L, 11L, 12L)), .Names = c("datay", "dataz"), class = "data.frame", row.names = c("[1,]",
"[2,]", "[3,]", "[4,]", "[5,]", "[6,]", "[7,]", "[8,]", "[9,]",
"[10,]", "[11,]"))
To change "all 0 values in column dataz to values of 1":
> df$dataz[df$dataz == 0] <- 1
> df
datay dataz
[1,] 0 100
[2,] 2 101
[3,] 3 102
[4,] 4 103
[5,] 10 1
[6,] 11 1
[7,] 0 1
[8,] 0 1
[9,] 0 1
[10,] 12 11
[11,] 45 12