Skip to content

[R-pkg-devel] CRAN note about \href{https://doi.org/...}{label} in Rd files

8 messages · Georgi Boshnakov, Duncan Murdoch, Floris Vanderhaeghe

#
Hi,

When running R CMD check on R-devel, a CRAN note appears about 
\href{https://doi.org/...}{label} in Rd files. Like:

Found the following URLs which should use \doi (with the DOI name only):
 ? File ?read_GRTSmh.Rd?:
 ??? https://doi.org/10.5281/zenodo.2611233
 ??? https://doi.org/10.5281/zenodo.3354403
 ? File ?read_GRTSmh_base4frac.Rd?:
 ??? https://doi.org/10.5281/zenodo.3354401

(Full output is at 
https://github.com/inbo/n2khab/runs/2219662325?check_suite_focus=true#step:10:35)

The note does not appear in R 4.0.4.

The cause is documentation hyperlinks to doi.org, ** inside \href{} **:

./man/read_GRTSmh.Rd:42:\href{https://doi.org/10.5281/zenodo.2611233}{Zenodo}, 
is a monolayered GeoTIFF
./man/read_GRTSmh.Rd:73:\href{https://doi.org/10.5281/zenodo.3354403}{Zenodo}, 
and can only be
./man/read_GRTSmh_base4frac.Rd:33:\href{https://doi.org/10.5281/zenodo.3354401}{Zenodo}.
./man/read_GRTSmh_diffres.Rd:45:at 
\href{https://doi.org/10.5281/zenodo.3354405}{Zenodo}), composed of
./man/read_habitatmap_stdized.Rd:68:\href{https://doi.org/10.5281/zenodo.3355192}{Zenodo}, 
that
./man/read_habitatmap_terr.Rd:117:\href{https://doi.org/10.5281/zenodo.3468948}{Zenodo}, 
that contains:
./man/read_habitatquarries.Rd:70:\href{https://doi.org/10.5281/zenodo.4072967}{Zenodo}, 
that contains:
./man/read_habitatsprings.Rd:83:\href{https://doi.org/10.5281/zenodo.3550994}{Zenodo}.
./man/read_soilmap.Rd:225:\href{https://doi.org/10.5281/zenodo.3732903}{Zenodo}.
./man/read_watercourse_100mseg.Rd:73:\href{https://doi.org/10.5281/zenodo.4452577}{Zenodo}, 
and contains two
./man/read_watercourse_100mseg.Rd:83:\href{https://doi.org/10.5281/zenodo.4420904}{\code{watercourses}} 
data
./man/read_watersurfaces_hab.Rd:66:\href{https://doi.org/10.5281/zenodo.3386857}{watersurface 
map of Flanders}.
./man/read_watersurfaces_hab.Rd:71:\href{https://doi.org/10.5281/zenodo.3374645}{Zenodo}, 
that contains:


Can this be resolved using \doi{} as suggested, while still resulting in 
a working link to doi.org? I didn't find a way to do that.

Perhaps a 'https://doi.org' address which does not show as such in the 
documentation (because of the clickable label) should still be allowed.


With regards

Floris Vanderhaeghe
#
On 30/03/2021 9:44 a.m., Floris Vanderhaeghe wrote:
I just tried \doi{10.5281/zenodo.2611233} and it worked.

Duncan Murdoch
#
Sure, but what about making a hyperlink to 
https://doi.org/10.5281/zenodo.2611233 while showing "text" in the 
documentation, as in \href{wwwaddress}{text}. I assume the CRAN note 
appears because it wants literal DOI strings in the documentation to be 
specified with \doi{}. However with \href{} the DOI string remains hidden.

href{\doi{10.5281/zenodo.2611233}}{text} is a non-functional link while 
\href{https://doi.org/10.5281/zenodo.2611233}{text} is functional.
#
This is a recent addition to R checks. I am pretty sure that \doi{} with the suggested syntax does produce proper links in the documentation.

Georgi Boshnakov

-----Original Message-----
From: R-package-devel <r-package-devel-bounces at r-project.org> On Behalf Of Floris Vanderhaeghe
Sent: 30 March 2021 14:45
To: r-package-devel at r-project.org
Subject: [R-pkg-devel] CRAN note about \href{https://doi.org/...}{label} in Rd files

Hi,

When running R CMD check on R-devel, a CRAN note appears about \href{https://doi.org/...}{label} in Rd files. Like:

Found the following URLs which should use \doi (with the DOI name only):
 ? File ?read_GRTSmh.Rd?:
 ??? https://doi.org/10.5281/zenodo.2611233
 ??? https://doi.org/10.5281/zenodo.3354403
 ? File ?read_GRTSmh_base4frac.Rd?:
 ??? https://doi.org/10.5281/zenodo.3354401

(Full output is at
https://github.com/inbo/n2khab/runs/2219662325?check_suite_focus=true#step:10:35)

The note does not appear in R 4.0.4.

The cause is documentation hyperlinks to doi.org, ** inside \href{} **:

./man/read_GRTSmh.Rd:42:\href{https://doi.org/10.5281/zenodo.2611233}{Zenodo},
is a monolayered GeoTIFF
./man/read_GRTSmh.Rd:73:\href{https://doi.org/10.5281/zenodo.3354403}{Zenodo},
and can only be
./man/read_GRTSmh_base4frac.Rd:33:\href{https://doi.org/10.5281/zenodo.3354401}{Zenodo}.
./man/read_GRTSmh_diffres.Rd:45:at
\href{https://doi.org/10.5281/zenodo.3354405}{Zenodo}), composed of ./man/read_habitatmap_stdized.Rd:68:\href{https://doi.org/10.5281/zenodo.3355192}{Zenodo},
that
./man/read_habitatmap_terr.Rd:117:\href{https://doi.org/10.5281/zenodo.3468948}{Zenodo},
that contains:
./man/read_habitatquarries.Rd:70:\href{https://doi.org/10.5281/zenodo.4072967}{Zenodo},
that contains:
./man/read_habitatsprings.Rd:83:\href{https://doi.org/10.5281/zenodo.3550994}{Zenodo}.
./man/read_soilmap.Rd:225:\href{https://doi.org/10.5281/zenodo.3732903}{Zenodo}.
./man/read_watercourse_100mseg.Rd:73:\href{https://doi.org/10.5281/zenodo.4452577}{Zenodo},
and contains two
./man/read_watercourse_100mseg.Rd:83:\href{https://doi.org/10.5281/zenodo.4420904}{\code{watercourses}}
data
./man/read_watersurfaces_hab.Rd:66:\href{https://doi.org/10.5281/zenodo.3386857}{watersurface
map of Flanders}.
./man/read_watersurfaces_hab.Rd:71:\href{https://doi.org/10.5281/zenodo.3374645}{Zenodo},
that contains:


Can this be resolved using \doi{} as suggested, while still resulting in a working link to doi.org? I didn't find a way to do that.

Perhaps a 'https://doi.org' address which does not show as such in the documentation (because of the clickable label) should still be allowed.


With regards

Floris Vanderhaeghe

______________________________________________
R-package-devel at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-package-devel
#
On 30/03/2021 10:39 a.m., Floris Vanderhaeghe wrote:
No, I don't think there's currently any way to do that.  Your choices 
are probably to link to whatever the DOI links to, e.g. 
\href{https://zenodo.org/record/2682323}{text} and live with the fact 
that the URL might change tomorrow, or show the DOI.

Duncan Murdoch
#
On 30/03/2021 12:36 p.m., Duncan Murdoch wrote:
One other suggestion:  define your own \doi{} macro.  The current 
definition (from R_HOME/share/Rd/macros/system.Rd) is

\newcommand{\doi}{\Sexpr[results=rd,stage=build]{tools:::Rd_expr_doi("#1")}}

You could make a two-argument variant on this.  You could even submit it 
as a patch on Bugzilla if you think others would like it.

Duncan Murdoch
#
Op 30/03/2021 om 18:46 schreef Duncan Murdoch:
Thanks for the helpful answers Duncan, I will consider.

Best

Floris
#
Indeed, \doi{} produces proper links. But I think the note should not be 
triggered when a https://doi.org address is used inside 
\href{doiURL}{text}, where the purpose is to show "text", not a 
DOI-string in standard format. In that way it would remain possible to 
link "text" to a stable doi-URL.

Using \href{doiURL}{text} currently triggers the DOI note.