mhahsler / arules

Mining Association Rules and Frequent Itemsets with R
http://mhahsler.github.io/arules
GNU General Public License v3.0
194 stars 42 forks source link

Use more stable Rd cross reference #81

Closed jaganmn closed 6 months ago

jaganmn commented 6 months ago

Probably better to link ngCMatrix-class directly here.

https://github.com/mhahsler/arules/blob/ccf0236e470f6a2e61eb199434dd402c0ed4dac6/man/tidLists-class.Rd#L77

Matrix may discard the nsparseMatrix-classes alias in a future release.

mhahsler commented 6 months ago

This is interesting. It seems like roxygen creates this. I have in my R file:

#' `tidLists` uses the class
#' [Matrix::ngCMatrix-class] to efficiently store the...

roxygen then creates: \link[Matrix:nsparseMatrix-classes]{Matrix::ngCMatrix}

I think roxygen does this because ? "ngCMatrix-class" returns the man page for nsparseMatrix-classes {Matrix}.

jaganmn commented 6 months ago

Yes, it seems to be a peculiarity of roxygen2. I even tried roxygen2::roxygenize() using the latest versions of R and roxygen2, in case they mattered. Well, the syntax that you use further down seems to be parsed correctly as \linkS4class{ngCMatrix}:

https://github.com/mhahsler/arules/blob/ccf0236e470f6a2e61eb199434dd402c0ed4dac6/R/tidLists.R#L66

https://github.com/mhahsler/arules/blob/ccf0236e470f6a2e61eb199434dd402c0ed4dac6/man/tidLists-class.Rd#L124

So I guess that the answer is to use that syntax everywhere. IIRC, specifying that the topic ngCMatrix-class lives in the Matrix package is only required if the label ngCMatrix-class is used by multiple packages.

https://stat.ethz.ch/R-manual/R-patched/doc/manual/R-exts.html#Cross_002dreferences

mhahsler commented 6 months ago

Hmmm. Interesting. Looks like roxygen does something different when the package name is specified in the link. I will remove Matrix: from the link. Thanks! -Michael