rstudio / distill

Distill for R Markdown
https://rstudio.github.io/distill/
Apache License 2.0
422 stars 57 forks source link

Unknown error: Error in eval(xfun::parse_only(name)) : object 'toc_float' not found #398

Open kamaulindhardt opened 3 years ago

kamaulindhardt commented 3 years ago

Could someone please help me with this error..

Thank you in advance!

I cannot deal with it, as I do not understand it and cannot interpret it.

Error in eval(xfun::parse_only(name)) : object 'toc_float' not found

It arrives in one of my output: distill::distill_article: files when I "build" the Website.

Funny enough the distill::distill_article: file can knit (individually) with no problems..(?) So what is going on here?

I have the YAML set to

---
title: "Explorortive Data Analysis"
theme: theme.css
description: |
  The product of an internship: A vignette report using the Distill format.
author:
  - first_name: "Kamau"
    last_name: "Lindhardt"
    url: https://www.linkedin.com/in/magnus-kamau-lindhardt/
    affiliation: Intern at The World Agroforestry Centre, Nairobi & MSc student at Wageningen University, The Netherlands
    affiliation_url: https://www.linkedin.com/in/magnus-kamau-lindhardt/
  - name: "Peter Steward"
    affiliation: CIFOR-ICRAF associate scientist for the CCAFS Evidence for Resilient Agriculture (ERA) project at The World Agroforestry Centre, Nairobi
    affiliation_url: https://www.worldagroforestry.org/staff/peter-steward
date: "`r Sys.Date()`"
bibliography: library.bib
csl: frontiers-in-ecology-and-the-environment.csl
output: 
  distill::distill_article:
    toc: true
    number_sections: true
    toc_depth: 4
    code_folding: true
  toc_float: 
    collapsed: false
    smooth_scroll: true
  self_contained: false
---

The full error message is:

Error in eval(xfun::parse_only(name)) : object 'toc_float' not found
Calls: <Anonymous> ... output_format_from_yaml_front_matter -> create_output_format_function -> eval -> eval
In addition: Warning message:
Ignoring unknown aesthetics: x, y 
Execution halted

Exited with status 1.

I also suspect this error to cause issues in the netlify website launch as I see the tap for this particular page is not showing.

apreshill commented 3 years ago

Hello!

You cannot use output options like this:

output: 
  distill::distill_article:
    toc: true
    number_sections: true
    toc_depth: 4
    code_folding: true
  toc_float: 
    collapsed: false
    smooth_scroll: true
  self_contained: false

Output options are nested under an output format:

output: 
  name_of_format_goes_here:
    option_goes_here

The error you are seeing is telling you that it cannot find the toc_float output format as you have it in your front matter, which is accurate. You would also get an error from self_contained as you have it too. You are also trying to use some output

Your issue with Netlify is that this particular article probably fails to be built/copied to the site directory, so there is no .html file to publish.

If you have more questions, we appreciate if you ask first on a dedicated help forum like Stack Overflow or RStudio Community, then create an issue on GitHub for things you suspect are bugs or for feature requests.

Try using just:

output: 
  distill::distill_article:
    toc: true
    number_sections: true
    toc_depth: 4
    code_folding: true

Thanks!

kamaulindhardt commented 3 years ago

Thank you @apreshill for your elaborate answer,

Distill has really become an eyeopener for me. As an agricultural scientist I am excited about the endless possibilities Distill for R Markdown give when it comes to communicating sustainability of our food and agricultural systems! Thank you for putting all this together.

I tried your suggestion. However, I still have the same problem:

Error in eval(xfun::parse_only(name)) : object 'toc_float' not found
Calls: <Anonymous> ... output_format_from_yaml_front_matter -> create_output_format_function -> eval -> eval
In addition: Warning messages:
1: Ignoring unknown aesthetics: x, y 
2: package 'here' was built under R version 3.6.2 
Execution halted

Exited with status 1.

I have no idea what's going on.. 🤨? I even tried giving it a go with specifying

toc_float:
      collapsed: false
      smooth_scroll: false

Let me know if you need any information to help out. Thank you!

kamaulindhardt commented 3 years ago

@apreshill could you kindly check my YAML now, as I wrote

output: 
  distill::distill_article:
    toc: true
    toc_float: true
    toc_depth: 3
    number_sections: true
    code_folding: true

This does not bring any other issues, than a little warning, in the separate knitting of the distill::distill_article:

Output created: _site/ExpDataAnalysis.html
Warning message:
Ignoring unknown aesthetics: x, y 

Yet, when I want to "Build Website" it does somehow give me this error:

