test1 <- structure(list(`1` = c(1, 2, 3, 4), `2` = structure(1:4, .Label = c("a", "b", "c", "d"), class = "factor"), `3` = structure(c(4L, 1L, 3L, 2L), .Label = c("DD", "ff", "gg", "HI"), class = "factor"),     `4` = list(c("a", "b"), c(2, 3, 4), c(44, 33, 11, 22), c("chr",     "ID", "i", "II")), `5` = c(1, 2, 3, 4), `6` = structure(1:4, .Label = c("a",     "b", "c", "d"), class = "factor"), `7` = structure(c(4L,     1L, 3L, 2L), .Label = c("DD", "ff", "gg", "HI"), class = "factor"),     `8` = list(c("a", "b"), c(2, 3, 4), c(44, 33, 11, 22), c("chr",     "ID", "i", "II")), `9` = 11:14), .Names = c("1", "2", "3", "4", "5", "6", "7", "8", "9"), row.names = c(NA, -4L), class = "data.frame")
target <- test1
input <- structure(list(l = structure(c("a", "2", "44", "chr", "b", "3", "33", "ID", NA, "4", "11", "i", NA, NA, "22", "II"), .Dim = c(4L, 4L), .Dimnames = list(NULL, c("L01", "L02", "L03", "L04"))),     l.1 = structure(c("a", "2", "44", "chr", "b", "3", "33",     "ID", NA, "4", "11", "i", NA, NA, "22", "II"), .Dim = c(4L,     4L), .Dimnames = list(NULL, c("L01", "L02", "L03", "L04")))), .Names = c("l", "l.1"))
targetCols <- c(4, 8)



> test1
  1 2  3              4 5 6  7              8  9
1 1 a HI           a, b 1 a HI           a, b 11
2 2 b DD        2, 3, 4 2 b DD        2, 3, 4 12
3 3 c gg 44, 33, 11, 22 3 c gg 44, 33, 11, 22 13
4 4 d ff chr, ID, i, II 4 d ff chr, ID, i, II 14


               > input
$l                            $l.1     
     L01   L02  L03  L04           L01   L02  L03  L04        
[1,] "a"   "b"  NA   NA       [1,] "a"   "b"  NA   NA         
[2,] "2"   "3"  "4"  NA       [2,] "2"   "3"  "4"  NA         
[3,] "44"  "33" "11" "22"     [3,] "44"  "33" "11" "22"       
[4,] "chr" "ID" "i"  "II"     [4,] "chr" "ID" "i"  "II"       



1  2  3           4  5  6   7               8   9
1  2  3  4  5  6  7  8  9  10  11  12  13  14  15



FUNCTION IS NOW IN utils.R
this is extra stuff



    
  
          #$  THIS IS FOR insertListAsCols, but not a list  
        ####    
        ####       ## if input is a list, we take the amount of each padding to be the number of columns of each input
        ####       if (is.list(input)) {
        ####         padAmounts <- sapply(input, ncol)
        ####         padAmounts[is.na(padAmounts)] <- 1
        ####       
        ####       ## otherwise, we take the amount of each padding to be equal; scaled by the number of places we are inserting
        ####       }  else {
        ####         padAmounts <- ncol(target) / length(targetCols)  
        ####   
        ####         # if the number does not divide nicely, there is a mistake somewhere (possibly in the code?)
        ####         if (!is.integer(padAmounts))
        ####           stop("incorrect sizes between input and targetCols")
        ####       }
