rbind / njtierney.com

Nick Tierney's website
http://www.njtierney.com/
8 stars 4 forks source link

Notes on Changing from Rmarkdown/Bookdown to Quarto | Credibly Curious #66

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

Notes on Changing from Rmarkdown/Bookdown to Quarto | Credibly Curious

https://www.njtierney.com/post/2022/04/11/rmd-to-qmd/

myaseen208 commented 2 years ago

Great post. It would be nice if you guide how to change Rmarkdown/blogdown to quarto. Regards

njtierney commented 2 years ago

Thanks! Yes I think changing a website over from blogdown is on the cards, but it might be a while until I have the time.

aito123 commented 2 years ago

Nice post, i'm also exploring quarto to create my thesis in MS Word. Do you know if its possible to create a cover for a quarto boook in MS Word? How do you plan to insert your book cover in the printed edition of the book? let me know, thanks

njtierney commented 2 years ago

Hey there,

Thanks!

I haven't done this myself, as I haven't had a book be printed before. But searching the quarto website, it looks like there is a way to do this: https://quarto.org/docs/books/book-output.html#cover-images

Looking at the R4DS book, they do something with cover images here: https://github.com/hadley/r4ds/search?q=cover

If you've got other questions, a good place to ask is on https://community.rstudio.com/ - lots of people who know a lot more about quarto are there :) - I'm happy to help, but those folks might be able to help you faster than me :)

rainer-rq-koelle commented 1 year ago

To address the "build" problem: open the myprojectname.Rproj file and delete the line "BuildType: site" (this tells RStudio that you are building a [rmarkdown]website). Next close and open the project. When RStudio restarts, it should recognise the "quarto" project, and you should see "Render Book" and "Preview Book" in your build pane.

hao203 commented 1 year ago

There are lots of bugs in Quarto. I don't know why create that module. It is really unnecessary. R markdown is enough.

statkclee commented 1 year ago

This blog post is exactly what I was looking for. Soon or later I'll convert Reeborg bookdown1 into Quarto Book. Thank you so much.

fjodor commented 1 year ago

Thank you for this detailed post! Great to see early adopters sharing their experiences. It took me longer to get started ... Your post, along with a few others, inspired me to a video. Credits given in description and on penultimate slide.

R Markdown Users: Why you should switch to Quarto NOW https://youtu.be/mGNW8jl7RMc

wmmurrah commented 1 year ago

I also had the problem that when I changed an RStudio project from Rmarkdown to quarto, the build tab attempted to use Rmarkdown. I finally deleted the project.Rproj file, and created a new RStudio project from the project directory. That seemed to change the build tab to use quarto.

ejjunju commented 1 year ago

How do i make my quarto document save the figures generated in the chucnks to a folder?

rainer-rq-koelle commented 1 year ago

Emmanuel, using {ggplot2} you can simply call ggsave() function.

If the function is called and no specific plot-object is given, it will save out the “latest” plot to the given filename you provide. The format is taken from the filename, e.g. yourname.png. Please check, if the default options for height/width and dpi (default 300) are in line with your anticipated result.

If you want to show the plot in your code chunk and save the plot I recommend you assign it to a variable/object. For example:

myplot <- ggplot(data = mydata, aes(x =var1, y = var2) + geom_point().
ggsave(filename = “.figures/myplot.png”, plot = myplot)   # specify last plot to save out
myplot                                                                                           # calling the plot object (again), it will be printed/shown

The logic/sequence works with other plotting engines. Just save it to your filesystem, then show the plot. Just check for the right sequence of commands.

From: Emmanuel Jjunju @.> Sent: 07 February 2023 12:52 To: rbind/njtierney.com @.> Cc: KOELLE Rainer @.>; Comment @.> Subject: Re: [rbind/njtierney.com] Notes on Changing from Rmarkdown/Bookdown to Quarto | Credibly Curious (Issue #66)

How do i make my quarto document save the figures generated in the chucnks to a folder?

— Reply to this email directly, view it on GitHubhttps://github.com/rbind/njtierney.com/issues/66#issuecomment-1420648409, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AECN7JEROKLRE23FMDNF32DWWIZNRANCNFSM5TCSCEGA. You are receiving this because you commented.Message ID: @.***>


This message and any files transmitted with it are legally privileged and intended for the sole use of the individual(s) or entity to whom they are addressed. If you are not the intended recipient, please notify the sender by reply and delete the message and any attachments from your system. Any unauthorised use or disclosure of the content of this message is strictly prohibited and may be unlawful.

Nothing in this e-mail message amounts to a contractual or legal commitment on the part of EUROCONTROL, unless it is confirmed by appropriately signed hard copy.

Any views expressed in this message are those of the sender.

njtierney commented 10 months ago

Heya @ejjunju and @rainer-rq-koelle

You don't need to use ggsave() inside an r chunk - your plots are saved when you render the document, but the catch is that you need to name the code chunk, and also set some YAML options:

---
title: "Your report"
output:
  html_document:
    keep_md: true
---
```{r gg-mtcars}
ggplot(mtcars, aes(disp, mpg)) + geom_point()


See https://rmd4sci.njtierney.com/customising-your-figures#keeping-your-figures for more details