Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does %*% mean in R [duplicate]

Tags:

r

I am following some code and I can apply everything until I get to the command:

s1 %*% cc1$xcoef 

This line does not work for me and I can't find documentation to explain it's purpose. I get this error:

Error in s1 %*% cc1$xcoef : non-conformable arguments 

What does the %*% do and can I use another function?

I am using R version 3.0.3 (2014-03-06) "Warm Puppy"

like image 307
kungphil Avatar asked Apr 04 '14 14:04

kungphil


People also ask

What does duplicate mean in R?

duplicated() in R The duplicated() is a built-in R function that determines which elements of a vector or data frame are duplicates of elements with smaller subscripts and returns a logical vector indicating which elements (rows) are duplicates.

How do I avoid duplicates in R?

Remove duplicate rows in a data frameThe function distinct() [dplyr package] can be used to keep only unique/distinct rows from a data frame. If there are duplicate rows, only the first row is preserved. It's an efficient version of the R base function unique() .

How do I fix duplicate row names in R?

It is not possible to have duplicate row names, but a simple workaround is creating an extra column (e.g. label) that holds the name that you would assign to your rows. You can then use this column for the names in the graph instead.


1 Answers

Use ?'%*%' to get the documentation.

%*% is matrix multiplication. For matrix multiplication, you need an m x n matrix times an n x p matrix.

like image 146
Christopher Louden Avatar answered Oct 02 '22 20:10

Christopher Louden