dwinsemius at comcast.net
Wed Aug 24 00:55:14 CEST 2016
> On Aug 23, 2016, at 3:03 PM, Gang Chen <gangchen6 at gmail.com> wrote:
> This is a simple question: With a dataframe like the following
> myData <- data.frame(X=c(1, 2, 3, 4), Y=c(4, 3, 2, 1), Z=c('A', 'A', 'B', 'B'))
> how can I get the cross product between X and Y for each level of
> factor Z? My difficulty is that I don't know how to deal with the fact
> that crossprod() acts on two variables in this case.
Just make a function that takes a dataframe and does a crossprod on two of its columns.
Alameda, CA, USA
More information about the R-help