Subset DT

Subsetting data.table can be done using base R subset with S3 Class for data.table object. Alternatively is to use the recode approach as mentioned in StackOverflow. lookup <- list(v1 = 1:3, v2 = letters[5:7]) DT[lookup, on = names(lookup), nomatch = NULL] This will return all columns in DT that match lookup list.

Read More

Rujukan Awam Git dan Github

Global setting Buat git repo dan R pakej Kopi branch di github ke lokal Kopi branch tertentu cara lain Log commit Tidak dapat kesan email Buat kekunci SSH dan daftarkan di Github Pelbagai akaun Permission denied ssh-agent refused operation Buat Repo melalui terminal Padam branch Git Aliases Undo atau Revert Sekiranya ada konflik Release atau tag Buat gh-page git config Tarikh kemaskini: 2022-11-07

Read More

Good to know

Updated: 2023-06-09 Things that I find it useful during my work: Debuging warnings Sometimes it’s nice to know where in the code that generate warnings especially when it’s related to NA introduced by coercion. To do this we can change the options to make warning as error.

Read More

YesNo question

Different ways to make your R session interactive for asking question and receive the answer as an input. readline You can find some example in StackOverflow or Geeksforgeeks. Basically is just like this: cp <- as.integer(readline(prompt = "Vil du kopiere filen?

Read More

Cross-reference

Reference to this is here. Section link The easierst is to use CUSTOM_ID as the example below and refer to it with text [[#sec:one][Section 1]] or reference with number only [[#sec:one]]. * Section One :PROPERTIES: :CUSTOM_ID: sec:one :END: The link with text will be '.

Read More