Hello,
I am trying to create multiple matrices (to run a PVA) but can't import all of them from a .csv without the numbers treated as labels and not factors. I can enter the matrix slowly: Site05_96 <- matrix(c(0.07,0,0.03,0.00,NA,0.00, 0.09,0.166666667,0.31,0.42,NA,0.00, 0.00,0,0.00,0.00,NA,0.00, 0.00,0,0.00,0.00,NA,0.00, 0.26,0.166666667,0.19,0.00,NA,0.00, 0.58,0.666666667,0.47,0.58,0,0.00), nrow = 6, ncol = 6, dimnames = list(c("Vegetative", "Vegetative with herbivory", "Reproductive", "Reproductive with herbivory", "Dormant", "Dead"), c("Vegetative", "Vegetative with herbivory", "Reproductive", "Reproductive with herbivory", "Dormant", "Dead"))) I would like to list all matrices (for all 12 years and all 4 sites) in one Excel sheet (.csv) and then read each matrix as chucks of 6 rows. However, when I try this I either get all the values (the %) in quotes (not as factors) and if I try to force them with as.factor, it no longer seems to be a matrix. AsMi0598test2 <- as.matrix(AsMi05test[1:6,1:6]) X Vegetative Vegetative.with.Herbivory Reproductive Reproductive.with.Herbivory Dormant 1 "Vegetative" "0.25" "0.13" "0" "0" "0.08" 2 "Vegetative with Herbivory" "0.50" "0.50" "0" "0" "0.00" 3 "Reproductive" "0.17" "0.33" "0" "0" "0.33" 4 "Reproductive with Herbivory" "0.08" "0.67" "0" "0" "0.08" 5 "Dormant" "0.00" "0.00" "0" "0" "1.00" 6 "Dead" "0.00" "0.00" "0" "0" "0.00" When I add AsMi0598test2 <- as.factor(as.matrix(AsMi05test[1:6,1:6])) I get this: [1] Vegetative Vegetative with Herbivory Reproductive Reproductive with Herbivory [5] Dormant Dead 0.25 0.50 [9] 0.17 0.08 0.00 0.00 [13] 0.13 0.50 0.33 0.67 [17] 0.00 0.00 0 0 [21] 0 0 0 0 [25] 0 0 0 0 [29] 0 0 0.08 0.00 [33] 0.33 0.08 1.00 0.00 16 Levels: 0 0.00 0.08 0.13 0.17 0.25 0.33 0.50 0.67 1.00 Dead Dormant Reproductive ... Vegetative with Herbivory I want to read all matrices into stoch.projection( ) {popbio} Thanks for any suggestions. I could enter them all in the .txt document if I can't read them from the Excel sheet. Michelle DePrenger-Levin [[alternative HTML version deleted]] ______________________________________________ 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.