Function(s) that apply expressions to input data objects and return lists.
lap: Iterate over input and return list(s)
lapr: Iterate over input rows and return list(s)
lapr: Iterate over input columbs and return list(s)
lap(.data, .f, ...) lapr(.data, .f, ...) lapc(.data, .f, ...) lap2(.x, .y, .f, ...)
.data | Input object–numeric, character, list, data frame, etc.–over which elements will be iterated. If matrix or data frame, each column will be treated as the elements which are to be iterated over. |
---|---|
.f | Function to apply to each element of input object. This can be
written as a single function name e.g., |
... | Other values passed to function call. |
.x | First data vector input (for lap2) |
.y | Second data vector input (for lap2) |
A list
#> [[1]] #> [1] "a." #> #> [[2]] #> [1] "b." #> #> [[3]] #> [1] "c." #> #> [[4]] #> [1] "d." #> #> [[5]] #> [1] "e." #> #> [[6]] #> [1] "f." #> #> [[7]] #> [1] "g." #> #> [[8]] #> [1] "h." #> #> [[9]] #> [1] "i." #> #> [[10]] #> [1] "j." #> #> [[11]] #> [1] "k." #> #> [[12]] #> [1] "l." #> #> [[13]] #> [1] "m." #> #> [[14]] #> [1] "n." #> #> [[15]] #> [1] "o." #> #> [[16]] #> [1] "p." #> #> [[17]] #> [1] "q." #> #> [[18]] #> [1] "r." #> #> [[19]] #> [1] "s." #> #> [[20]] #> [1] "t." #> #> [[21]] #> [1] "u." #> #> [[22]] #> [1] "v." #> #> [[23]] #> [1] "w." #> #> [[24]] #> [1] "x." #> #> [[25]] #> [1] "y." #> #> [[26]] #> [1] "z." #>## return list of columns lap(mtcars[1:5, ], as.character)#> $mpg #> [1] "21" "21" "22.8" "21.4" "18.7" #> #> $cyl #> [1] "6" "6" "4" "6" "8" #> #> $disp #> [1] "160" "160" "108" "258" "360" #> #> $hp #> [1] "110" "110" "93" "110" "175" #> #> $drat #> [1] "3.9" "3.9" "3.85" "3.08" "3.15" #> #> $wt #> [1] "2.62" "2.875" "2.32" "3.215" "3.44" #> #> $qsec #> [1] "16.46" "17.02" "18.61" "19.44" "17.02" #> #> $vs #> [1] "0" "0" "1" "1" "0" #> #> $am #> [1] "1" "1" "1" "0" "0" #> #> $gear #> [1] "4" "4" "4" "3" "3" #> #> $carb #> [1] "4" "4" "1" "1" "2" #>#> [[1]] #> [1] "aAaA" #> #> [[2]] #> [1] "bBbB" #> #> [[3]] #> [1] "cCcC" #> #> [[4]] #> [1] "dDdD" #> #> [[5]] #> [1] "eEeE" #> #> [[6]] #> [1] "fFfF" #> #> [[7]] #> [1] "gGgG" #> #> [[8]] #> [1] "hHhH" #> #> [[9]] #> [1] "iIiI" #> #> [[10]] #> [1] "jJjJ" #> #> [[11]] #> [1] "kKkK" #> #> [[12]] #> [1] "lLlL" #> #> [[13]] #> [1] "mMmM" #> #> [[14]] #> [1] "nNnN" #> #> [[15]] #> [1] "oOoO" #> #> [[16]] #> [1] "pPpP" #> #> [[17]] #> [1] "qQqQ" #> #> [[18]] #> [1] "rRrR" #> #> [[19]] #> [1] "sSsS" #> #> [[20]] #> [1] "tTtT" #> #> [[21]] #> [1] "uUuU" #> #> [[22]] #> [1] "vVvV" #> #> [[23]] #> [1] "wWwW" #> #> [[24]] #> [1] "xXxX" #> #> [[25]] #> [1] "yYyY" #> #> [[26]] #> [1] "zZzZ" #>