RMarkdown question

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

RMarkdown question

Roy Mendelssohn - NOAA Federal
Hi All:

In creating a R Notebook I know that in the text I can  link to a (sub) section by using the command:

 
[Header 1](#anchor)


 and putting the appropriate anchor name at the appropriate header.  But can the same be done for code chunks,  if the code chunk is named? What I want to do is say that such and such code chunk is an example of how to do something,  and have that link to the appropriate code chunk.

Thanks for any help.

-Roy





**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new street address***
110 McAllister Way
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: [hidden email] www: http://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected"
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.

______________________________________________
[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: RMarkdown question

Jeff Newmiller
You are sadly confusing R Notebooks with other knitr-based processing formats such as bookdown/LaTeX, as I have in the past.  The features available for cross-referencing are strongly tied to the underlying handling of knitr output. This area of "knitr" functionality is a recurring area where new users I have shown knitr to complain of a bait and switch and often wander away as it clearly is not a write-once-output-many tool. But if you are willing to drop the Notebook idea then bookdown is not bad.

There is also a distinct lack of R content in this posting...

--
Sent from my phone. Please excuse my brevity.

On August 29, 2017 11:30:18 AM PDT, Roy Mendelssohn - NOAA Federal <[hidden email]> wrote:

>Hi All:
>
>In creating a R Notebook I know that in the text I can  link to a (sub)
>section by using the command:
>
>
>[Header 1](#anchor)
>
>
>and putting the appropriate anchor name at the appropriate header.  But
>can the same be done for code chunks,  if the code chunk is named? What
>I want to do is say that such and such code chunk is an example of how
>to do something,  and have that link to the appropriate code chunk.
>
>Thanks for any help.
>
>-Roy
>
>
>
>
>
>**********************
>"The contents of this message do not reflect any position of the U.S.
>Government or NOAA."
>**********************
>Roy Mendelssohn
>Supervisory Operations Research Analyst
>NOAA/NMFS
>Environmental Research Division
>Southwest Fisheries Science Center
>***Note new street address***
>110 McAllister Way
>Santa Cruz, CA 95060
>Phone: (831)-420-3666
>Fax: (831) 420-3980
>e-mail: [hidden email] www: http://www.pfeg.noaa.gov/
>
>"Old age and treachery will overcome youth and skill."
>"From those who have been given much, much will be expected"
>"the arc of the moral universe is long, but it bends toward justice"
>-MLK Jr.
>
>______________________________________________
>[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.
Reply | Threaded
Open this post in threaded view
|

Re: RMarkdown question

Yihui Xie-2
In reply to this post by Roy Mendelssohn - NOAA Federal
Although it is not an elegant solution, but if your output format is
HTML, you can add an arbitrary empty HTML element like <span
id="foo"></span> before your code chunk. Then you can jump to this
<span> via a link like "see [this code chunk](#foo)".

Regards,
Yihui
--
https://yihui.name


On Tue, Aug 29, 2017 at 1:30 PM, Roy Mendelssohn - NOAA Federal
<[hidden email]> wrote:

> Hi All:
>
> In creating a R Notebook I know that in the text I can  link to a (sub) section by using the command:
>
>
> [Header 1](#anchor)
>
>
>  and putting the appropriate anchor name at the appropriate header.  But can the same be done for code chunks,  if the code chunk is named? What I want to do is say that such and such code chunk is an example of how to do something,  and have that link to the appropriate code chunk.
>
> Thanks for any help.
>
> -Roy
>
>
>
>
>
> **********************
> "The contents of this message do not reflect any position of the U.S. Government or NOAA."
> **********************
> Roy Mendelssohn
> Supervisory Operations Research Analyst
> NOAA/NMFS
> Environmental Research Division
> Southwest Fisheries Science Center
> ***Note new street address***
> 110 McAllister Way
> Santa Cruz, CA 95060
> Phone: (831)-420-3666
> Fax: (831) 420-3980
> e-mail: [hidden email] www: http://www.pfeg.noaa.gov/
>
> "Old age and treachery will overcome youth and skill."
> "From those who have been given much, much will be expected"
> "the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
>
> ______________________________________________
> [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.
Reply | Threaded
Open this post in threaded view
|

Re: RMarkdown question

Roy Mendelssohn - NOAA Federal
Thanks.  I will try that and see if I can get it to work.  I am working on a vignette for a package.  I should have been more careful in my wording,  it was really a RMarkdown question,  not specifically an RNotebook question.  I will leave to others to decide if that implies R content, I am just grateful for the help.

-Roy

> On Aug 29, 2017, at 2:52 PM, Yihui Xie <[hidden email]> wrote:
>
> Although it is not an elegant solution, but if your output format is
> HTML, you can add an arbitrary empty HTML element like <span
> id="foo"></span> before your code chunk. Then you can jump to this
> <span> via a link like "see [this code chunk](#foo)".
>
> Regards,
> Yihui
> --
> https://yihui.name
>
>
> On Tue, Aug 29, 2017 at 1:30 PM, Roy Mendelssohn - NOAA Federal
> <[hidden email]> wrote:
>> Hi All:
>>
>> In creating a R Notebook I know that in the text I can  link to a (sub) section by using the command:
>>
>>
>> [Header 1](#anchor)
>>
>>
>> and putting the appropriate anchor name at the appropriate header.  But can the same be done for code chunks,  if the code chunk is named? What I want to do is say that such and such code chunk is an example of how to do something,  and have that link to the appropriate code chunk.
>>
>> Thanks for any help.
>>
>> -Roy
>>
>>
>>
>>
>>
>> **********************
>> "The contents of this message do not reflect any position of the U.S. Government or NOAA."
>> **********************
>> Roy Mendelssohn
>> Supervisory Operations Research Analyst
>> NOAA/NMFS
>> Environmental Research Division
>> Southwest Fisheries Science Center
>> ***Note new street address***
>> 110 McAllister Way
>> Santa Cruz, CA 95060
>> Phone: (831)-420-3666
>> Fax: (831) 420-3980
>> e-mail: [hidden email] www: http://www.pfeg.noaa.gov/
>>
>> "Old age and treachery will overcome youth and skill."
>> "From those who have been given much, much will be expected"
>> "the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
>>
>> ______________________________________________
>> [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.
>

**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new street address***
110 McAllister Way
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: [hidden email] www: http://www.pfeg.noaa.gov/

"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected"
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.

______________________________________________
[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.