简体   繁体   中英

How to group commands by date and time in the history pane of RStudio?

I found this article: https://support.rstudio.com/hc/en-us/articles/200526217-Command-History and it implies RStudio supports date/time command grouping out of the box:

在此处输入图片说明

However, mine does not look like this:

在此处输入图片说明

What do I need to do to allow this grouping?

Probably a question for the support forums (perhaps pile on to this question ?), especially since I run the up-to-the-half-day recent Preview versions of RStudio on macOS and I don't see the date groupings as well.

You could also work with the history data independent of the History tab:

library(stringi)
library(purrr)
library(dplyr)

stri_read_lines("~/.rstudio-desktop/history_database") %>% 
  stri_split_fixed(":", 2) %>% 
  map_df(function(x) {
    data_frame(ts=as.POSIXct(as.numeric(x[1])/1000, origin="1970-01-01 00:00:00"),
               line=x[2]) %>% 
      mutate(date=as.Date(ts), hour=format(ts, "%H")) %>% 
      select(ts, date, hour, line)
  }) -> hist_db

group_by(hist_db, date, hour)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM