Hello Obsidians!

I am new to Obsidian and RStudio, and since I have stared a RStudio course I have been trying to save notes with the R code, but I can’t get what I need as shown within the screenshot. Is there a way “to code” in Obsidian as in RStudio?

Thanks :pray:

What are you missing? I’m not understanding what your case is, and it seems like Obsidian is syntax coloring r code just fine, in my case.

I tried the following:

library (tidyverse)

dat <- data.frame(
 alf = c("a", "b", "d"),
 numb = c(28L, 8L, 3L) )

( dat <- dat |> mutate(perc = percent(numb /sum(numb),digits=1))
  alf numb  perc
1  a   28  41.8%
2  b    8  11.9%
3  c    3   4.5%

And it shows as (within the Minimal theme in dark mode):

So what’s the issue?

Do note that Obsidian deals with .md files, and not .r files, so you can’t compile/run the .md files directly from Obsidian. There are extension allowing for these files to be shown within Obsidian, but then they won’t have the nice syntax coloring.

If you’re looking for a code editor to handle and run “R” code, then Obsidian is most likely not the thing for you. If you’re looking for a great note taking application, where you can document how you’re using “R” code in various settings, then Obsidian is more likely the thing to use.

1 Like

Well, firstly, I didn’t know that I had to use these ````
Than I tried to copy what you wrote, but I had this in return:

I am just taking notes about the code for RStusio

The four backticks are just needed when you’re posting example markdown and/or queries here in the forum. For your notes, in most cases it’s enough with the triple backticks, and the language specifier, like r.

When you copy from the forum into your notes, you need to make sure to use the “Paste and match style”. Otherwise the formatting will look strange and it will try to collate it into one paragraph.

Ah ok thanks!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.