[R] matrix rows to single numeric element

2011-08-04 Thread Wegan, Michael (DNRE)
I have a matrix of 5 columns and 64 rows, let's call it mat1. All values are 1 or 0. I need to take the values of the elements by row and create a single numeric element that can be placed its respective slot in a 64-element list, named list1. For example, mat1[11,1:5] = 0,1,1,0,1 and I must

[R] How to call R-squared values from lm's?

2010-12-02 Thread Wegan, Michael (DNRE)
I would like to call both p-values and R-squared values from lm's in a function. I can get the p-values from coef(summary(name.lm))[r,c], however, I cannot figure out how to call the R-squared values without manually calling the summary and inserting them in the script - which negates the