library("broadcast")
x <- array(sample(month.abb), c(10, 2))
y <- array(sample(1:10), c(10, 2, 3))
print(x)
## [,1] [,2]
## [1,] "Apr" "May"
## [2,] "Jun" "Mar"
## [3,] "Nov" "Apr"
## [4,] "Aug" "Jun"
## [5,] "Jan" "Nov"
## [6,] "Jul" "Aug"
## [7,] "Oct" "Jan"
## [8,] "Sep" "Jul"
## [9,] "Dec" "Oct"
## [10,] "Feb" "Sep"
print(y)
## , , 1
##
## [,1] [,2]
## [1,] 4 4
## [2,] 10 10
## [3,] 5 5
## [4,] 9 9
## [5,] 6 6
## [6,] 8 8
## [7,] 1 1
## [8,] 2 2
## [9,] 7 7
## [10,] 3 3
##
## , , 2
##
## [,1] [,2]
## [1,] 4 4
## [2,] 10 10
## [3,] 5 5
## [4,] 9 9
## [5,] 6 6
## [6,] 8 8
## [7,] 1 1
## [8,] 2 2
## [9,] 7 7
## [10,] 3 3
##
## , , 3
##
## [,1] [,2]
## [1,] 4 4
## [2,] 10 10
## [3,] 5 5
## [4,] 9 9
## [5,] 6 6
## [6,] 8 8
## [7,] 1 1
## [8,] 2 2
## [9,] 7 7
## [10,] 3 3
bc_strrep(x, y)
## , , 1
##
## [,1] [,2]
## [1,] "AprAprAprApr" "MayMayMayMay"
## [2,] "JunJunJunJunJunJunJunJunJunJun" "MarMarMarMarMarMarMarMarMarMar"
## [3,] "NovNovNovNovNov" "AprAprAprAprApr"
## [4,] "AugAugAugAugAugAugAugAugAug" "JunJunJunJunJunJunJunJunJun"
## [5,] "JanJanJanJanJanJan" "NovNovNovNovNovNov"
## [6,] "JulJulJulJulJulJulJulJul" "AugAugAugAugAugAugAugAug"
## [7,] "Oct" "Jan"
## [8,] "SepSep" "JulJul"
## [9,] "DecDecDecDecDecDecDec" "OctOctOctOctOctOctOct"
## [10,] "FebFebFeb" "SepSepSep"
##
## , , 2
##
## [,1] [,2]
## [1,] "AprAprAprApr" "MayMayMayMay"
## [2,] "JunJunJunJunJunJunJunJunJunJun" "MarMarMarMarMarMarMarMarMarMar"
## [3,] "NovNovNovNovNov" "AprAprAprAprApr"
## [4,] "AugAugAugAugAugAugAugAugAug" "JunJunJunJunJunJunJunJunJun"
## [5,] "JanJanJanJanJanJan" "NovNovNovNovNovNov"
## [6,] "JulJulJulJulJulJulJulJul" "AugAugAugAugAugAugAugAug"
## [7,] "Oct" "Jan"
## [8,] "SepSep" "JulJul"
## [9,] "DecDecDecDecDecDecDec" "OctOctOctOctOctOctOct"
## [10,] "FebFebFeb" "SepSepSep"
##
## , , 3
##
## [,1] [,2]
## [1,] "AprAprAprApr" "MayMayMayMay"
## [2,] "JunJunJunJunJunJunJunJunJunJun" "MarMarMarMarMarMarMarMarMarMar"
## [3,] "NovNovNovNovNov" "AprAprAprAprApr"
## [4,] "AugAugAugAugAugAugAugAugAug" "JunJunJunJunJunJunJunJunJun"
## [5,] "JanJanJanJanJanJan" "NovNovNovNovNovNov"
## [6,] "JulJulJulJulJulJulJulJul" "AugAugAugAugAugAugAugAug"
## [7,] "Oct" "Jan"
## [8,] "SepSep" "JulJul"
## [9,] "DecDecDecDecDecDecDec" "OctOctOctOctOctOctOct"
## [10,] "FebFebFeb" "SepSepSep"bc_strrep
Broadcasted strrep
Description
The bc_strrep() method is a broadcasted form of strrep.
Usage
bc_strrep(x, y, ...)
## S4 method for signature 'ANY'
bc_strrep(x, y)
Arguments
x
|
vector/array of type character.
|
y
|
vector/array of type integer.
|
β¦
|
further arguments passed to or from methods. |
Value
A character array as a result of the broadcasted repetition operation.