Skip to content
Prev 248142 / 398503 Next

how to store a number into a vector

On Jan 23, 2011, at 6:00 PM, Thomas Stewart wrote:

            
str1 <- c(12345, 34567, 45678)
sapply(strsplit(as.character(str1), "") , unlist)

      [,1] [,2] [,3]
[1,] "1"  "3"  "4"
[2,] "2"  "4"  "5"
[3,] "3"  "5"  "6"
[4,] "4"  "6"  "7"
[5,] "5"  "7"  "8"

--  
David
David Winsemius, MD
Heritage Laboratories
West Hartford, CT