[R] Documenting R package with Rd file

Duncan Murdoch murdoch.duncan at gmail.com
Wed Mar 14 12:03:00 CET 2018


On 14/03/2018 6:10 AM, Steven Yen wrote:
> I have trouble documenting an R package. In my .Rd file (sixth line below), I have
> uhat<-m%*%y
> 
> but when the package is built (successfully), the matrix multiplication part does not show up in the documentation. The line become (missing %*% y)

Generally questions about writing packages should be in R-devel or 
R-package-devel, but this one is easy, so I'll answer here.

The % symbol marks a comment in an Rd file.  You need to escape them. 
See below...
> 
> uhat<-m
> 
> ===
> 
> \examples{
> x<-c(1,2,3,4,5)
> y<-c(1,1,2,2,4)
> x<-cbind(1,x)
> m<-mmat(x)
> uhat<-m%*%y

Should be "uhat <- m \%*\% y"

Duncan Murdoch

> dstat(uhat)
> }
> 
>    --
> styen at ntu.edu.tw (S.T. Yen)
> 
> 
> 	[[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