Assuming your data.frame is called "x", here is a simple approach that results in a list one line of data.frame s.
Here is your data:
x <- structure(list(J = c(5L, 20L, 18L, 4L), E = c(4L, 19L, 2L, 7L ), I = c(1L, 17L, 12L, 18L), S = c(1L, 19L, 14L, 5L), A = c(5L, 19L, 11L, 12L), N = c(13L, 7L, 19L, 18L), H = c(3L, 4L, 18L, 2L), T = c(4L, 19L, 15L, 20L), M = c(13L, 7L, 19L, 6L), B = c(11L, 1L, 4L, 7L), D = c(14L, 5L, 8L, 16L), K = c(14L, 1L, 19L, 15L ), O = c(20L, 17L, 2L, 5L), G = c(9L, 15L, 2L, 18L), P = c(15L, 10L, 13L, 1L), L = c(9L, 6L, 7L, 13L), Q = c(11L, 7L, 9L, 2L), R = c(17L, 14L, 1L, 18L), F = c(9L, 6L, 12L, 14L), C = c(15L, 3L, 10L, 16L)), .Names = c("J", "E", "I", "S", "A", "N", "H", "T", "M", "B", "D", "K", "O", "G", "P", "L", "Q", "R", "F", "C"), class = "data.frame", row.names = c("2", "13", "14", "18" ))
And the sample:
set.seed(1) temp <- matrix(sample(20), nrow = 4) do.call(rbind, lapply(1:4, function(y) { x[y, -temp[y, ]] <- 0 x[y, ] }))