df <- data.frame(name = c("A","B","C"),
plate = c("P1","P2","P3"),
value1 = c(1,2,3),
value2 = c(100,200,300))
f <- function(x, output) {
wellName <- x[1]
plateName <- x[2]
wellID <- 1
print(paste(wellID, x[3], x[4], sep=","))
cat(paste(wellID, x[3], x[4], sep=","), file= output, append = T, fill = T)
}
apply(d, 1, f, output = 'outputfile')