Skip to content

Commit 1ba6b51

Browse files
committed
w
1 parent 4001913 commit 1ba6b51

12 files changed

Lines changed: 4091 additions & 587 deletions

File tree

.DS_Store

0 Bytes
Binary file not shown.

Publish/.DS_Store

0 Bytes
Binary file not shown.

Publish/2 quarto/.DS_Store

0 Bytes
Binary file not shown.
Lines changed: 278 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ install.packages("quarto")
3939

4040
## in Terminal
4141

42-
```{bach filename="Terminal"}
42+
```{bash filename="Terminal"}
4343
#| eval: false
4444
quarto check
4545
```
@@ -75,14 +75,70 @@ import sys
7575
print(sys.version)
7676
```
7777

78-
## Bath
78+
## Bash
7979

8080

8181
```{{bash}}
8282
echo "foo"
8383
```
8484

8585

86+
# calling variable between R and Python
87+
88+
There are R variable: r_var and Python version:python_var
89+
90+
```{{r}}
91+
r_var=111
92+
```
93+
94+
```{r}
95+
#| echo: false
96+
r_var=111
97+
```
98+
99+
100+
```{{python}}
101+
python_var=222
102+
```
103+
104+
105+
```{python}
106+
#| echo: false
107+
python_var=222
108+
```
109+
110+
::: panel-tabset
111+
112+
## calling python variable in R
113+
```{{python}}
114+
r.r_var
115+
```
116+
117+
```{python}
118+
#| echo: false
119+
r.r_var
120+
```
121+
122+
123+
## calling R variable in Python
124+
```{{r}}
125+
library(reticulate)
126+
py$python_var
127+
```
128+
129+
```{r}
130+
#| echo: false
131+
library(reticulate)
132+
py$python_var
133+
```
134+
135+
136+
137+
138+
:::
139+
140+
141+
86142
# quarto code chunk option
87143

88144
## in YAML header
@@ -170,19 +226,18 @@ superscript^2^
170226

171227
`highlight`
172228

173-
# link
229+
## link
174230

175-
```{r}
176-
#| eval: false
231+
````
177232
[link](www.rstudio.com)
178-
```
233+
````
234+
179235

180236
[link](www.rstudio.com)
181237

182-
# tab
238+
## tab
183239

184-
```{r}
185-
#| eval: false
240+
````
186241
::: {.panel-tabset}
187242
188243
## Tab 1
@@ -195,19 +250,19 @@ This is tab 1
195250
This is tab 2
196251
197252
:::
198-
```
253+
````
199254

200255
::: panel-tabset
201-
## Tab 1
256+
### Tab 1
202257

203258
This is tab 1
204259

205-
## Tab 2
260+
### Tab 2
206261

207262
This is tab 2
208263
:::
209264

210-
# column display
265+
## column display
211266

212267
```{r}
213268
#| eval: false
@@ -346,6 +401,7 @@ quarto render "tidymodel in R"
346401
# embed audio
347402

348403
::: panel-tabset
404+
349405
## in code
350406

351407
```{r}
@@ -372,6 +428,7 @@ format:
372428
- aa.mp3
373429
---
374430
```
431+
375432
:::
376433

377434

@@ -434,7 +491,7 @@ source:https://quarto.org/docs/output-formats/html-themes.html
434491
## render a folder or file
435492

436493

437-
```{bach filename="Terminal"}
494+
```{bash filename="Terminal"}
438495
#| eval: false
439496
quarto render introduction.qmd
440497
quarto render subdir/
@@ -527,6 +584,212 @@ https://github.com/apps/giscus
527584
```
528585

529586

