[R] Returning the coef from two coordinates

Rui Barradas ruipbarradas at sapo.pt
Fri Apr 27 22:46:55 CEST 2012


Hello,


Hans Thompson wrote
> 
> Thank you to everyone in this forum that has been helping me with the
> basic R skills while I learn to apply them.  
> 
> I would like to take the coefficient of two coordinates.  One of them
> comes from two different columns in a table:
> 
> 
>>A
>      x   y  
> a  1   3
> b  2   2
> c  3   1
> 
> the other is set and for this question I'll just call it (1,1)
> 
> I've been trying to find a way to return the coefficient values for a,b,
> and c through (1,1). 
> 
>  Also, it looks like my questions are very basic compared to the others
> being asked on this forum so please let me know if I am out of place.  :)
> 

Sorry, but I'm not understanding what (1, 1) is. Are those the matrix A
coordinates, (row, col)?
If so, use an index matrix, with two columns. Here is an example.

elm1 <- c(1, 1)
elm2 <- c(2, 1)
inx <- matrix(c(elm1, elm2), ncol=2, byrow=TRUE)
colnames(inx) <- c("Row", "Col")
inx

A[inx]

Hope this helps,

Rui Barradas


--
View this message in context: http://r.789695.n4.nabble.com/Returning-the-coef-from-two-coordinates-tp4593504p4593723.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list