[R] Any help on R code interpretation?

Rui Barradas ruipbarradas at sapo.pt
Thu Dec 22 14:27:39 CET 2016


t() is the transpose function, it computes the transpose of matrix

site=='BC', site =='MM', site =='XY',Temp,Treatment=='Local'))

then %*% is matrix multiplication. If you have doubts on the result, 
compute as.matrix(mod7)%*%t(...) outside the call to plogis.

And no, the two codes do not give the same results. Read the help page 
?plogis to find out the arguments to that function.

Hope this helps,

Rui Barradas

Em 22-12-2016 13:08, Marna Wagley escreveu:
> 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.

More information about the R-help mailing list