Markus :rstats: :neovim: · @mackan
43 followers · 25 posts · Server fosstodon.org

Did you know that you can change your theme? You can even create your own theme using CSS and SCSS. Check it out:

quarto.org/docs/output-formats

Day 22 out

#quarto #30DaysOfCode

Last updated 2 years ago

Markus :rstats: :neovim: · @mackan
43 followers · 27 posts · Server fosstodon.org

"Always err on the side of caution, and simplicity. It’s easier to give people more functionality than it is to take away stuff they’re used to."

I just wanted to share this quote from chapter 12 in r-pkgs.org/.

Day 21 out

#30DaysOfCode

Last updated 2 years ago

Markus :rstats: :neovim: · @mackan
43 followers · 32 posts · Server fosstodon.org

Did you know that there is a tidyverse design guide? It covers everything from camelCase vs snake_case to the underlying philosophy. Check it out!

design.tidyverse.org/index.htm

Day 20 out of

#rstats #30DaysOfCode

Last updated 2 years ago

Markus :rstats: :neovim: · @mackan
42 followers · 28 posts · Server fosstodon.org

I enjoy staying up to date on my favorite topics via RSS feeds. One of my favorite RSS clients is the client newsboat. What is your favorite RSS feeds? How do you find new feeds to follow?

Newsboat: newsboat.org/

Day 19 of

#rstats #linux #economics #vim #terminal #30DaysOfCode

Last updated 2 years ago

Markus :rstats: :neovim: · @mackan
41 followers · 30 posts · Server fosstodon.org

Did you know that there are mastodon clients for your ? I use toot to browse Mastodon on my desktop, check it out here:

github.com/ihabunek/toot

What is your favorite Mastodon client?

Day 18 out of

#terminal #30DaysOfCode

Last updated 2 years ago

Markus :rstats: :neovim: · @mackan
38 followers · 30 posts · Server fosstodon.org

Did you know that you can enumerate tables in ? Simply give it a label by inserting:

```
#| label: "tbl-mylabel"
```

In the same chunk you create the table in. The table will then be both cross-referenceable and enumerated. Learn more here: quarto.org/docs/authoring/tabl

Day 17 out of

#quarto #rstats #30DaysOfCode

Last updated 2 years ago

Markus :rstats: :neovim: · @mackan
36 followers · 30 posts · Server fosstodon.org

If you are already an expert dplyr data wrangler, you should probably tabulate your data with {gt}. {gt} allows you to turn your nice-looking tibbles into {PDF, HTML, DOCX} tables – perfect for . Learn more about it on their website, gt.rstudio.com/.

Day 16 out of

#rstats #quarto #30DaysOfCode

Last updated 2 years ago

Markus :rstats: :neovim: · @mackan
36 followers · 30 posts · Server fosstodon.org

If you live in the and know how to exit (but stay voluntarily), you should give the email client a try. Mutt enables you to edit email messages in vim, and send emails directly from the terminal.

Day 15 of

#terminal #vim #mutt #30DaysOfCode

Last updated 2 years ago

Markus :rstats: :neovim: · @mackan
36 followers · 33 posts · Server fosstodon.org

Have you tried creating charts with mermaid in ? Mermaid generates beautiful charts using plain text. I especially like the flow charts or git branch charts. Learn more about it here: quarto.org/docs/authoring/diag

Day 14 of

#quarto #30DaysOfCode

Last updated 2 years ago

Markus :rstats: :neovim: · @mackan
34 followers · 31 posts · Server fosstodon.org

Did you know that it is relatively easy to create your own theme in ? Especially if you frequently change theme options already.

To create your theme:

```
my_theme <- function () {
theme(
...
)
```

Where ... is your theme options[^1]

You are then able to add this to your ggplot `plot`:

```
plot + my_theme()
```

[^1]: ggplot2.tidyverse.org/referenc

Day 13 of

#ggplot #rstats #30DaysOfCode

Last updated 2 years ago

Markus :rstats: :neovim: · @mackan
33 followers · 29 posts · Server fosstodon.org

"Crash early" [^1]

Do you check that the input of your functions are correct? It is often useful to "crash" your function early if the input is incorrect (e.g when a string is provided, but the function relies on numerical values) and provide useful error messages. A useful package to ensure that you crash early is checkmate.

Read more about it here:
mllg.github.io/checkmate/artic

[^1]: pragprog.com/titles/tpp20/the- p.205

Day 11 of

#rstats #30DaysOfCode

Last updated 2 years ago

Markus :rstats: :neovim: · @mackan
33 followers · 27 posts · Server fosstodon.org

