[R] Newbie hung up with matrices
Jerome Asselin
jerome at hivnet.ubc.ca
Fri May 16 20:41:16 CEST 2003
You need to convert your data frame as a matrix before your operation. Try
this:
x %*% as.matrix(A)
Regarding a good book, I may not be the best person to answer you. I am
aware of the online manuals available at http://www.r-project.org .
The manual "An Introduction to R" is my personal best bet.
HTH,
Jerome
On May 16, 2003 10:00 am, rwatkins at cornerstonelp.com wrote:
> Hi all:
> Thanks in advance for your assistance.
>
> I just started learning R. I'm trying to use the Help and the
> downloadable manuals. I am stuck on trying to multiply matrices. Can
> anyone please supply a couple of lines of code that I can plug into a
> fresh console to see how a double precision (1x3) matrix is multiplied
> by a double precision (3x3) matrix? I keep getting an error
> message,"Error in x%*%A: requires numeric matrix/vector arguments".
>
> I have some VBA and VB experience (thus a little Object Oriented
> programming experience), am I right in beliving that I am not
> "dimensioning" correctly? I have been trying the following example:
> A<-matrix
> A<-read.csv("test33.csv"), where the data is
> A,B,C
> 1,4,7
> 2,5,8
> 3,6,9
>
> x<-c(4,5,6)
> x%*%A
> ERROR (as shown above)
>
> ALSO, I have downloaded the RExcel add-in, but have not found any
> reference manual, etc that describes how to use it. Any suggestions
> here are appreciated, as I primarily do my work in Excel.
>
> Are there any good books available that will help me in my quest to
> become a more adept user of R? I know I am going to need this package
> for multivariate regressions, etc.
>
> Again, thanks in advance for your time and consideration.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
More information about the R-help
mailing list