[R] Any help on R code interpretation?
Ben Tupper
btupper at bigelow.org
Thu Dec 22 14:29:01 CET 2016
Hi,
It's a bit hard to read what you have provided (don't forget that code pasted into emails on this list are best rendered if the email client is configured for plain text not html), but I suspect that it there is no %*%t. Instead, I think it should look like...
x %*% t(y)
where your x is 'mod7' and your y is all that other stuff. You might try ...
prediction = plogis( as.matrix( mod7 %*% t(ab) ) )
but that's just a guess.
Ben
> On Dec 22, 2016, at 8:08 AM, Marna Wagley <marna.wagley at gmail.com> wrote:
>
> HI R user,
> I was looking a r code and saw "%*%t", what does it("%*%t") mean?. The
> example is given below.
>
> For example: here is the code where "%*%t" has been used. when I run the
> formula but did not run in my data.
>
> prediction=plogis(as.matrix(mod7)%*%t(with(subset(data,site!='AB'),cbind(1,
> site=='BC', site =='MM', site =='XY',Temp,Treatment=='Local'))))
>
> Can I get the same result of above using the following code? Do both codes
> give same results?
>
> ab<-with(subset(data,site!='AB'),cbind(1,site=='BC', site =='MM', site ==
> 'XY',Temp,Treatment=='Local'))
> prediction =plogis(as.matrix(mod7),(ab))
>
> Thanks,
>
> MW
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Ben Tupper
Bigelow Laboratory for Ocean Sciences
60 Bigelow Drive, P.O. Box 380
East Boothbay, Maine 04544
http://www.bigelow.org
More information about the R-help
mailing list