530-
# Reference:
587+
#### step 3b or using comment for all page
588+
589+
add into _quarto.yml
590+
591+
```{r filename="_quarto.yml"}
592+
#| eval: false
593+
format:
594+
html:
595+
include-after-body:
596+
- text: <script src="https://giscus.app/client.js" data-repo="[ENTER REPO HERE]" data-repo-id="[ENTER REPO ID HERE]" data-category="[ENTER CATEGORY NAME HERE]" data-category-id="[ENTER CATEGORY ID HERE]" data-mapping="pathname" data-strict="0" data-reactions-enabled="1" data-emit-metadata="0" data-input-position="bottom" data-theme="preferred_color_scheme" data-lang="en" crossorigin="anonymous" async> </script>
597+
598+
```
599+
600+
601+
602+
603+
# quarto engine
604+
605+
Quarto is a multi-language, next generation version of R Markdown from RStudio, with many new features and capabilities
606+
607+
608+
::: panel-tabset
609+
610+
## using R
611+
612+
by defalut,Quarto uses Knitr to execute R code
613+
614+
```{r}
615+
#| eval: false
616+
#|
617+
title: "matplotlib demo"
618+
format:
619+
html:
620+
code-fold: true
621+
622+
```
623+
624+
625+
## using Python
626+
627+
when set jupyter: python3 it will run quarto file with python
628+
629+
### First, install jupyter & rpy2
630+
631+
```{bash}
632+
#| eval: false
633+
pip install jupyter
634+
pip install rpy2
635+
```
636+
637+
638+
### add engine jupyter: python3
639+
```{r}
640+
#| eval: false
641+
---
642+
title: "ggplot2 demo"
643+
author: "Norah Jones"
644+
date: "5/22/2021"
645+
format:
646+
html:
647+
code-fold: true
648+
jupyter: python3
649+
---
650+
```
651+
652+
Note that when rendering an .ipynb Quarto will not execute the cells within the notebook by default (the presumption being that you have already executed them while editing the notebook)
653+
654+
You can also specify this behavior within the notebook’s YAML front matter:
655+
656+
```{r}
657+
#| eval: false
658+
---
659+
title: "My Notebook"
660+
execute:
661+
enabled: true
662+
---
663+
```
664+
665+
### Run R in python code chunk under python environment
666+
667+
668+
669+
```{python}
670+
#| eval: false
671+
%load_ext rpy2.ipython
672+
```
673+
674+
675+
```{python}
676+
#| eval: false
677+
%%R
678+
print(R.version)
679+
```
680+
681+
:::
682+
683+
# quarto output format
684+
685+
686+
::: panel-tabset
687+
688+
## html
689+
690+
```{r}
691+
#| eval: false
692+
---
693+
title: "ggplot2 demo"
694+
author: "Tony D"
695+
date: "5/22/2021"
696+
format:
697+
html
698+
---
699+
700+
```
701+
702+
703+
704+
## pdf
705+
706+
```{r}
707+
#| eval: false
708+
---
709+
title: "ggplot2 demo"
710+
author: "Tony D"
711+
date: "5/22/2021"
712+
format:
713+
pdf
714+
---
715+
716+
```
717+
718+
## MS words
719+
720+
```{r}
721+
#| eval: false
722+
---
723+
title: "ggplot2 demo"
724+
author: "Tony D"
725+
date: "5/22/2021"
726+
format:
727+
docx
728+
---
729+
730+
```
731+
732+
733+
## MS PowerPoint
734+
735+
```{r}
736+
#| eval: false
737+
---
738+
title: "ggplot2 demo"
739+
author: "Tony D"
740+
date: "5/22/2021"
741+
format:
742+
pptx
743+
---
744+
745+
```
746+
747+
748+
749+
## Revealjs
750+
751+
```{r}
752+
#| eval: false
753+
---
754+
title: "ggplot2 demo"
755+
author: "Tony D"
756+
date: "5/22/2021"
757+
format:
758+
revealjs
759+
---
760+
761+
```
762+
763+
764+
## multi ouput format at once
765+
766+
```{r}
767+
#| eval: false
768+
---
769+
title: "ggplot2 demo"
770+
author: "Tony D"
771+
date: "5/22/2021"
772+
format:
773+
html: default
774+
revealjs: default
775+
---
776+
777+
```
778+
779+
780+
781+
782+
783+
## Others
784+
785+
<iframe width="900" height="600" src="https://quarto.org/docs/output-formats/all-formats.html"></iframe>
786+
787+
788+
789+
790+
:::
791+
792+
793+
# Reference
531794

532795
https://www.rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf

0 commit comments

Comments
 (0)