I have a matrix,and i need to generate column name to the matrix. column names should be something like this.
"out01" "out02" "out03" "out04" ... to .. "out30"
This is what i have tried
outmat <- matrix(NA, 5, 30)
colnames(outmat) <- sprintf("out%d", 1:30)
generated column names are like this.
"out1" "out2" "out3" "out4" "out5" "out6" "out7" "out8" "out9" "out10" .... to "out30"
is there any direct way to covert out1 to out01
in sprintf
method.