Documenting R package with Rd file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Documenting R package with Rd file

Steven Yen
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)

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
dstat(uhat)
}

  --
[hidden email] (S.T. Yen)


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Documenting R package with Rd file

Duncan Murdoch-2
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)
> }
>
>    --
> [hidden email] (S.T. Yen)
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.