Would you like to document your functions better, without creating a full-blown package? Docstring enables you to document your functions using roxygen style comments which you can view via ?.

Learn more about it here:
cran.r-project.org/web/package

Day 10 of

#rstats #30DaysOfCode

Last updated 2 years ago

Markus :rstats: :neovim: · @mackan
32 followers · 25 posts · Server fosstodon.org

"English is just another programming language" [^1]

languagetool.org/ is a open source grammar checker I use daily. I just found out that there is a language server for LT, with plugins available for . This essentially means that you not only can check your code with your LSP, but also the English. This must be especially useful for , which the ls supports.

Language server:
github.com/valentjn/ltex-ls

[^1]: pragprog.com/titles/tpp20/the- p.64

Day 9 of

#nvim #quarto #30DaysOfCode

Last updated 2 years ago

Markus :rstats: :neovim: · @mackan
32 followers · 25 posts · Server fosstodon.org

"English is just another programming language" [^1]

languagetool.org/ is a open source grammar checker I use daily. I just found out that there is a language server for LT, with plugins available for . This essentially means that you not only can check your code with your LSP, but also the English. This must be especially useful for , which the ls supports.

Language server:
github.com/valentjn/ltex-ls whu

[^1]: pragprog.com/titles/tpp20/the- p.64

Day 9 of

#nvim #quarto #30DaysOfCode

Last updated 2 years ago

Markus :rstats: :neovim: · @mackan
31 followers · 22 posts · Server fosstodon.org

Did you know that you can launch "background jobs" in ? This is useful if you want to render a document or run an script while working on something else.

To source the open R script:
:tabedit % | terminal Rscript %

To render the open quarto document:
:tabedit % | terminal quarto render %

To create an alias in your init.lua:

vim.cmd("command RScript tabedit % | terminal Rscript %")

Day 8 of

#nvim #quarto #rstats #30DaysOfCode

Last updated 2 years ago

Markus :rstats: :neovim: · @mackan
31 followers · 17 posts · Server fosstodon.org

"Make renaming easy, and do it often" [^1]

Sometimes you realize that your function in a project might have a bad name. Instead of ignoring the bad name, try using argadd and argdo to replace strings in multiple files with

:cd /path/to/project
:argadd ./**/*
:argdo %s/old_name/new_name/g

You can also do this with sed or other terminal tools, but I do not know how to exit vim yet.

How do you make renaming easier?

[^1]: pragprog.com/titles/tpp20/the- p.400

Day 7 of

#rstats #nvim #30DaysOfCode

Last updated 2 years ago

Mackan :rstats: :neovim: · @mackan
27 followers · 12 posts · Server fosstodon.org

My favorite resource for learning is bigbookofr.com/ by @OscarBaruffa.

The book is especially useful since it is not only easy to find new books, but also books related to previous books you already read because of the detailed categorization.

Day 5 of

#rstats #30DaysOfCode

Last updated 2 years ago

Mackan :rstats: :neovim: · @mackan
25 followers · 10 posts · Server fosstodon.org

pak is a fancy package manager for which is especially useful for Linux users. If you, for example, are unable to install a package due to missing system dependencies, pak will list which ones are missing, unlike install.packages().

Next time you are installing an R package, try installing with pak!

install.packages("pak")
pak::pkg_install("package")

Learn more about pak:
pak.r-lib.org/

Day 4 of

#rstats #30DaysOfCode

Last updated 2 years ago

Mackan :rstats: :neovim: · @mackan
25 followers · 9 posts · Server fosstodon.org

If you are like me, you enjoy project-based workflows, But may also enjoy using in the via, for example, . It is unclear how to open project files such as .Rproj or .Rprofile files when using R in the terminal.

To open these "project files", set the working directory to the project folder in the terminal, or nvim, and launch R from there. R will then source the project files of the working directory.

Day 3 of

#rstats #terminal #nvim #30DaysOfCode

Last updated 2 years ago

Mackan :rstats: :neovim: · @mackan
21 followers · 8 posts · Server fosstodon.org

httpgd is a very cool package which enables you to show plots in your web browser. This is useful if you work in , since the default graphics viewer is very basic. httpgd have all the features you would expect, such as plot history and exporting plots.

Try it:

install.packages("httpgd")
httpgd::hgd()
httpgd::hgd_browse()
plot(cars$speed, cars$dist)

For more info:
youtube.com/watch?v=i_09TMdc8g by @jmbuhr

youtube.com/watch?v=uxyhmhRVOf by @brodriguesco
Day 2 of

#rstats #nvim #30DaysOfCode

Last updated 2 years ago