Hi, The question is not clear.
set.seed(45) spe <- data.frame(Col1=sample(c(1:10,letters[1:2]),400,replace=TRUE)) mat1 <- matrix(spe[,1],nrow=20,ncol=20) #If you want to replace the non-numeric values with NAs, mat2 <- matrix(as.numeric(as.character(spe[,1])),nrow=20,ncol=20) A.K. Hello, My data is in a 1 column x 40000 row data frame. I would like to make it a 200 column x 200 row data frame. When I was using all numeric values, I used the code below to transform my vector into a matrix. spematrix=data.matrix(spe) matrix = matrix(spe, nrow = 200, ncol=200) I cannot use this now though because my data contains non-numeric values. I am new to R and would appreciate any help. Thanks, Mary ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.