Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/snippets/snippets/commentLine.snippet
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ language: xml | html | markdown

language: vimscript
-
"$0
" $0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please split this out into a separate PR since it has nothing to do with R.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's true, but is it really necessary? This change is tiny

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes :) The PR will also be tiny.

---

language: r
-
#$0
# $0
---

language: stata
Expand Down
40 changes: 40 additions & 0 deletions lang/r/code_common_function.talon-list
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,36 @@ as double: "as.double"
as factor: "as.factor"
as integer: "as.integer"
as numeric: "as.numeric"
as matrix: "as.matrix"
base read RDS: "readRDS"
base save RDS: "saveRDS"
cable: "kable"
column names: "colnames"
correlation: "cor"
coalesce: "coalesce"
count: "count"
covariance: "cov"
describe: "describe"
eigen: "eigen"
en column: "ncol"
en row: "nrow"
ex table: "xtable"
get working directory: "getwd"
grep: "grep"
grepple: "grepl"
head: "head"
if else: "ifelse"
install packages: "install.packages"
is NA: "is.na"
is not NA: "!is.na"
is character: "is.character"
is data frame: "is.data.frame"
is date: "is.Date"
is double: "is.double"
is factor: "is.factor"
is integer: "is.integer"
is numeric: "is.numeric"
is matrix: "is.matrix"
length: "length"
library: "library"
list files: "list.files"
Expand All @@ -41,11 +56,16 @@ paste: "paste0"
print: "print"
reorder: "reorder"
repeat: "rep"
row names: "rownames"
scale: "scale"
sequence along: "seq_along"
sequence length: "seq_len"
sequence: "seq"
set working directory: "setwd"
set difference: "setdiff"
set diff: "setdiff"
sym diff: "symdiff"
symmetric diff: "symdiff"
sort: "sort"
subset: "subset"
sum: "sum"
Expand All @@ -55,14 +75,18 @@ tidy: "tidy"
trim white space: "trimws"
type: "typeof"
unique: "unique"
union all: "union_all"
vector: "c"
vee table: "vtable"
view: "View"
# dplyr
all of: "all_of"
anti join: "anti_join"
any of: "any_of"
arrange: "arrange"
as tibble: "as_tibble"
bind rows: "bind_rows"
bind columns: "bind_cols"
case when: "case_when"
distinct: "distinct"
everything: "everything"
Expand All @@ -73,17 +97,27 @@ group by: "group_by"
inner join: "inner_join"
left join: "left_join"
mutate: "mutate"
N A if: "na_if"
pull: "pull"
rename all: "rename_all"
rename: "rename"
row number: "row_number"
rows append: "rows_append"
rows delete: "rows_delete"
rows insert: "rows_insert"
rows patch: "rows_patch"
rows update: "rows_update"
rows upsert: "rows_upsert"
right join: "right_join"
select all: "select_all"
select: "select"
semi join: "semi_join"
slice: "slice"
starts with: "starts_with"
summarise: "summarise"
tibble: "tibble"
ungroup: "ungroup"
unlist: "unlist"
# ggplot2
coord cartesian: "coor_cartesian"
element text: "element_text"
Expand Down Expand Up @@ -122,6 +156,12 @@ string contains: "str_detect"
string detect: "str_detect"
string replace all: "str_replace_all"
string replace: "str_replace"
string remove: "str_removed"
string remove all: "str_removed_all"
string sub: "str_sub"
string substitute: "str_sub"
string trim: "str_trim"
string pad: "str_pad"
# tidyr
drop NA: "drop_na"
gather: "gather"
Expand Down
6 changes: 6 additions & 0 deletions lang/r/r.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ def code_get_operators() -> Operators:
def code_insert_null():
actions.auto_insert("NULL")

def code_insert_is_null():
actions.user.insert_between("is.null(", ")")

def code_insert_is_not_null():
actions.user.insert_between("!is.null(", ")")

def code_insert_true():
actions.auto_insert("TRUE")

Expand Down
6 changes: 6 additions & 0 deletions lang/r/r.talon
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ library <user.code_libraries>:
" %>%"
key(enter)
state na: insert("NA")
state na character: insert("NA_character_")
state na real: insert("NA_real_")
state na complex: insert("NA_complex_")
state na integer: insert("NA_integer_")
Comment on lines 32 to +36
Copy link
Collaborator

@nriley nriley Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From the Community Backlog Session — since all of these are reserved words/keywords in the R language, we should switch these over to keywords. Please add a deprecation for "state na".

is N A: user.insert_between("is.na(", ")")
is not N A: user.insert_between("!is.na(", ")")

# TODO: migrate to function tag
^function define <user.text>$: user.code_private_function(text)
Expand Down