Error in eval(xfun::parse_only(name)) : object 'toc_float' not found
Calls: <Anonymous> ... output_format_from_yaml_front_matter -> create_output_format_function -> eval -> eval
In addition: Warning messages:
1: Ignoring unknown aesthetics: x, y 
2: package 'here' was built under R version 3.6.2 
Execution halted

Exited with status 1.

My _site.yml uses: output: distill::distill_article in this way

---
name: "ERA_Agroforestry_website"
title: "ERA Agroforestry Analysis"
theme: theme.css
description: |
  ERA Agroforestry Analysis
author:
  - first_name: "Magnus Kamau Katana"
    last_name: "Lindhardt"
    url: https://www.linkedin.com/in/magnus-kamau-lindhardt/
    affiliation: Intern at The World Agroforestry Centre, Nairobi & MSc student at Wageningen University, The Netherlands
    affiliation_url: https://www.linkedin.com/in/magnus-kamau-lindhardt/
  - name: "Peter Steward"
    affiliation: CIFOR-ICRAF associate scientist for the CCAFS Evidence for Resilient Agriculture (ERA) project at The World Agroforestry Centre, Nairobi
    affiliation_url: https://www.worldagroforestry.org/staff/peter-steward
  - name: "Todd Rosenstock"
    affiliation: CIFOR-ICRAF climate change & environmental scientist at Evidence for Resilient Agriculture (ERA) project at The World Agroforestry Centre, Nairobi 
    affiliation_url: https://www.worldagroforestry.org/staff/todd-rosenstock
  - name: "Namita Joshi"
    affiliation: CIFOR-ICRAF research associate at The World Agroforestry Centre, Nairobi 
    affiliation_url: https://www.linkedin.com/in/namita-joshi-848ab1133/?originalSubdomain=ke
date: "`r Sys.Date()`"
output_dir: "_site"
navbar:
  logo:
    image: IMAGES/ERA_logo_color.png
    href: https://www.worldagroforestry.org
  right:
    - text: "PART 1: Introduction"
      href: Introduction.html
    - text: "PART 2: Explorortive Data Analysis"
      href: ExpDataAnalysis.html
    - text: "PART 3: Machine Learning with Tidymodels"
      href: ML_Tidymodels.html
    - icon: fab fa-github
      href: https://github.com/kamaulindhardt/ERA_Agroforestry_destill_website
    - icon: fa fa-twitter
      href: https://twitter.com/KamauLindhardt
    - icon: fa fa-linkedin
      href: https://www.linkedin.com/in/magnus-kamau-lindhardt/
output: distill::distill_article
---

Even if I run it without including a toc, with the YAML like this:

---
title: "Explorortive Data Analysis"
theme: theme.css
description: |
  This document is a product of my internship at the World Agroforestry Centre, Nairobi, 2021.
author:
  - first_name: "Magnus Kamau Katana"
    last_name: "Lindhardt"
    url: https://www.linkedin.com/in/magnus-kamau-lindhardt/
    affiliation: Intern at The World Agroforestry Centre, Nairobi & MSc student at Wageningen University, The Netherlands
    affiliation_url: https://www.linkedin.com/in/magnus-kamau-lindhardt/
date: "`r Sys.Date()`"
bibliography: library.bib
csl: frontiers-in-ecology-and-the-environment.csl
output: 
  distill::distill_article
---

I still get this error:

Error in eval(xfun::parse_only(name)) : object 'toc_float' not found
Calls: <Anonymous> ... output_format_from_yaml_front_matter -> create_output_format_function -> eval -> eval
In addition: Warning messages:
1: Ignoring unknown aesthetics: x, y 
2: package 'here' was built under R version 3.6.2 
Execution halted

Exited with status 1.

When I push to GitHub I get this message.. Can this be causing the error

image

Here are some screenshots of the knitted site

Screenshot 2021-08-24 at 09 36 09

Screenshot 2021-08-24 at 09 36 20

cderv commented 3 years ago

Hi @kamaulindhardt,

Yet, when I want to "Build Website" it does somehow give me this error:

The error seems to be the same. Can you check if you have a _output.yml file in your website project ? If so, there could still be a malformated YAML regarding formats.

Be sure to not have toc_float indented as if it where an output format in any of the files.

When I push to GitHub I get this message.. Can this be causing the error

I don't believe this is linked to it. It is just that you are pushing to git the rendered HTML file which seems to be self contained and pretty heavy. If you included plots, table and a lot of content, it is possible.

Also, if you have question or need help / advice, sharing with the community is a great way to learn and get feedback ! Do not hesitate to post on https://community.rstudio.com !

Thanks.