Yihui Xie's Avatar

Yihui Xie

@yihui.org

https://yihui.org

962
Followers
17
Following
21
Posts
26.03.2024
Joined
Posts Following

Latest posts by Yihui Xie @yihui.org

or:

within(data.frame(x = rnorm(10)), y <- 3 * x + 5)

23.02.2026 18:07 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

Yes, (in theory) you can. I mentioned the possibility in the last section of the post.

20.02.2026 02:36 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
The man (manual of R packages), the myth (extremely confusing), the legend (`graphics::legend()`). Generated via Google Gemini with my intentionally confusing prompts.

The man (manual of R packages), the myth (extremely confusing), the legend (`graphics::legend()`). Generated via Google Gemini with my intentionally confusing prompts.

No one understands my soul better than you.

26.01.2026 20:04 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

Sorry I'm a few years late to the party, but I'm here finally! :) yihui.org/en/2026/01/h... Thank you all so much for your generous support over the past two years!

26.01.2026 18:54 ๐Ÿ‘ 93 ๐Ÿ” 9 ๐Ÿ’ฌ 5 ๐Ÿ“Œ 2

With knitr/rmarkdown, you can also include other chunks in one chunk: bookdown.org/yihui/rmarkd... Unless I misread Knuth's paper when I was a graduate student, I think knitr had implemented what he mentioned.

18.08.2025 15:41 ๐Ÿ‘ 3 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

Unfortunately or maybe fortunately, it's no longer actively maintained because there isn't much to maintain anymore. Pin the Hugo version, and then it's stable as rock :)

15.08.2025 21:11 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

I wonder if this new $600 iPhone would last another 10 years. I'm not optimistic about it... I hate that things are so tightly tied to phones, and phone apps become the only way out.

20.05.2025 14:10 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

Finally I had to let go my 10-year-old iPhone 6 last week because I must install MS Authenticator. Basically my old iPhone couldn't install any app due to its age, which had been fine to me because I use only one app primarily until last week when certain IT department started requiring this MS app.

20.05.2025 14:07 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

And using cbind() in a loop to keep adding columns is also very inefficient (because R has to keep making new copies of `price` in the loop). You should retrieve all of the 6th columns and make the `price` data frame at the end in one go.

27.04.2025 16:48 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

eval(parse()) is neither secure nor robust. If you know variable names, you should get()/mget() them, e.g.,

mget(nasdaq100_symbols) |>
lapply(`[`, 6) |>
as.data.frame()

However, when you have to use mget() to process data, you may have to rethink your data structure: yihui.org/en/2023/04/g...

27.04.2025 16:44 ๐Ÿ‘ 5 ๐Ÿ” 0 ๐Ÿ’ฌ 2 ๐Ÿ“Œ 0

To me, closing/deleting posts without knowing what the posts really mean is most annoying problem of StackOverflow (yihui.org/en/2018/02/c...). Time and time again, they just try to destroy valid posts. This time, none of Mark Rotteveel, gnat, Wai Ha Lee, and ChrisMM seem to have expertise in R.

14.04.2025 19:12 ๐Ÿ‘ 5 ๐Ÿ” 1 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
The revised xkcd "Dependency" cartoon. The top text: "All modern social media platforms". The bottom text: "The attention span of some random person in Nebraska since 2003".

The revised xkcd "Dependency" cartoon. The top text: "All modern social media platforms". The bottom text: "The attention span of some random person in Nebraska since 2003".

This poor Nebraskan is watching every social media platform...

02.04.2025 18:03 ๐Ÿ‘ 4 ๐Ÿ” 1 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Great memory. Yes, I was the culprit :) It's been 12 years: stat.ethz.ch/pipermail/r-...

06.03.2025 14:27 ๐Ÿ‘ 8 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

If this is only intended for the profiling purpose, I think the litedown solution is much simpler than the knitr hook:

1. litedown::reactor(time = TRUE); litedown::roam() # navigate to vignettes/
2. Add

```{r}
litedown::timing_data()
```

to the end of each Rmd file, and preview them.

05.03.2025 23:20 ๐Ÿ‘ 7 ๐Ÿ” 1 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
litedown: R Markdown Reimagined

Hi Michael, I quoted this as the epigraph of this chapter: yihui.org/litedown/#ch... Please let me know if you prefer not to be quoted, and I'll be happy to remove it. Thanks!

08.12.2024 01:15 ๐Ÿ‘ 3 ๐Ÿ” 1 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
litedown: R Markdown Reimagined

The chunk option verbose = 2 in litedown does what you want, and I've finally finished documenting it: yihui.org/litedown/#se...

08.12.2024 01:12 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

I've thought about this problem many times in the past, and have also come up with a simple solution early this year (no need to repeat the object name after the assignment or use a special pipe or explicit print()). I just need to find time to document it (among many other things in litedown)...

18.11.2024 23:25 ๐Ÿ‘ 3 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 1

You might be interested in litedown (my current best effort in making things lightweight), and if you don't need executable code, you can just write plain .md posts instead of .Rmd (of course, math and bibliography are supported for .md, too).

18.11.2024 21:16 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

With great power comes a great number of Github issues.

13.11.2024 22:31 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

The wisdom is, always remember the goal is get the writing done, instead of learning what's new/cool/possible in tools for writing, which is tempting (& easier than writing) but bottomless. If LaTeX + Rnw can get the job done, there's nothing wrong of using them, even if they sound "old-fashioned".

12.11.2024 17:49 ๐Ÿ‘ 5 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

I've become one of the tired horses in recent years and can't tell if the complexity of Markdown is still far below LaTeX as claimed originally. When I created knitr, I felt there would be no reason for anyone to use Sweave anymore. Now (13 years later), I see wisdom in people who still use Sweave.

12.11.2024 17:48 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0