@enjoys/context-engine 1.6.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (546) hide show
  1. package/README.md +8 -8
  2. package/data/color/abap.json +8 -8
  3. package/data/color/angular.json +11 -36
  4. package/data/color/apex.json +8 -8
  5. package/data/color/awk.json +40 -80
  6. package/data/color/azcli.json +8 -8
  7. package/data/color/bicep.json +8 -8
  8. package/data/color/c.json +4 -4
  9. package/data/color/caddy.json +8 -8
  10. package/data/color/cameligo.json +8 -8
  11. package/data/color/clojure.json +8 -8
  12. package/data/color/coffee.json +10 -17
  13. package/data/color/cpp.json +4 -4
  14. package/data/color/crontab.json +8 -8
  15. package/data/color/csharp.json +49 -109
  16. package/data/color/css.json +8 -32
  17. package/data/color/cypher.json +8 -8
  18. package/data/color/docker-compose.json +8 -8
  19. package/data/color/dockerfile.json +8 -8
  20. package/data/color/doctest.json +8 -8
  21. package/data/color/dotenv.json +8 -8
  22. package/data/color/ecl.json +8 -8
  23. package/data/color/elixir.json +49 -109
  24. package/data/color/flow9.json +8 -8
  25. package/data/color/freemarker2.json +61 -121
  26. package/data/color/go.json +4 -4
  27. package/data/color/graphql.json +8 -8
  28. package/data/color/hcl.json +8 -8
  29. package/data/color/html.json +13 -43
  30. package/data/color/ini.json +8 -8
  31. package/data/color/java.json +49 -109
  32. package/data/color/javascript.json +13 -43
  33. package/data/color/json.json +8 -8
  34. package/data/color/julia.json +49 -109
  35. package/data/color/less.json +10 -17
  36. package/data/color/lexon.json +8 -8
  37. package/data/color/liquid.json +61 -121
  38. package/data/color/lua.json +4 -4
  39. package/data/color/m3.json +8 -8
  40. package/data/color/makefile.json +8 -8
  41. package/data/color/markdown.json +61 -121
  42. package/data/color/mdx.json +61 -121
  43. package/data/color/mips.json +8 -8
  44. package/data/color/msdax.json +8 -8
  45. package/data/color/mysql.json +8 -8
  46. package/data/color/nestjs.json +52 -18
  47. package/data/color/nextjs.json +60 -22
  48. package/data/color/nginx.json +8 -8
  49. package/data/color/objective-c.json +4 -4
  50. package/data/color/pascal.json +8 -8
  51. package/data/color/pascaligo.json +8 -8
  52. package/data/color/perl.json +4 -4
  53. package/data/color/pgsql.json +8 -8
  54. package/data/color/php.json +13 -43
  55. package/data/color/pla.json +8 -8
  56. package/data/color/postiats.json +8 -8
  57. package/data/color/powerquery.json +8 -8
  58. package/data/color/powershell.json +40 -80
  59. package/data/color/protobuf.json +8 -8
  60. package/data/color/python.json +49 -109
  61. package/data/color/qsharp.json +8 -8
  62. package/data/color/r.json +49 -109
  63. package/data/color/razor.json +61 -121
  64. package/data/color/react.json +65 -93
  65. package/data/color/redis-cli.json +8 -8
  66. package/data/color/redis.json +8 -8
  67. package/data/color/redshift.json +8 -8
  68. package/data/color/restructuredtext.json +8 -8
  69. package/data/color/ruby.json +49 -109
  70. package/data/color/rust.json +4 -4
  71. package/data/color/sb.json +8 -8
  72. package/data/color/scala.json +2 -12
  73. package/data/color/scheme.json +8 -8
  74. package/data/color/scss.json +10 -17
  75. package/data/color/shadcn.json +11 -36
  76. package/data/color/shell.json +8 -48
  77. package/data/color/sol.json +8 -8
  78. package/data/color/sparql.json +8 -8
  79. package/data/color/sql.json +8 -8
  80. package/data/color/ssh_config.json +8 -8
  81. package/data/color/st.json +8 -8
  82. package/data/color/swift.json +56 -37
  83. package/data/color/systemd.json +8 -8
  84. package/data/color/systemverilog.json +8 -8
  85. package/data/color/tailwindcss.json +6 -24
  86. package/data/color/tcl.json +40 -80
  87. package/data/color/toml.json +8 -8
  88. package/data/color/twig.json +61 -121
  89. package/data/color/typescript.json +13 -43
  90. package/data/color/vb.json +49 -109
  91. package/data/color/wgsl.json +8 -8
  92. package/data/color/xml.json +61 -121
  93. package/data/color/yaml.json +8 -8
  94. package/data/commands/air.json +117 -59
  95. package/data/commands/alembic.json +487 -301
  96. package/data/commands/aliyun.json +158 -0
  97. package/data/commands/amplify.json +174 -0
  98. package/data/commands/ansible.json +236 -24
  99. package/data/commands/apt-get.json +244 -81
  100. package/data/commands/apt.json +294 -91
  101. package/data/commands/argo.json +212 -0
  102. package/data/commands/argocd.json +144 -35
  103. package/data/commands/atlas.json +956 -426
  104. package/data/commands/aws-copilot.json +161 -0
  105. package/data/commands/aws-vault.json +266 -140
  106. package/data/commands/az-devops.json +155 -0
  107. package/data/commands/bazel.json +328 -103
  108. package/data/commands/bq.json +177 -0
  109. package/data/commands/brew.json +444 -140
  110. package/data/commands/btop.json +132 -59
  111. package/data/commands/cabal.json +1 -1
  112. package/data/commands/calicoctl.json +154 -0
  113. package/data/commands/cd.json +90 -48
  114. package/data/commands/chamber.json +128 -0
  115. package/data/commands/choco.json +430 -134
  116. package/data/commands/chown.json +139 -59
  117. package/data/commands/cilium.json +154 -0
  118. package/data/commands/civo.json +147 -0
  119. package/data/commands/clickhouse-client.json +183 -74
  120. package/data/commands/cloudflared.json +133 -0
  121. package/data/commands/cmake.json +301 -110
  122. package/data/commands/cmctl.json +143 -0
  123. package/data/commands/cockroach.json +269 -92
  124. package/data/commands/conda.json +435 -94
  125. package/data/commands/consul.json +377 -125
  126. package/data/commands/crossplane.json +119 -0
  127. package/data/commands/crystal.json +1 -1
  128. package/data/commands/dbmate.json +498 -257
  129. package/data/commands/devspace.json +198 -0
  130. package/data/commands/django-admin.json +489 -86
  131. package/data/commands/dnf.json +428 -137
  132. package/data/commands/dockerfile.json +1 -1
  133. package/data/commands/doctl.json +510 -156
  134. package/data/commands/doppler.json +161 -0
  135. package/data/commands/dotnet.json +1 -1
  136. package/data/commands/drizzle-kit.json +435 -217
  137. package/data/commands/eb.json +201 -0
  138. package/data/commands/ecs-cli.json +132 -0
  139. package/data/commands/erlang.json +1 -1
  140. package/data/commands/eslint.json +193 -69
  141. package/data/commands/expo.json +65 -65
  142. package/data/commands/firebase.json +406 -97
  143. package/data/commands/flask.json +254 -79
  144. package/data/commands/flux.json +190 -0
  145. package/data/commands/flyctl.json +657 -148
  146. package/data/commands/flyway.json +580 -261
  147. package/data/commands/garden.json +180 -0
  148. package/data/commands/ghc.json +1 -1
  149. package/data/commands/glab.json +577 -116
  150. package/data/commands/gofmt.json +101 -51
  151. package/data/commands/golangci-lint.json +243 -89
  152. package/data/commands/gradle.json +182 -44
  153. package/data/commands/gsutil.json +197 -0
  154. package/data/commands/gunicorn.json +243 -83
  155. package/data/commands/hcloud.json +169 -0
  156. package/data/commands/helmfile.json +178 -0
  157. package/data/commands/heroku.json +239 -0
  158. package/data/commands/hg.json +502 -92
  159. package/data/commands/htop.json +151 -56
  160. package/data/commands/ibmcloud.json +184 -0
  161. package/data/commands/infisical.json +127 -0
  162. package/data/commands/influx.json +363 -119
  163. package/data/commands/iptables.json +251 -86
  164. package/data/commands/istioctl.json +129 -23
  165. package/data/commands/javac.json +1 -1
  166. package/data/commands/just.json +262 -93
  167. package/data/commands/k3d.json +156 -0
  168. package/data/commands/k3s.json +134 -0
  169. package/data/commands/k9s.json +169 -62
  170. package/data/commands/kamel.json +155 -0
  171. package/data/commands/kn.json +160 -0
  172. package/data/commands/kube-score.json +86 -0
  173. package/data/commands/kubeconform.json +98 -0
  174. package/data/commands/kubectx.json +58 -0
  175. package/data/commands/kubens.json +45 -0
  176. package/data/commands/kustomize.json +82 -17
  177. package/data/commands/lightsail.json +168 -0
  178. package/data/commands/linkerd.json +174 -0
  179. package/data/commands/linode-cli.json +360 -117
  180. package/data/commands/linux.json +1 -1
  181. package/data/commands/liquibase.json +739 -399
  182. package/data/commands/manifest.json +1 -1
  183. package/data/commands/mc.json +236 -0
  184. package/data/commands/minikube.json +264 -60
  185. package/data/commands/mix.json +1 -1
  186. package/data/commands/mongosh.json +174 -73
  187. package/data/commands/mvn.json +179 -45
  188. package/data/commands/mysql.json +1 -1
  189. package/data/commands/nest.json +270 -69
  190. package/data/commands/netlify.json +384 -92
  191. package/data/commands/next.json +221 -71
  192. package/data/commands/nft.json +299 -105
  193. package/data/commands/nim.json +1 -1
  194. package/data/commands/nomad.json +398 -139
  195. package/data/commands/npx.json +141 -58
  196. package/data/commands/nx.json +348 -82
  197. package/data/commands/ocaml.json +1 -1
  198. package/data/commands/oci.json +184 -0
  199. package/data/commands/okteto.json +164 -0
  200. package/data/commands/opam.json +1 -1
  201. package/data/commands/openstack.json +212 -0
  202. package/data/commands/packer.json +273 -92
  203. package/data/commands/pacman.json +228 -82
  204. package/data/commands/pg_dump.json +233 -83
  205. package/data/commands/pg_restore.json +224 -74
  206. package/data/commands/pipenv.json +300 -79
  207. package/data/commands/pipx.json +241 -53
  208. package/data/commands/poetry.json +521 -96
  209. package/data/commands/popeye.json +109 -0
  210. package/data/commands/prettier.json +201 -71
  211. package/data/commands/pulumi.json +409 -130
  212. package/data/commands/pytest.json +240 -92
  213. package/data/commands/railway.json +343 -91
  214. package/data/commands/rancher.json +141 -0
  215. package/data/commands/rclone.json +275 -0
  216. package/data/commands/react-native.json +57 -57
  217. package/data/commands/rebar3.json +1 -1
  218. package/data/commands/render.json +235 -72
  219. package/data/commands/rustc.json +1 -1
  220. package/data/commands/rustup.json +339 -103
  221. package/data/commands/s3cmd.json +201 -0
  222. package/data/commands/scala.json +1 -1
  223. package/data/commands/scp.json +146 -60
  224. package/data/commands/scw.json +169 -0
  225. package/data/commands/sequelize.json +629 -342
  226. package/data/commands/skaffold.json +189 -0
  227. package/data/commands/skopeo.json +100 -19
  228. package/data/commands/sops.json +112 -24
  229. package/data/commands/sqlite3.json +167 -68
  230. package/data/commands/stack.json +1 -1
  231. package/data/commands/stern.json +124 -0
  232. package/data/commands/supabase.json +433 -108
  233. package/data/commands/svn.json +509 -75
  234. package/data/commands/swiftc.json +1 -1
  235. package/data/commands/telepresence.json +122 -0
  236. package/data/commands/terraform.json +1505 -824
  237. package/data/commands/terragrunt.json +217 -83
  238. package/data/commands/tilt.json +160 -0
  239. package/data/commands/tkn.json +150 -0
  240. package/data/commands/top.json +167 -61
  241. package/data/commands/tsc.json +234 -85
  242. package/data/commands/turbo.json +263 -72
  243. package/data/commands/typeorm.json +427 -262
  244. package/data/commands/ufw.json +254 -76
  245. package/data/commands/unzip.json +154 -59
  246. package/data/commands/upcloud.json +129 -0
  247. package/data/commands/uvicorn.json +215 -73
  248. package/data/commands/vault.json +462 -144
  249. package/data/commands/velero.json +141 -0
  250. package/data/commands/vercel.json +410 -98
  251. package/data/commands/vite.json +239 -63
  252. package/data/commands/vultr.json +157 -0
  253. package/data/commands/wasm-pack.json +254 -90
  254. package/data/commands/winget.json +466 -131
  255. package/data/commands/wrangler.json +129 -29
  256. package/data/commands/yum.json +323 -98
  257. package/data/commands/zig.json +1 -1
  258. package/data/commands/zip.json +159 -59
  259. package/data/completion/abap.json +423 -341
  260. package/data/completion/apex.json +423 -43
  261. package/data/completion/awk.json +1 -45
  262. package/data/completion/azcli.json +58 -115
  263. package/data/completion/bicep.json +90 -90
  264. package/data/completion/cameligo.json +533 -487
  265. package/data/completion/clojure.json +533 -488
  266. package/data/completion/coffee.json +522 -479
  267. package/data/completion/crontab.json +1 -34
  268. package/data/completion/cypher.json +687 -628
  269. package/data/completion/docker-compose.json +962 -959
  270. package/data/completion/dockerfile.json +1270 -1285
  271. package/data/completion/doctest.json +489 -526
  272. package/data/completion/ecl.json +588 -598
  273. package/data/completion/elixir.json +709 -649
  274. package/data/completion/flow9.json +401 -376
  275. package/data/completion/freemarker2.json +632 -579
  276. package/data/completion/go.json +10037 -10037
  277. package/data/completion/julia.json +698 -638
  278. package/data/completion/less.json +412 -378
  279. package/data/completion/lexon.json +80 -52
  280. package/data/completion/liquid.json +544 -499
  281. package/data/completion/lua.json +2535 -2634
  282. package/data/completion/m3.json +643 -587
  283. package/data/completion/makefile.json +1 -56
  284. package/data/completion/markdown.json +1 -56
  285. package/data/completion/mips.json +83 -49
  286. package/data/completion/msdax.json +511 -467
  287. package/data/completion/mysql.json +676 -638
  288. package/data/completion/objective-c.json +687 -629
  289. package/data/completion/pascal.json +709 -649
  290. package/data/completion/pascaligo.json +544 -517
  291. package/data/completion/perl.json +1 -89
  292. package/data/completion/pgsql.json +698 -638
  293. package/data/completion/postiats.json +445 -417
  294. package/data/completion/powerquery.json +621 -587
  295. package/data/completion/powershell.json +1 -166
  296. package/data/completion/protobuf.json +7 -117
  297. package/data/completion/qsharp.json +643 -587
  298. package/data/completion/r.json +2469 -1985
  299. package/data/completion/razor.json +533 -488
  300. package/data/completion/redis-cli.json +120 -60
  301. package/data/completion/redis.json +423 -389
  302. package/data/completion/redshift.json +698 -638
  303. package/data/completion/restructuredtext.json +544 -499
  304. package/data/completion/ruby.json +1930 -1531
  305. package/data/completion/sb.json +434 -398
  306. package/data/completion/scheme.json +555 -510
  307. package/data/completion/scss.json +544 -500
  308. package/data/completion/shell.json +115 -70
  309. package/data/completion/sol.json +720 -660
  310. package/data/completion/sparql.json +643 -587
  311. package/data/completion/st.json +698 -638
  312. package/data/completion/systemverilog.json +698 -638
  313. package/data/completion/tailwindcss.json +2821 -284
  314. package/data/completion/tcl.json +544 -499
  315. package/data/completion/twig.json +555 -510
  316. package/data/completion/vb.json +720 -660
  317. package/data/completion/wgsl.json +709 -649
  318. package/data/foldingRange/abap.json +0 -24
  319. package/data/foldingRange/angular.json +0 -18
  320. package/data/foldingRange/apex.json +0 -24
  321. package/data/foldingRange/awk.json +0 -18
  322. package/data/foldingRange/azcli.json +0 -18
  323. package/data/foldingRange/bicep.json +0 -18
  324. package/data/foldingRange/c.json +0 -24
  325. package/data/foldingRange/caddy.json +0 -18
  326. package/data/foldingRange/cameligo.json +0 -18
  327. package/data/foldingRange/clojure.json +0 -18
  328. package/data/foldingRange/coffee.json +0 -18
  329. package/data/foldingRange/cpp.json +0 -24
  330. package/data/foldingRange/crontab.json +0 -18
  331. package/data/foldingRange/csharp.json +0 -24
  332. package/data/foldingRange/css.json +5 -19
  333. package/data/foldingRange/cypher.json +0 -18
  334. package/data/foldingRange/dart.json +0 -24
  335. package/data/foldingRange/docker-compose.json +0 -18
  336. package/data/foldingRange/dockerfile.json +0 -18
  337. package/data/foldingRange/doctest.json +0 -18
  338. package/data/foldingRange/dotenv.json +0 -18
  339. package/data/foldingRange/ecl.json +0 -30
  340. package/data/foldingRange/elixir.json +0 -24
  341. package/data/foldingRange/flow9.json +0 -12
  342. package/data/foldingRange/freemarker2.json +0 -12
  343. package/data/foldingRange/go.json +0 -24
  344. package/data/foldingRange/graphql.json +0 -12
  345. package/data/foldingRange/hcl.json +0 -12
  346. package/data/foldingRange/html.json +0 -18
  347. package/data/foldingRange/ini.json +0 -18
  348. package/data/foldingRange/java.json +0 -24
  349. package/data/foldingRange/javascript.json +0 -24
  350. package/data/foldingRange/json.json +0 -12
  351. package/data/foldingRange/julia.json +0 -12
  352. package/data/foldingRange/kotlin.json +0 -18
  353. package/data/foldingRange/less.json +0 -18
  354. package/data/foldingRange/lexon.json +0 -12
  355. package/data/foldingRange/liquid.json +0 -18
  356. package/data/foldingRange/lua.json +0 -24
  357. package/data/foldingRange/m3.json +0 -18
  358. package/data/foldingRange/makefile.json +0 -12
  359. package/data/foldingRange/markdown.json +0 -12
  360. package/data/foldingRange/mdx.json +0 -18
  361. package/data/foldingRange/mips.json +0 -18
  362. package/data/foldingRange/msdax.json +0 -12
  363. package/data/foldingRange/mysql.json +0 -18
  364. package/data/foldingRange/nestjs.json +0 -24
  365. package/data/foldingRange/nextjs.json +0 -24
  366. package/data/foldingRange/nginx.json +0 -12
  367. package/data/foldingRange/objective-c.json +0 -18
  368. package/data/foldingRange/pascal.json +0 -18
  369. package/data/foldingRange/pascaligo.json +0 -12
  370. package/data/foldingRange/perl.json +0 -18
  371. package/data/foldingRange/pgsql.json +0 -18
  372. package/data/foldingRange/php.json +0 -18
  373. package/data/foldingRange/pla.json +0 -12
  374. package/data/foldingRange/postiats.json +0 -18
  375. package/data/foldingRange/powerquery.json +0 -12
  376. package/data/foldingRange/powershell.json +0 -18
  377. package/data/foldingRange/protobuf.json +0 -12
  378. package/data/foldingRange/python.json +0 -18
  379. package/data/foldingRange/qsharp.json +0 -12
  380. package/data/foldingRange/r.json +0 -12
  381. package/data/foldingRange/razor.json +0 -18
  382. package/data/foldingRange/react.json +0 -24
  383. package/data/foldingRange/redis-cli.json +0 -12
  384. package/data/foldingRange/redis.json +0 -18
  385. package/data/foldingRange/redshift.json +0 -18
  386. package/data/foldingRange/restructuredtext.json +0 -12
  387. package/data/foldingRange/ruby.json +0 -24
  388. package/data/foldingRange/rust.json +0 -18
  389. package/data/foldingRange/sb.json +0 -18
  390. package/data/foldingRange/scala.json +0 -18
  391. package/data/foldingRange/scheme.json +0 -12
  392. package/data/foldingRange/scss.json +0 -18
  393. package/data/foldingRange/shadcn.json +0 -24
  394. package/data/foldingRange/shell.json +0 -18
  395. package/data/foldingRange/sol.json +0 -18
  396. package/data/foldingRange/sparql.json +0 -12
  397. package/data/foldingRange/sql.json +0 -18
  398. package/data/foldingRange/ssh_config.json +0 -12
  399. package/data/foldingRange/st.json +0 -18
  400. package/data/foldingRange/swift.json +0 -18
  401. package/data/foldingRange/systemd.json +0 -12
  402. package/data/foldingRange/systemverilog.json +0 -12
  403. package/data/foldingRange/tailwindcss.json +0 -12
  404. package/data/foldingRange/tcl.json +0 -18
  405. package/data/foldingRange/toml.json +0 -12
  406. package/data/foldingRange/twig.json +0 -12
  407. package/data/foldingRange/typescript.json +0 -24
  408. package/data/foldingRange/vb.json +0 -18
  409. package/data/foldingRange/wgsl.json +0 -12
  410. package/data/foldingRange/xml.json +0 -18
  411. package/data/foldingRange/yaml.json +0 -12
  412. package/data/formatting/awk.json +5 -5
  413. package/data/formatting/azcli.json +1 -1
  414. package/data/formatting/c.json +5 -5
  415. package/data/formatting/caddy.json +4 -4
  416. package/data/formatting/cpp.json +5 -5
  417. package/data/formatting/crontab.json +2 -2
  418. package/data/formatting/csharp.json +5 -5
  419. package/data/formatting/dockerfile.json +4 -3
  420. package/data/formatting/dotenv.json +2 -2
  421. package/data/formatting/elixir.json +3 -3
  422. package/data/formatting/go.json +5 -5
  423. package/data/formatting/graphql.json +4 -4
  424. package/data/formatting/hcl.json +8 -8
  425. package/data/formatting/html.json +8 -8
  426. package/data/formatting/ini.json +4 -3
  427. package/data/formatting/java.json +5 -5
  428. package/data/formatting/javascript.json +5 -5
  429. package/data/formatting/json.json +4 -4
  430. package/data/formatting/less.json +8 -4
  431. package/data/formatting/lua.json +5 -5
  432. package/data/formatting/makefile.json +8 -4
  433. package/data/formatting/markdown.json +4 -4
  434. package/data/formatting/mips.json +2 -1
  435. package/data/formatting/mysql.json +1 -1
  436. package/data/formatting/nginx.json +5 -5
  437. package/data/formatting/perl.json +5 -5
  438. package/data/formatting/pgsql.json +1 -1
  439. package/data/formatting/php.json +5 -5
  440. package/data/formatting/powershell.json +5 -5
  441. package/data/formatting/protobuf.json +4 -4
  442. package/data/formatting/python.json +5 -5
  443. package/data/formatting/r.json +6 -6
  444. package/data/formatting/redis-cli.json +2 -2
  445. package/data/formatting/redshift.json +1 -1
  446. package/data/formatting/restructuredtext.json +2 -1
  447. package/data/formatting/ruby.json +5 -5
  448. package/data/formatting/rust.json +5 -5
  449. package/data/formatting/scala.json +6 -2
  450. package/data/formatting/scss.json +8 -4
  451. package/data/formatting/shell.json +1 -16
  452. package/data/formatting/sql.json +5 -5
  453. package/data/formatting/ssh_config.json +4 -3
  454. package/data/formatting/swift.json +6 -2
  455. package/data/formatting/systemd.json +2 -2
  456. package/data/formatting/toml.json +4 -3
  457. package/data/formatting/typescript.json +5 -5
  458. package/data/formatting/xml.json +8 -8
  459. package/data/formatting/yaml.json +4 -3
  460. package/data/links/abap.json +14 -14
  461. package/data/links/apex.json +18 -18
  462. package/data/links/awk.json +20 -20
  463. package/data/links/azcli.json +20 -20
  464. package/data/links/bicep.json +12 -12
  465. package/data/links/c.json +22 -22
  466. package/data/links/caddy.json +22 -22
  467. package/data/links/cameligo.json +20 -20
  468. package/data/links/clojure.json +12 -12
  469. package/data/links/coffee.json +14 -14
  470. package/data/links/cpp.json +22 -22
  471. package/data/links/crontab.json +22 -22
  472. package/data/links/csharp.json +22 -22
  473. package/data/links/cypher.json +18 -18
  474. package/data/links/dart.json +2 -2
  475. package/data/links/docker-compose.json +8 -8
  476. package/data/links/dockerfile.json +22 -22
  477. package/data/links/doctest.json +20 -20
  478. package/data/links/dotenv.json +20 -20
  479. package/data/links/ecl.json +18 -18
  480. package/data/links/elixir.json +12 -12
  481. package/data/links/flow9.json +22 -22
  482. package/data/links/freemarker2.json +10 -10
  483. package/data/links/go.json +23 -23
  484. package/data/links/graphql.json +18 -18
  485. package/data/links/hcl.json +22 -22
  486. package/data/links/html.json +19 -19
  487. package/data/links/ini.json +20 -20
  488. package/data/links/java.json +22 -22
  489. package/data/links/javascript.json +20 -20
  490. package/data/links/json.json +16 -16
  491. package/data/links/julia.json +16 -16
  492. package/data/links/kotlin.json +14 -14
  493. package/data/links/less.json +10 -10
  494. package/data/links/lexon.json +24 -24
  495. package/data/links/liquid.json +8 -8
  496. package/data/links/lua.json +22 -22
  497. package/data/links/m3.json +20 -20
  498. package/data/links/makefile.json +22 -22
  499. package/data/links/markdown.json +25 -25
  500. package/data/links/mdx.json +12 -12
  501. package/data/links/mips.json +22 -22
  502. package/data/links/msdax.json +22 -22
  503. package/data/links/mysql.json +17 -17
  504. package/data/links/nginx.json +22 -22
  505. package/data/links/objective-c.json +14 -14
  506. package/data/links/pascal.json +16 -16
  507. package/data/links/pascaligo.json +20 -20
  508. package/data/links/perl.json +22 -22
  509. package/data/links/pgsql.json +14 -14
  510. package/data/links/php.json +22 -22
  511. package/data/links/pla.json +24 -24
  512. package/data/links/postiats.json +18 -18
  513. package/data/links/powerquery.json +20 -20
  514. package/data/links/powershell.json +24 -24
  515. package/data/links/protobuf.json +22 -22
  516. package/data/links/python.json +27 -22
  517. package/data/links/qsharp.json +20 -20
  518. package/data/links/r.json +21 -21
  519. package/data/links/razor.json +8 -8
  520. package/data/links/redis-cli.json +22 -22
  521. package/data/links/redis.json +22 -22
  522. package/data/links/redshift.json +16 -16
  523. package/data/links/restructuredtext.json +10 -10
  524. package/data/links/ruby.json +22 -22
  525. package/data/links/rust.json +22 -22
  526. package/data/links/sb.json +24 -24
  527. package/data/links/scheme.json +12 -12
  528. package/data/links/scss.json +2 -2
  529. package/data/links/shell.json +1 -6
  530. package/data/links/sol.json +16 -16
  531. package/data/links/sparql.json +18 -18
  532. package/data/links/sql.json +18 -18
  533. package/data/links/ssh_config.json +22 -22
  534. package/data/links/st.json +20 -20
  535. package/data/links/swift.json +8 -8
  536. package/data/links/systemd.json +18 -18
  537. package/data/links/systemverilog.json +20 -20
  538. package/data/links/tcl.json +16 -16
  539. package/data/links/toml.json +16 -16
  540. package/data/links/typescript.json +20 -20
  541. package/data/links/vb.json +16 -16
  542. package/data/links/wgsl.json +24 -24
  543. package/data/links/xml.json +22 -22
  544. package/data/links/yaml.json +12 -12
  545. package/data/manifest.json +2 -2
  546. package/package.json +2 -2
@@ -1,1985 +1,2469 @@
1
- {
2
- "language": "r",
3
- "completions": [
4
- {
5
- "label": "if",
6
- "kind": 14,
7
- "detail": "Conditional execution (keyword)",
8
- "documentation": { "value": "Conditional branching.\n\n```r\nif (condition) {\n # true branch\n} else {\n # false branch\n}\n```" },
9
- "insertText": "if (${1:condition}) {\n ${2}\n}",
10
- "insertTextRules": 4,
11
- "sortText": "00_if"
12
- },
13
- {
14
- "label": "else",
15
- "kind": 14,
16
- "detail": "Alternative branch (keyword)",
17
- "documentation": { "value": "Alternative branch in `if` statement.\n\n```r\nif (x > 0) {\n print(\"positive\")\n} else {\n print(\"non-positive\")\n}\n```" },
18
- "insertText": "else {\n ${1}\n}",
19
- "insertTextRules": 4,
20
- "sortText": "00_else"
21
- },
22
- {
23
- "label": "for",
24
- "kind": 14,
25
- "detail": "For loop (keyword)",
26
- "documentation": { "value": "Iterate over elements of a vector.\n\n```r\nfor (i in 1:10) {\n print(i)\n}\n\nfor (item in my_list) {\n cat(item, \"\\n\")\n}\n```" },
27
- "insertText": "for (${1:i} in ${2:seq}) {\n ${3}\n}",
28
- "insertTextRules": 4,
29
- "sortText": "00_for"
30
- },
31
- {
32
- "label": "while",
33
- "kind": 14,
34
- "detail": "While loop (keyword)",
35
- "documentation": { "value": "Execute a block while a condition is TRUE.\n\n```r\nwhile (x > 0) {\n x <- x - 1\n}\n```" },
36
- "insertText": "while (${1:condition}) {\n ${2}\n}",
37
- "insertTextRules": 4,
38
- "sortText": "00_while"
39
- },
40
- {
41
- "label": "repeat",
42
- "kind": 14,
43
- "detail": "Infinite loop (keyword)",
44
- "documentation": { "value": "Execute a block indefinitely until `break` is called.\n\n```r\nrepeat {\n x <- x + 1\n if (x > 10) break\n}\n```" },
45
- "insertText": "repeat {\n ${1}\n if (${2:condition}) break\n}",
46
- "insertTextRules": 4,
47
- "sortText": "00_repeat"
48
- },
49
- {
50
- "label": "in",
51
- "kind": 14,
52
- "detail": "Membership operator (keyword)",
53
- "documentation": { "value": "Used in `for` loops to iterate over sequences.\n\n```r\nfor (x in 1:10) print(x)\n```" },
54
- "insertText": "in",
55
- "sortText": "00_in"
56
- },
57
- {
58
- "label": "next",
59
- "kind": 14,
60
- "detail": "Skip to next iteration (keyword)",
61
- "documentation": { "value": "Skip the rest of the current iteration and proceed to the next.\n\n```r\nfor (i in 1:10) {\n if (i %% 2 == 0) next\n print(i)\n}\n```" },
62
- "insertText": "next",
63
- "sortText": "00_next"
64
- },
65
- {
66
- "label": "break",
67
- "kind": 14,
68
- "detail": "Exit loop (keyword)",
69
- "documentation": { "value": "Exit the current `for`, `while`, or `repeat` loop.\n\n```r\nfor (i in 1:100) {\n if (i > 10) break\n}\n```" },
70
- "insertText": "break",
71
- "sortText": "00_break"
72
- },
73
- {
74
- "label": "function",
75
- "kind": 14,
76
- "detail": "Define a function (keyword)",
77
- "documentation": { "value": "Create a function object.\n\n```r\nmy_func <- function(x, y = 1) {\n x + y\n}\n\n# Anonymous function\nsapply(1:5, function(x) x^2)\n```" },
78
- "insertText": "function(${1:args}) {\n ${2}\n}",
79
- "insertTextRules": 4,
80
- "sortText": "00_function"
81
- },
82
- {
83
- "label": "return",
84
- "kind": 14,
85
- "detail": "Return value from function (keyword)",
86
- "documentation": { "value": "Explicitly return a value from a function.\n\n```r\nmy_func <- function(x) {\n if (x < 0) return(NULL)\n sqrt(x)\n}\n```" },
87
- "insertText": "return(${1:value})",
88
- "insertTextRules": 4,
89
- "sortText": "00_return"
90
- },
91
- {
92
- "label": "TRUE",
93
- "kind": 14,
94
- "detail": "Logical constant TRUE",
95
- "documentation": { "value": "Logical truth value.\n\n```r\nx <- TRUE\nis.logical(TRUE) # TRUE\n```" },
96
- "insertText": "TRUE",
97
- "sortText": "00_TRUE"
98
- },
99
- {
100
- "label": "FALSE",
101
- "kind": 14,
102
- "detail": "Logical constant FALSE",
103
- "documentation": { "value": "Logical false value.\n\n```r\nx <- FALSE\n!FALSE # TRUE\n```" },
104
- "insertText": "FALSE",
105
- "sortText": "00_FALSE"
106
- },
107
- {
108
- "label": "NULL",
109
- "kind": 14,
110
- "detail": "Null object",
111
- "documentation": { "value": "The NULL object represents the absence of a value.\n\n```r\nx <- NULL\nis.null(x) # TRUE\nlength(NULL) # 0\n```" },
112
- "insertText": "NULL",
113
- "sortText": "00_NULL"
114
- },
115
- {
116
- "label": "NA",
117
- "kind": 14,
118
- "detail": "Missing value indicator",
119
- "documentation": { "value": "Logical constant representing a missing value.\n\n```r\nx <- c(1, NA, 3)\nis.na(x) # FALSE TRUE FALSE\nna.rm = TRUE # common argument to ignore NAs\n```" },
120
- "insertText": "NA",
121
- "sortText": "00_NA"
122
- },
123
- {
124
- "label": "NA_integer_",
125
- "kind": 14,
126
- "detail": "Integer NA",
127
- "documentation": { "value": "Missing value of integer type.\n\n```r\nx <- NA_integer_\nis.na(x) # TRUE\ntypeof(x) # \"integer\"\n```" },
128
- "insertText": "NA_integer_",
129
- "sortText": "00_NA_integer_"
130
- },
131
- {
132
- "label": "NA_real_",
133
- "kind": 14,
134
- "detail": "Double/real NA",
135
- "documentation": { "value": "Missing value of double type.\n\n```r\nx <- NA_real_\ntypeof(x) # \"double\"\n```" },
136
- "insertText": "NA_real_",
137
- "sortText": "00_NA_real_"
138
- },
139
- {
140
- "label": "NA_complex_",
141
- "kind": 14,
142
- "detail": "Complex NA",
143
- "documentation": { "value": "Missing value of complex type.\n\n```r\nx <- NA_complex_\ntypeof(x) # \"complex\"\n```" },
144
- "insertText": "NA_complex_",
145
- "sortText": "00_NA_complex_"
146
- },
147
- {
148
- "label": "NA_character_",
149
- "kind": 14,
150
- "detail": "Character NA",
151
- "documentation": { "value": "Missing value of character type.\n\n```r\nx <- NA_character_\ntypeof(x) # \"character\"\n```" },
152
- "insertText": "NA_character_",
153
- "sortText": "00_NA_character_"
154
- },
155
- {
156
- "label": "Inf",
157
- "kind": 14,
158
- "detail": "Positive infinity",
159
- "documentation": { "value": "Positive infinity.\n\n```r\n1 / 0 # Inf\nis.infinite(Inf) # TRUE\n```" },
160
- "insertText": "Inf",
161
- "sortText": "00_Inf"
162
- },
163
- {
164
- "label": "NaN",
165
- "kind": 14,
166
- "detail": "Not a Number",
167
- "documentation": { "value": "Not a Number — result of undefined numeric operations.\n\n```r\n0 / 0 # NaN\nis.nan(NaN) # TRUE\n```" },
168
- "insertText": "NaN",
169
- "sortText": "00_NaN"
170
- },
171
- {
172
- "label": "library",
173
- "kind": 1,
174
- "detail": "Load and attach a package",
175
- "documentation": { "value": "Load and attach a package namespace.\n\n```r\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(tidyr, warn.conflicts = FALSE)\n```" },
176
- "insertText": "library(${1:package})",
177
- "insertTextRules": 4,
178
- "sortText": "00_library"
179
- },
180
- {
181
- "label": "require",
182
- "kind": 1,
183
- "detail": "Load a package (returns logical)",
184
- "documentation": { "value": "Try to load a package. Returns TRUE/FALSE instead of erroring.\n\n```r\nif (!require(dplyr)) install.packages(\"dplyr\")\n```" },
185
- "insertText": "require(${1:package})",
186
- "insertTextRules": 4,
187
- "sortText": "00_require"
188
- },
189
- {
190
- "label": "source",
191
- "kind": 1,
192
- "detail": "Read and evaluate R code from a file",
193
- "documentation": { "value": "Parse and evaluate R expressions from a file.\n\n```r\nsource(\"helper_functions.R\")\nsource(\"config.R\", local = TRUE)\n```" },
194
- "insertText": "source(\"${1:file.R}\")",
195
- "insertTextRules": 4,
196
- "sortText": "00_source"
197
- },
198
- {
199
- "label": "local",
200
- "kind": 1,
201
- "detail": "Evaluate in a local environment",
202
- "documentation": { "value": "Evaluate expression in a local environment.\n\n```r\nresult <- local({\n tmp <- 42\n tmp * 2\n})\n```" },
203
- "insertText": "local({\n ${1}\n})",
204
- "insertTextRules": 4,
205
- "sortText": "00_local"
206
- },
207
- {
208
- "label": "switch",
209
- "kind": 1,
210
- "detail": "Multi-way conditional",
211
- "documentation": { "value": "Select one of several alternatives based on a value.\n\n```r\nresult <- switch(x,\n \"a\" = 1,\n \"b\" = 2,\n \"c\" = 3,\n -1 # default\n)\n```" },
212
- "insertText": "switch(${1:expr},\n ${2:case1} = ${3:value1},\n ${4:default}\n)",
213
- "insertTextRules": 4,
214
- "sortText": "00_switch"
215
- },
216
- {
217
- "label": "print",
218
- "kind": 1,
219
- "detail": "Print values",
220
- "documentation": { "value": "Generic print function for displaying objects.\n\n```r\nprint(x)\nprint(df, n = 20)\nprint(\"hello\")\n```" },
221
- "insertText": "print(${1:x})",
222
- "insertTextRules": 4,
223
- "sortText": "01_print"
224
- },
225
- {
226
- "label": "cat",
227
- "kind": 1,
228
- "detail": "Concatenate and print",
229
- "documentation": { "value": "Concatenate and print to stdout or a file.\n\n```r\ncat(\"Hello\", \"world\\n\")\ncat(\"x =\", x, \"\\n\")\ncat(\"line\\n\", file = \"out.txt\", append = TRUE)\n```" },
230
- "insertText": "cat(${1:...})",
231
- "insertTextRules": 4,
232
- "sortText": "01_cat"
233
- },
234
- {
235
- "label": "paste",
236
- "kind": 1,
237
- "detail": "Concatenate strings with separator",
238
- "documentation": { "value": "Concatenate strings with a separator (default space).\n\n```r\npaste(\"Hello\", \"world\") # \"Hello world\"\npaste(\"a\", \"b\", sep = \"-\") # \"a-b\"\npaste0(\"x\", 1:3) # \"x1\" \"x2\" \"x3\"\n```" },
239
- "insertText": "paste(${1:...}, sep = \"${2: }\")",
240
- "insertTextRules": 4,
241
- "sortText": "01_paste"
242
- },
243
- {
244
- "label": "paste0",
245
- "kind": 1,
246
- "detail": "Concatenate strings without separator",
247
- "documentation": { "value": "Concatenate strings with no separator (equivalent to `paste(..., sep = \"\")`.\n\n```r\npaste0(\"file\", 1:3, \".csv\") # \"file1.csv\" \"file2.csv\" \"file3.csv\"\npaste0(\"prefix_\", name)\n```" },
248
- "insertText": "paste0(${1:...})",
249
- "insertTextRules": 4,
250
- "sortText": "01_paste0"
251
- },
252
- {
253
- "label": "sprintf",
254
- "kind": 1,
255
- "detail": "Formatted string output",
256
- "documentation": { "value": "C-style string formatting.\n\n```r\nsprintf(\"%s is %d years old\", name, age)\nsprintf(\"%.2f%%\", pct * 100)\nsprintf(\"%05d\", id)\n```" },
257
- "insertText": "sprintf(\"${1:%s}\", ${2:...})",
258
- "insertTextRules": 4,
259
- "sortText": "01_sprintf"
260
- },
261
- {
262
- "label": "c",
263
- "kind": 1,
264
- "detail": "Combine values into a vector",
265
- "documentation": { "value": "Combine values into a vector or list.\n\n```r\nx <- c(1, 2, 3)\nnames <- c(\"Alice\", \"Bob\")\nmixed <- c(a = 1, b = 2)\n```" },
266
- "insertText": "c(${1:...})",
267
- "insertTextRules": 4,
268
- "sortText": "01_c"
269
- },
270
- {
271
- "label": "length",
272
- "kind": 1,
273
- "detail": "Length of an object",
274
- "documentation": { "value": "Get or set the length of a vector or list.\n\n```r\nlength(1:10) # 10\nlength(list(a=1)) # 1\nlength(NULL) # 0\n```" },
275
- "insertText": "length(${1:x})",
276
- "insertTextRules": 4,
277
- "sortText": "01_length"
278
- },
279
- {
280
- "label": "nchar",
281
- "kind": 1,
282
- "detail": "Number of characters in a string",
283
- "documentation": { "value": "Count the number of characters in a string.\n\n```r\nnchar(\"hello\") # 5\nnchar(c(\"a\", \"bb\")) # 1 2\n```" },
284
- "insertText": "nchar(${1:x})",
285
- "insertTextRules": 4,
286
- "sortText": "01_nchar"
287
- },
288
- {
289
- "label": "seq",
290
- "kind": 1,
291
- "detail": "Generate a sequence",
292
- "documentation": { "value": "Generate regular sequences.\n\n```r\nseq(1, 10) # 1 2 ... 10\nseq(0, 1, by = 0.1) # 0.0 0.1 ... 1.0\nseq_len(5) # 1 2 3 4 5\nseq_along(x) # 1:length(x)\n```" },
293
- "insertText": "seq(${1:from}, ${2:to}, by = ${3:1})",
294
- "insertTextRules": 4,
295
- "sortText": "01_seq"
296
- },
297
- {
298
- "label": "seq_along",
299
- "kind": 1,
300
- "detail": "Sequence along an object",
301
- "documentation": { "value": "Generate a sequence `1, 2, ..., length(x)`.\n\n```r\nfor (i in seq_along(x)) {\n cat(i, x[i], \"\\n\")\n}\n```" },
302
- "insertText": "seq_along(${1:x})",
303
- "insertTextRules": 4,
304
- "sortText": "01_seq_along"
305
- },
306
- {
307
- "label": "seq_len",
308
- "kind": 1,
309
- "detail": "Sequence of given length",
310
- "documentation": { "value": "Generate sequence `1:length.out`.\n\n```r\nseq_len(5) # 1 2 3 4 5\n```" },
311
- "insertText": "seq_len(${1:n})",
312
- "insertTextRules": 4,
313
- "sortText": "01_seq_len"
314
- },
315
- {
316
- "label": "rep",
317
- "kind": 1,
318
- "detail": "Replicate elements",
319
- "documentation": { "value": "Replicate elements of a vector.\n\n```r\nrep(0, 5) # 0 0 0 0 0\nrep(1:3, times = 2) # 1 2 3 1 2 3\nrep(1:3, each = 2) # 1 1 2 2 3 3\n```" },
320
- "insertText": "rep(${1:x}, ${2:times})",
321
- "insertTextRules": 4,
322
- "sortText": "01_rep"
323
- },
324
- {
325
- "label": "rev",
326
- "kind": 1,
327
- "detail": "Reverse a vector",
328
- "documentation": { "value": "Reverse the elements of a vector.\n\n```r\nrev(1:5) # 5 4 3 2 1\nrev(c(\"a\", \"b\")) # \"b\" \"a\"\n```" },
329
- "insertText": "rev(${1:x})",
330
- "insertTextRules": 4,
331
- "sortText": "01_rev"
332
- },
333
- {
334
- "label": "sort",
335
- "kind": 1,
336
- "detail": "Sort a vector",
337
- "documentation": { "value": "Sort a vector in ascending or descending order.\n\n```r\nsort(c(3, 1, 2)) # 1 2 3\nsort(c(3, 1, 2), decreasing = TRUE) # 3 2 1\n```" },
338
- "insertText": "sort(${1:x})",
339
- "insertTextRules": 4,
340
- "sortText": "01_sort"
341
- },
342
- {
343
- "label": "order",
344
- "kind": 1,
345
- "detail": "Ordering permutation",
346
- "documentation": { "value": "Return a permutation which rearranges its argument into ascending or descending order.\n\n```r\nx <- c(3, 1, 2)\norder(x) # 2 3 1\nx[order(x)] # 1 2 3\ndf[order(df$age), ]\n```" },
347
- "insertText": "order(${1:...})",
348
- "insertTextRules": 4,
349
- "sortText": "01_order"
350
- },
351
- {
352
- "label": "which",
353
- "kind": 1,
354
- "detail": "Which indices are TRUE",
355
- "documentation": { "value": "Return indices where a logical vector is TRUE.\n\n```r\nwhich(c(FALSE, TRUE, TRUE)) # 2 3\nwhich(x > 5)\nwhich.min(x)\nwhich.max(x)\n```" },
356
- "insertText": "which(${1:x})",
357
- "insertTextRules": 4,
358
- "sortText": "01_which"
359
- },
360
- {
361
- "label": "match",
362
- "kind": 1,
363
- "detail": "Value matching",
364
- "documentation": { "value": "Return positions of first matches of first argument in second.\n\n```r\nmatch(c(\"b\", \"d\"), c(\"a\", \"b\", \"c\")) # 2 NA\nx %in% table # logical vector\n```" },
365
- "insertText": "match(${1:x}, ${2:table})",
366
- "insertTextRules": 4,
367
- "sortText": "01_match"
368
- },
369
- {
370
- "label": "unique",
371
- "kind": 1,
372
- "detail": "Unique values",
373
- "documentation": { "value": "Return unique elements of a vector.\n\n```r\nunique(c(1, 2, 2, 3, 3, 3)) # 1 2 3\n```" },
374
- "insertText": "unique(${1:x})",
375
- "insertTextRules": 4,
376
- "sortText": "01_unique"
377
- },
378
- {
379
- "label": "duplicated",
380
- "kind": 1,
381
- "detail": "Determine duplicate elements",
382
- "documentation": { "value": "Return a logical vector indicating which elements are duplicates.\n\n```r\nduplicated(c(1, 2, 2, 3)) # FALSE FALSE TRUE FALSE\nx[!duplicated(x)] # remove duplicates\n```" },
383
- "insertText": "duplicated(${1:x})",
384
- "insertTextRules": 4,
385
- "sortText": "01_duplicated"
386
- },
387
- {
388
- "label": "table",
389
- "kind": 1,
390
- "detail": "Contingency table",
391
- "documentation": { "value": "Build a frequency table of factor levels.\n\n```r\ntable(c(\"a\", \"b\", \"a\", \"c\", \"a\")) # a:3 b:1 c:1\ntable(df$gender, df$group)\n```" },
392
- "insertText": "table(${1:...})",
393
- "insertTextRules": 4,
394
- "sortText": "01_table"
395
- },
396
- {
397
- "label": "sum",
398
- "kind": 1,
399
- "detail": "Sum of values",
400
- "documentation": { "value": "Compute the sum of all values.\n\n```r\nsum(1:10) # 55\nsum(x, na.rm = TRUE)\n```" },
401
- "insertText": "sum(${1:...})",
402
- "insertTextRules": 4,
403
- "sortText": "01_sum"
404
- },
405
- {
406
- "label": "mean",
407
- "kind": 1,
408
- "detail": "Arithmetic mean",
409
- "documentation": { "value": "Compute the arithmetic mean.\n\n```r\nmean(1:10) # 5.5\nmean(x, na.rm = TRUE)\nmean(x, trim = 0.1)\n```" },
410
- "insertText": "mean(${1:x})",
411
- "insertTextRules": 4,
412
- "sortText": "01_mean"
413
- },
414
- {
415
- "label": "median",
416
- "kind": 1,
417
- "detail": "Median value",
418
- "documentation": { "value": "Compute the median value.\n\n```r\nmedian(c(1, 3, 5, 7, 9)) # 5\nmedian(x, na.rm = TRUE)\n```" },
419
- "insertText": "median(${1:x})",
420
- "insertTextRules": 4,
421
- "sortText": "01_median"
422
- },
423
- {
424
- "label": "sd",
425
- "kind": 1,
426
- "detail": "Standard deviation",
427
- "documentation": { "value": "Compute the standard deviation.\n\n```r\nsd(c(1, 2, 3, 4, 5)) # 1.581139\nsd(x, na.rm = TRUE)\n```" },
428
- "insertText": "sd(${1:x})",
429
- "insertTextRules": 4,
430
- "sortText": "01_sd"
431
- },
432
- {
433
- "label": "var",
434
- "kind": 1,
435
- "detail": "Variance",
436
- "documentation": { "value": "Compute variance (or covariance matrix).\n\n```r\nvar(1:10)\nvar(x, y) # covariance\nvar(df) # covariance matrix\n```" },
437
- "insertText": "var(${1:x})",
438
- "insertTextRules": 4,
439
- "sortText": "01_var"
440
- },
441
- {
442
- "label": "min",
443
- "kind": 1,
444
- "detail": "Minimum value",
445
- "documentation": { "value": "Return the minimum of all values.\n\n```r\nmin(5, 3, 8) # 3\nmin(x, na.rm = TRUE)\n```" },
446
- "insertText": "min(${1:...})",
447
- "insertTextRules": 4,
448
- "sortText": "01_min"
449
- },
450
- {
451
- "label": "max",
452
- "kind": 1,
453
- "detail": "Maximum value",
454
- "documentation": { "value": "Return the maximum of all values.\n\n```r\nmax(5, 3, 8) # 8\nmax(x, na.rm = TRUE)\n```" },
455
- "insertText": "max(${1:...})",
456
- "insertTextRules": 4,
457
- "sortText": "01_max"
458
- },
459
- {
460
- "label": "range",
461
- "kind": 1,
462
- "detail": "Range of values (min and max)",
463
- "documentation": { "value": "Return the minimum and maximum of a vector.\n\n```r\nrange(c(3, 1, 5)) # 1 5\n```" },
464
- "insertText": "range(${1:...})",
465
- "insertTextRules": 4,
466
- "sortText": "01_range"
467
- },
468
- {
469
- "label": "abs",
470
- "kind": 1,
471
- "detail": "Absolute value",
472
- "documentation": { "value": "Compute the absolute value.\n\n```r\nabs(-5) # 5\nabs(c(-1, 2, -3)) # 1 2 3\n```" },
473
- "insertText": "abs(${1:x})",
474
- "insertTextRules": 4,
475
- "sortText": "01_abs"
476
- },
477
- {
478
- "label": "sqrt",
479
- "kind": 1,
480
- "detail": "Square root",
481
- "documentation": { "value": "Compute the square root.\n\n```r\nsqrt(16) # 4\nsqrt(1:5)\n```" },
482
- "insertText": "sqrt(${1:x})",
483
- "insertTextRules": 4,
484
- "sortText": "01_sqrt"
485
- },
486
- {
487
- "label": "log",
488
- "kind": 1,
489
- "detail": "Natural logarithm",
490
- "documentation": { "value": "Compute the natural logarithm (or with specified base).\n\n```r\nlog(exp(1)) # 1\nlog(100, base = 10) # 2\n```" },
491
- "insertText": "log(${1:x})",
492
- "insertTextRules": 4,
493
- "sortText": "01_log"
494
- },
495
- {
496
- "label": "log2",
497
- "kind": 1,
498
- "detail": "Base-2 logarithm",
499
- "documentation": { "value": "Compute the base-2 logarithm.\n\n```r\nlog2(8) # 3\nlog2(1024) # 10\n```" },
500
- "insertText": "log2(${1:x})",
501
- "insertTextRules": 4,
502
- "sortText": "01_log2"
503
- },
504
- {
505
- "label": "log10",
506
- "kind": 1,
507
- "detail": "Base-10 logarithm",
508
- "documentation": { "value": "Compute the base-10 logarithm.\n\n```r\nlog10(1000) # 3\n```" },
509
- "insertText": "log10(${1:x})",
510
- "insertTextRules": 4,
511
- "sortText": "01_log10"
512
- },
513
- {
514
- "label": "exp",
515
- "kind": 1,
516
- "detail": "Exponential function",
517
- "documentation": { "value": "Compute the exponential function e^x.\n\n```r\nexp(1) # 2.718282\nexp(0) # 1\n```" },
518
- "insertText": "exp(${1:x})",
519
- "insertTextRules": 4,
520
- "sortText": "01_exp"
521
- },
522
- {
523
- "label": "ceiling",
524
- "kind": 1,
525
- "detail": "Round up",
526
- "documentation": { "value": "Round up to the nearest integer.\n\n```r\nceiling(2.3) # 3\nceiling(-2.3) # -2\n```" },
527
- "insertText": "ceiling(${1:x})",
528
- "insertTextRules": 4,
529
- "sortText": "01_ceiling"
530
- },
531
- {
532
- "label": "floor",
533
- "kind": 1,
534
- "detail": "Round down",
535
- "documentation": { "value": "Round down to the nearest integer.\n\n```r\nfloor(2.7) # 2\nfloor(-2.3) # -3\n```" },
536
- "insertText": "floor(${1:x})",
537
- "insertTextRules": 4,
538
- "sortText": "01_floor"
539
- },
540
- {
541
- "label": "round",
542
- "kind": 1,
543
- "detail": "Round to n decimal places",
544
- "documentation": { "value": "Round a number to n digits.\n\n```r\nround(3.14159, 2) # 3.14\nround(2.5) # 2 (banker's rounding)\n```" },
545
- "insertText": "round(${1:x}, digits = ${2:0})",
546
- "insertTextRules": 4,
547
- "sortText": "01_round"
548
- },
549
- {
550
- "label": "trunc",
551
- "kind": 1,
552
- "detail": "Truncate to integer",
553
- "documentation": { "value": "Truncate towards zero.\n\n```r\ntrunc(2.9) # 2\ntrunc(-2.9) # -2\n```" },
554
- "insertText": "trunc(${1:x})",
555
- "insertTextRules": 4,
556
- "sortText": "01_trunc"
557
- },
558
- {
559
- "label": "sign",
560
- "kind": 1,
561
- "detail": "Sign of values",
562
- "documentation": { "value": "Return the sign: -1, 0, or 1.\n\n```r\nsign(-5) # -1\nsign(0) # 0\nsign(3) # 1\n```" },
563
- "insertText": "sign(${1:x})",
564
- "insertTextRules": 4,
565
- "sortText": "01_sign"
566
- },
567
- {
568
- "label": "cumsum",
569
- "kind": 1,
570
- "detail": "Cumulative sum",
571
- "documentation": { "value": "Compute the cumulative sum.\n\n```r\ncumsum(1:5) # 1 3 6 10 15\n```" },
572
- "insertText": "cumsum(${1:x})",
573
- "insertTextRules": 4,
574
- "sortText": "01_cumsum"
575
- },
576
- {
577
- "label": "cumprod",
578
- "kind": 1,
579
- "detail": "Cumulative product",
580
- "documentation": { "value": "Compute the cumulative product.\n\n```r\ncumprod(1:5) # 1 2 6 24 120\n```" },
581
- "insertText": "cumprod(${1:x})",
582
- "insertTextRules": 4,
583
- "sortText": "01_cumprod"
584
- },
585
- {
586
- "label": "cummax",
587
- "kind": 1,
588
- "detail": "Cumulative maximum",
589
- "documentation": { "value": "Compute the cumulative maxima.\n\n```r\ncummax(c(3, 1, 4, 1, 5)) # 3 3 4 4 5\n```" },
590
- "insertText": "cummax(${1:x})",
591
- "insertTextRules": 4,
592
- "sortText": "01_cummax"
593
- },
594
- {
595
- "label": "cummin",
596
- "kind": 1,
597
- "detail": "Cumulative minimum",
598
- "documentation": { "value": "Compute the cumulative minima.\n\n```r\ncummin(c(3, 1, 4, 1, 5)) # 3 1 1 1 1\n```" },
599
- "insertText": "cummin(${1:x})",
600
- "insertTextRules": 4,
601
- "sortText": "01_cummin"
602
- },
603
- {
604
- "label": "diff",
605
- "kind": 1,
606
- "detail": "Lagged differences",
607
- "documentation": { "value": "Compute lagged differences.\n\n```r\ndiff(c(1, 3, 6, 10)) # 2 3 4\ndiff(x, lag = 2)\n```" },
608
- "insertText": "diff(${1:x})",
609
- "insertTextRules": 4,
610
- "sortText": "01_diff"
611
- },
612
- {
613
- "label": "head",
614
- "kind": 1,
615
- "detail": "First n elements",
616
- "documentation": { "value": "Return the first n elements.\n\n```r\nhead(1:100) # 1 2 3 4 5 6\nhead(df, 10)\n```" },
617
- "insertText": "head(${1:x})",
618
- "insertTextRules": 4,
619
- "sortText": "01_head"
620
- },
621
- {
622
- "label": "tail",
623
- "kind": 1,
624
- "detail": "Last n elements",
625
- "documentation": { "value": "Return the last n elements.\n\n```r\ntail(1:100) # 95 96 97 98 99 100\ntail(df, 5)\n```" },
626
- "insertText": "tail(${1:x})",
627
- "insertTextRules": 4,
628
- "sortText": "01_tail"
629
- },
630
- {
631
- "label": "nrow",
632
- "kind": 1,
633
- "detail": "Number of rows",
634
- "documentation": { "value": "Return the number of rows of a matrix or data frame.\n\n```r\nnrow(mtcars) # 32\n```" },
635
- "insertText": "nrow(${1:x})",
636
- "insertTextRules": 4,
637
- "sortText": "01_nrow"
638
- },
639
- {
640
- "label": "ncol",
641
- "kind": 1,
642
- "detail": "Number of columns",
643
- "documentation": { "value": "Return the number of columns of a matrix or data frame.\n\n```r\nncol(mtcars) # 11\n```" },
644
- "insertText": "ncol(${1:x})",
645
- "insertTextRules": 4,
646
- "sortText": "01_ncol"
647
- },
648
- {
649
- "label": "dim",
650
- "kind": 1,
651
- "detail": "Dimensions of an object",
652
- "documentation": { "value": "Get or set the dimensions of an object.\n\n```r\ndim(mtcars) # 32 11\ndim(matrix(1:6, nrow = 2)) # 2 3\n```" },
653
- "insertText": "dim(${1:x})",
654
- "insertTextRules": 4,
655
- "sortText": "01_dim"
656
- },
657
- {
658
- "label": "names",
659
- "kind": 1,
660
- "detail": "Get or set names",
661
- "documentation": { "value": "Get or set the names of an object.\n\n```r\nnames(x)\nnames(x) <- c(\"a\", \"b\", \"c\")\n```" },
662
- "insertText": "names(${1:x})",
663
- "insertTextRules": 4,
664
- "sortText": "01_names"
665
- },
666
- {
667
- "label": "colnames",
668
- "kind": 1,
669
- "detail": "Column names",
670
- "documentation": { "value": "Get or set column names.\n\n```r\ncolnames(df)\ncolnames(df) <- c(\"x\", \"y\", \"z\")\n```" },
671
- "insertText": "colnames(${1:x})",
672
- "insertTextRules": 4,
673
- "sortText": "01_colnames"
674
- },
675
- {
676
- "label": "rownames",
677
- "kind": 1,
678
- "detail": "Row names",
679
- "documentation": { "value": "Get or set row names.\n\n```r\nrownames(df)\nrownames(df) <- paste0(\"row\", 1:nrow(df))\n```" },
680
- "insertText": "rownames(${1:x})",
681
- "insertTextRules": 4,
682
- "sortText": "01_rownames"
683
- },
684
- {
685
- "label": "str",
686
- "kind": 1,
687
- "detail": "Display structure of an object",
688
- "documentation": { "value": "Compactly display the internal structure.\n\n```r\nstr(mtcars)\nstr(my_list)\n```" },
689
- "insertText": "str(${1:object})",
690
- "insertTextRules": 4,
691
- "sortText": "01_str"
692
- },
693
- {
694
- "label": "summary",
695
- "kind": 1,
696
- "detail": "Summary of an object",
697
- "documentation": { "value": "Produce result summaries (dispatched by class).\n\n```r\nsummary(mtcars)\nsummary(lm_fit)\nsummary(factor_var)\n```" },
698
- "insertText": "summary(${1:object})",
699
- "insertTextRules": 4,
700
- "sortText": "01_summary"
701
- },
702
- {
703
- "label": "class",
704
- "kind": 1,
705
- "detail": "Object class",
706
- "documentation": { "value": "Get or set the class attribute.\n\n```r\nclass(mtcars) # \"data.frame\"\nclass(1:5) # \"integer\"\n```" },
707
- "insertText": "class(${1:x})",
708
- "insertTextRules": 4,
709
- "sortText": "01_class"
710
- },
711
- {
712
- "label": "typeof",
713
- "kind": 1,
714
- "detail": "Internal type of an object",
715
- "documentation": { "value": "Return the internal storage type.\n\n```r\ntypeof(1L) # \"integer\"\ntypeof(1.0) # \"double\"\ntypeof(\"a\") # \"character\"\n```" },
716
- "insertText": "typeof(${1:x})",
717
- "insertTextRules": 4,
718
- "sortText": "01_typeof"
719
- },
720
- {
721
- "label": "is.numeric",
722
- "kind": 1,
723
- "detail": "Test if numeric",
724
- "documentation": { "value": "Test whether an object is numeric (integer or double).\n\n```r\nis.numeric(1.5) # TRUE\nis.numeric(\"a\") # FALSE\n```" },
725
- "insertText": "is.numeric(${1:x})",
726
- "insertTextRules": 4,
727
- "sortText": "01_is.numeric"
728
- },
729
- {
730
- "label": "is.character",
731
- "kind": 1,
732
- "detail": "Test if character",
733
- "documentation": { "value": "Test whether an object is of type character.\n\n```r\nis.character(\"hello\") # TRUE\nis.character(42) # FALSE\n```" },
734
- "insertText": "is.character(${1:x})",
735
- "insertTextRules": 4,
736
- "sortText": "01_is.character"
737
- },
738
- {
739
- "label": "is.logical",
740
- "kind": 1,
741
- "detail": "Test if logical",
742
- "documentation": { "value": "Test whether an object is of type logical.\n\n```r\nis.logical(TRUE) # TRUE\nis.logical(1) # FALSE\n```" },
743
- "insertText": "is.logical(${1:x})",
744
- "insertTextRules": 4,
745
- "sortText": "01_is.logical"
746
- },
747
- {
748
- "label": "is.na",
749
- "kind": 1,
750
- "detail": "Test for NA values",
751
- "documentation": { "value": "Test each element for NA.\n\n```r\nis.na(c(1, NA, 3)) # FALSE TRUE FALSE\nsum(is.na(x)) # count NAs\n```" },
752
- "insertText": "is.na(${1:x})",
753
- "insertTextRules": 4,
754
- "sortText": "01_is.na"
755
- },
756
- {
757
- "label": "is.null",
758
- "kind": 1,
759
- "detail": "Test for NULL",
760
- "documentation": { "value": "Test if an object is NULL.\n\n```r\nis.null(NULL) # TRUE\nis.null(NA) # FALSE\n```" },
761
- "insertText": "is.null(${1:x})",
762
- "insertTextRules": 4,
763
- "sortText": "01_is.null"
764
- },
765
- {
766
- "label": "as.numeric",
767
- "kind": 1,
768
- "detail": "Coerce to numeric",
769
- "documentation": { "value": "Coerce an object to numeric (double).\n\n```r\nas.numeric(\"3.14\") # 3.14\nas.numeric(TRUE) # 1\n```" },
770
- "insertText": "as.numeric(${1:x})",
771
- "insertTextRules": 4,
772
- "sortText": "01_as.numeric"
773
- },
774
- {
775
- "label": "as.character",
776
- "kind": 1,
777
- "detail": "Coerce to character",
778
- "documentation": { "value": "Coerce an object to character string.\n\n```r\nas.character(42) # \"42\"\nas.character(TRUE) # \"TRUE\"\n```" },
779
- "insertText": "as.character(${1:x})",
780
- "insertTextRules": 4,
781
- "sortText": "01_as.character"
782
- },
783
- {
784
- "label": "as.logical",
785
- "kind": 1,
786
- "detail": "Coerce to logical",
787
- "documentation": { "value": "Coerce to logical.\n\n```r\nas.logical(0) # FALSE\nas.logical(1) # TRUE\nas.logical(\"TRUE\") # TRUE\n```" },
788
- "insertText": "as.logical(${1:x})",
789
- "insertTextRules": 4,
790
- "sortText": "01_as.logical"
791
- },
792
- {
793
- "label": "as.integer",
794
- "kind": 1,
795
- "detail": "Coerce to integer",
796
- "documentation": { "value": "Coerce to integer.\n\n```r\nas.integer(3.7) # 3\nas.integer(\"42\") # 42\n```" },
797
- "insertText": "as.integer(${1:x})",
798
- "insertTextRules": 4,
799
- "sortText": "01_as.integer"
800
- },
801
- {
802
- "label": "as.double",
803
- "kind": 1,
804
- "detail": "Coerce to double",
805
- "documentation": { "value": "Coerce to double-precision floating point.\n\n```r\nas.double(1L) # 1\nas.double(\"3.14\") # 3.14\n```" },
806
- "insertText": "as.double(${1:x})",
807
- "insertTextRules": 4,
808
- "sortText": "01_as.double"
809
- },
810
- {
811
- "label": "as.data.frame",
812
- "kind": 1,
813
- "detail": "Coerce to data frame",
814
- "documentation": { "value": "Coerce to a data.frame.\n\n```r\nas.data.frame(matrix(1:6, nrow = 2))\nas.data.frame(my_list)\n```" },
815
- "insertText": "as.data.frame(${1:x})",
816
- "insertTextRules": 4,
817
- "sortText": "01_as.data.frame"
818
- },
819
- {
820
- "label": "data.frame",
821
- "kind": 1,
822
- "detail": "Create a data frame",
823
- "documentation": { "value": "Create a data frame from column vectors.\n\n```r\ndf <- data.frame(\n name = c(\"Alice\", \"Bob\"),\n age = c(25, 30),\n stringsAsFactors = FALSE\n)\n```" },
824
- "insertText": "data.frame(${1:...})",
825
- "insertTextRules": 4,
826
- "sortText": "01_data.frame"
827
- },
828
- {
829
- "label": "matrix",
830
- "kind": 1,
831
- "detail": "Create a matrix",
832
- "documentation": { "value": "Create a matrix from the given values.\n\n```r\nmatrix(1:6, nrow = 2, ncol = 3)\nmatrix(0, nrow = 3, ncol = 3)\n```" },
833
- "insertText": "matrix(${1:data}, nrow = ${2:nrow})",
834
- "insertTextRules": 4,
835
- "sortText": "01_matrix"
836
- },
837
- {
838
- "label": "array",
839
- "kind": 1,
840
- "detail": "Create a multi-dimensional array",
841
- "documentation": { "value": "Create a multi-dimensional array.\n\n```r\narray(1:24, dim = c(2, 3, 4))\n```" },
842
- "insertText": "array(${1:data}, dim = c(${2:dims}))",
843
- "insertTextRules": 4,
844
- "sortText": "01_array"
845
- },
846
- {
847
- "label": "list",
848
- "kind": 1,
849
- "detail": "Create a list",
850
- "documentation": { "value": "Create a list (generic container).\n\n```r\nx <- list(a = 1, b = \"text\", c = TRUE)\nx[[1]]\nx$a\n```" },
851
- "insertText": "list(${1:...})",
852
- "insertTextRules": 4,
853
- "sortText": "01_list"
854
- },
855
- {
856
- "label": "vector",
857
- "kind": 1,
858
- "detail": "Create a vector",
859
- "documentation": { "value": "Create a vector of given mode and length.\n\n```r\nvector(\"numeric\", 5) # 0 0 0 0 0\nvector(\"character\", 3) # \"\" \"\" \"\"\n```" },
860
- "insertText": "vector(\"${1:mode}\", ${2:length})",
861
- "insertTextRules": 4,
862
- "sortText": "01_vector"
863
- },
864
- {
865
- "label": "factor",
866
- "kind": 1,
867
- "detail": "Create a factor",
868
- "documentation": { "value": "Encode a vector as a factor (categorical variable).\n\n```r\nfactor(c(\"low\", \"med\", \"high\"), levels = c(\"low\", \"med\", \"high\"), ordered = TRUE)\n```" },
869
- "insertText": "factor(${1:x})",
870
- "insertTextRules": 4,
871
- "sortText": "01_factor"
872
- },
873
- {
874
- "label": "read.csv",
875
- "kind": 1,
876
- "detail": "Read CSV file",
877
- "documentation": { "value": "Read a CSV file into a data frame.\n\n```r\ndf <- read.csv(\"data.csv\")\ndf <- read.csv(\"data.csv\", stringsAsFactors = FALSE, na.strings = c(\"\", \"NA\"))\n```" },
878
- "insertText": "read.csv(\"${1:file.csv}\")",
879
- "insertTextRules": 4,
880
- "sortText": "01_read.csv"
881
- },
882
- {
883
- "label": "read.table",
884
- "kind": 1,
885
- "detail": "Read tabular data",
886
- "documentation": { "value": "Read a table formatted file into a data frame.\n\n```r\ndf <- read.table(\"data.txt\", header = TRUE, sep = \"\\t\")\n```" },
887
- "insertText": "read.table(\"${1:file}\", header = ${2:TRUE}, sep = \"${3:\\t}\")",
888
- "insertTextRules": 4,
889
- "sortText": "01_read.table"
890
- },
891
- {
892
- "label": "write.csv",
893
- "kind": 1,
894
- "detail": "Write CSV file",
895
- "documentation": { "value": "Write a data frame to a CSV file.\n\n```r\nwrite.csv(df, \"output.csv\", row.names = FALSE)\n```" },
896
- "insertText": "write.csv(${1:x}, \"${2:file.csv}\", row.names = FALSE)",
897
- "insertTextRules": 4,
898
- "sortText": "01_write.csv"
899
- },
900
- {
901
- "label": "write.table",
902
- "kind": 1,
903
- "detail": "Write tabular data",
904
- "documentation": { "value": "Write a data frame to a file.\n\n```r\nwrite.table(df, \"output.txt\", sep = \"\\t\", row.names = FALSE)\n```" },
905
- "insertText": "write.table(${1:x}, \"${2:file}\", sep = \"${3:\\t}\")",
906
- "insertTextRules": 4,
907
- "sortText": "01_write.table"
908
- },
909
- {
910
- "label": "readRDS",
911
- "kind": 1,
912
- "detail": "Read RDS file",
913
- "documentation": { "value": "Read a single R object from file.\n\n```r\nobj <- readRDS(\"data.rds\")\n```" },
914
- "insertText": "readRDS(\"${1:file.rds}\")",
915
- "insertTextRules": 4,
916
- "sortText": "01_readRDS"
917
- },
918
- {
919
- "label": "saveRDS",
920
- "kind": 1,
921
- "detail": "Save RDS file",
922
- "documentation": { "value": "Serialize an R object to file.\n\n```r\nsaveRDS(obj, \"data.rds\")\n```" },
923
- "insertText": "saveRDS(${1:object}, \"${2:file.rds}\")",
924
- "insertTextRules": 4,
925
- "sortText": "01_saveRDS"
926
- },
927
- {
928
- "label": "file.path",
929
- "kind": 1,
930
- "detail": "Construct file paths",
931
- "documentation": { "value": "Construct platform-independent file paths.\n\n```r\nfile.path(\"data\", \"input\", \"file.csv\")\n```" },
932
- "insertText": "file.path(${1:...})",
933
- "insertTextRules": 4,
934
- "sortText": "01_file.path"
935
- },
936
- {
937
- "label": "file.exists",
938
- "kind": 1,
939
- "detail": "Check if file exists",
940
- "documentation": { "value": "Test whether files exist.\n\n```r\nfile.exists(\"data.csv\") # TRUE/FALSE\n```" },
941
- "insertText": "file.exists(\"${1:path}\")",
942
- "insertTextRules": 4,
943
- "sortText": "01_file.exists"
944
- },
945
- {
946
- "label": "dir.create",
947
- "kind": 1,
948
- "detail": "Create a directory",
949
- "documentation": { "value": "Create a directory.\n\n```r\ndir.create(\"output\", recursive = TRUE, showWarnings = FALSE)\n```" },
950
- "insertText": "dir.create(\"${1:path}\", recursive = TRUE)",
951
- "insertTextRules": 4,
952
- "sortText": "01_dir.create"
953
- },
954
- {
955
- "label": "getwd",
956
- "kind": 1,
957
- "detail": "Get working directory",
958
- "documentation": { "value": "Return the current working directory.\n\n```r\ngetwd() # \"/home/user/project\"\n```" },
959
- "insertText": "getwd()",
960
- "sortText": "01_getwd"
961
- },
962
- {
963
- "label": "setwd",
964
- "kind": 1,
965
- "detail": "Set working directory",
966
- "documentation": { "value": "Change the working directory.\n\n```r\nsetwd(\"/path/to/project\")\n```" },
967
- "insertText": "setwd(\"${1:dir}\")",
968
- "insertTextRules": 4,
969
- "sortText": "01_setwd"
970
- },
971
- {
972
- "label": "Sys.time",
973
- "kind": 1,
974
- "detail": "Current date/time",
975
- "documentation": { "value": "Return the current date and time.\n\n```r\nSys.time() # \"2024-01-15 14:30:00 UTC\"\n```" },
976
- "insertText": "Sys.time()",
977
- "sortText": "01_Sys.time"
978
- },
979
- {
980
- "label": "Sys.sleep",
981
- "kind": 1,
982
- "detail": "Pause execution",
983
- "documentation": { "value": "Suspend execution for a given number of seconds.\n\n```r\nSys.sleep(2) # pause 2 seconds\n```" },
984
- "insertText": "Sys.sleep(${1:seconds})",
985
- "insertTextRules": 4,
986
- "sortText": "01_Sys.sleep"
987
- },
988
- {
989
- "label": "system",
990
- "kind": 1,
991
- "detail": "Run system command",
992
- "documentation": { "value": "Invoke an OS command.\n\n```r\nsystem(\"ls -la\")\noutput <- system(\"whoami\", intern = TRUE)\n```" },
993
- "insertText": "system(\"${1:command}\", intern = ${2:TRUE})",
994
- "insertTextRules": 4,
995
- "sortText": "01_system"
996
- },
997
- {
998
- "label": "system2",
999
- "kind": 1,
1000
- "detail": "Run system command (modern)",
1001
- "documentation": { "value": "Invoke an OS command (safer interface).\n\n```r\nsystem2(\"git\", c(\"status\", \"--short\"), stdout = TRUE)\n```" },
1002
- "insertText": "system2(\"${1:command}\", args = c(${2:}))",
1003
- "insertTextRules": 4,
1004
- "sortText": "01_system2"
1005
- },
1006
- {
1007
- "label": "tryCatch",
1008
- "kind": 1,
1009
- "detail": "Error handling",
1010
- "documentation": { "value": "Handle errors and conditions.\n\n```r\nresult <- tryCatch({\n log(-1)\n}, warning = function(w) {\n message(\"Warning: \", w$message)\n}, error = function(e) {\n message(\"Error: \", e$message)\n NA\n}, finally = {\n cat(\"Done\\n\")\n})\n```" },
1011
- "insertText": "tryCatch({\n ${1}\n}, error = function(e) {\n ${2:message(e$message)}\n})",
1012
- "insertTextRules": 4,
1013
- "sortText": "01_tryCatch"
1014
- },
1015
- {
1016
- "label": "withCallingHandlers",
1017
- "kind": 1,
1018
- "detail": "Condition handler (non-exiting)",
1019
- "documentation": { "value": "Establish calling handlers for conditions.\n\n```r\nwithCallingHandlers(\n expr,\n warning = function(w) invokeRestart(\"muffleWarning\")\n)\n```" },
1020
- "insertText": "withCallingHandlers({\n ${1}\n}, warning = function(w) {\n ${2}\n})",
1021
- "insertTextRules": 4,
1022
- "sortText": "01_withCallingHandlers"
1023
- },
1024
- {
1025
- "label": "stop",
1026
- "kind": 1,
1027
- "detail": "Signal an error",
1028
- "documentation": { "value": "Stop execution and signal an error condition.\n\n```r\nstop(\"invalid argument\")\nstop(\"x must be > 0, got: \", x)\n```" },
1029
- "insertText": "stop(\"${1:message}\")",
1030
- "insertTextRules": 4,
1031
- "sortText": "01_stop"
1032
- },
1033
- {
1034
- "label": "warning",
1035
- "kind": 1,
1036
- "detail": "Signal a warning",
1037
- "documentation": { "value": "Generate a warning message.\n\n```r\nwarning(\"deprecated function\")\nwarning(\"NAs introduced by coercion\", call. = FALSE)\n```" },
1038
- "insertText": "warning(\"${1:message}\")",
1039
- "insertTextRules": 4,
1040
- "sortText": "01_warning"
1041
- },
1042
- {
1043
- "label": "message",
1044
- "kind": 1,
1045
- "detail": "Diagnostic message",
1046
- "documentation": { "value": "Generate a diagnostic message (to stderr).\n\n```r\nmessage(\"Processing file: \", filename)\nmessage(\"Step \", i, \" of \", n)\n```" },
1047
- "insertText": "message(\"${1:...}\")",
1048
- "insertTextRules": 4,
1049
- "sortText": "01_message"
1050
- },
1051
- {
1052
- "label": "format",
1053
- "kind": 1,
1054
- "detail": "Format values",
1055
- "documentation": { "value": "Format an R object for pretty printing.\n\n```r\nformat(3.14159, digits = 3) # \"3.14\"\nformat(Sys.Date(), \"%Y-%m-%d\")\n```" },
1056
- "insertText": "format(${1:x})",
1057
- "insertTextRules": 4,
1058
- "sortText": "01_format"
1059
- },
1060
- {
1061
- "label": "substr",
1062
- "kind": 1,
1063
- "detail": "Extract/replace substring",
1064
- "documentation": { "value": "Extract or replace substrings.\n\n```r\nsubstr(\"Hello\", 1, 3) # \"Hel\"\n```" },
1065
- "insertText": "substr(${1:x}, ${2:start}, ${3:stop})",
1066
- "insertTextRules": 4,
1067
- "sortText": "01_substr"
1068
- },
1069
- {
1070
- "label": "substring",
1071
- "kind": 1,
1072
- "detail": "Extract substring (vectorized)",
1073
- "documentation": { "value": "Extract substrings (compatible with replacement).\n\n```r\nsubstring(\"Hello world\", 7) # \"world\"\n```" },
1074
- "insertText": "substring(${1:text}, ${2:first})",
1075
- "insertTextRules": 4,
1076
- "sortText": "01_substring"
1077
- },
1078
- {
1079
- "label": "gsub",
1080
- "kind": 1,
1081
- "detail": "Global pattern replacement",
1082
- "documentation": { "value": "Replace all occurrences of a pattern.\n\n```r\ngsub(\"o\", \"0\", \"foo bar boo\") # \"f00 bar b00\"\ngsub(\"[[:space:]]+\", \"_\", text)\n```" },
1083
- "insertText": "gsub(\"${1:pattern}\", \"${2:replacement}\", ${3:x})",
1084
- "insertTextRules": 4,
1085
- "sortText": "01_gsub"
1086
- },
1087
- {
1088
- "label": "sub",
1089
- "kind": 1,
1090
- "detail": "First pattern replacement",
1091
- "documentation": { "value": "Replace the first occurrence of a pattern.\n\n```r\nsub(\"o\", \"0\", \"foo\") # \"f0o\"\n```" },
1092
- "insertText": "sub(\"${1:pattern}\", \"${2:replacement}\", ${3:x})",
1093
- "insertTextRules": 4,
1094
- "sortText": "01_sub"
1095
- },
1096
- {
1097
- "label": "grep",
1098
- "kind": 1,
1099
- "detail": "Pattern matching (indices)",
1100
- "documentation": { "value": "Search for pattern matches and return indices.\n\n```r\ngrep(\"^a\", c(\"apple\", \"banana\", \"avocado\")) # 1 3\ngrep(\"error\", log_lines, value = TRUE)\n```" },
1101
- "insertText": "grep(\"${1:pattern}\", ${2:x})",
1102
- "insertTextRules": 4,
1103
- "sortText": "01_grep"
1104
- },
1105
- {
1106
- "label": "grepl",
1107
- "kind": 1,
1108
- "detail": "Pattern matching (logical)",
1109
- "documentation": { "value": "Test for pattern matches, return logical vector.\n\n```r\ngrepl(\"^a\", c(\"apple\", \"banana\")) # TRUE FALSE\n```" },
1110
- "insertText": "grepl(\"${1:pattern}\", ${2:x})",
1111
- "insertTextRules": 4,
1112
- "sortText": "01_grepl"
1113
- },
1114
- {
1115
- "label": "regexpr",
1116
- "kind": 1,
1117
- "detail": "First regex match position",
1118
- "documentation": { "value": "Find the first match of a pattern.\n\n```r\nm <- regexpr(\"[0-9]+\", \"abc123def\")\nregmatches(\"abc123def\", m) # \"123\"\n```" },
1119
- "insertText": "regexpr(\"${1:pattern}\", ${2:text})",
1120
- "insertTextRules": 4,
1121
- "sortText": "01_regexpr"
1122
- },
1123
- {
1124
- "label": "gregexpr",
1125
- "kind": 1,
1126
- "detail": "All regex match positions",
1127
- "documentation": { "value": "Find all matches of a pattern.\n\n```r\nm <- gregexpr(\"[0-9]+\", \"a1b2c3\")\nregmatches(\"a1b2c3\", m) # list(c(\"1\", \"2\", \"3\"))\n```" },
1128
- "insertText": "gregexpr(\"${1:pattern}\", ${2:text})",
1129
- "insertTextRules": 4,
1130
- "sortText": "01_gregexpr"
1131
- },
1132
- {
1133
- "label": "strsplit",
1134
- "kind": 1,
1135
- "detail": "Split strings",
1136
- "documentation": { "value": "Split character strings by a pattern.\n\n```r\nstrsplit(\"a,b,c\", \",\") # list(c(\"a\", \"b\", \"c\"))\nstrsplit(\"hello\", \"\") # list(c(\"h\",\"e\",\"l\",\"l\",\"o\"))\n```" },
1137
- "insertText": "strsplit(${1:x}, \"${2:split}\")",
1138
- "insertTextRules": 4,
1139
- "sortText": "01_strsplit"
1140
- },
1141
- {
1142
- "label": "trimws",
1143
- "kind": 1,
1144
- "detail": "Trim whitespace",
1145
- "documentation": { "value": "Remove leading and/or trailing whitespace.\n\n```r\ntrimws(\" hello \") # \"hello\"\ntrimws(\" hello \", \"left\") # \"hello \"\n```" },
1146
- "insertText": "trimws(${1:x})",
1147
- "insertTextRules": 4,
1148
- "sortText": "01_trimws"
1149
- },
1150
- {
1151
- "label": "toupper",
1152
- "kind": 1,
1153
- "detail": "Convert to uppercase",
1154
- "documentation": { "value": "Convert strings to uppercase.\n\n```r\ntoupper(\"hello\") # \"HELLO\"\n```" },
1155
- "insertText": "toupper(${1:x})",
1156
- "insertTextRules": 4,
1157
- "sortText": "01_toupper"
1158
- },
1159
- {
1160
- "label": "tolower",
1161
- "kind": 1,
1162
- "detail": "Convert to lowercase",
1163
- "documentation": { "value": "Convert strings to lowercase.\n\n```r\ntolower(\"HELLO\") # \"hello\"\n```" },
1164
- "insertText": "tolower(${1:x})",
1165
- "insertTextRules": 4,
1166
- "sortText": "01_tolower"
1167
- },
1168
- {
1169
- "label": "startsWith",
1170
- "kind": 1,
1171
- "detail": "Test if string starts with prefix",
1172
- "documentation": { "value": "Test if strings start with a prefix.\n\n```r\nstartsWith(\"Hello\", \"He\") # TRUE\n```" },
1173
- "insertText": "startsWith(${1:x}, \"${2:prefix}\")",
1174
- "insertTextRules": 4,
1175
- "sortText": "01_startsWith"
1176
- },
1177
- {
1178
- "label": "endsWith",
1179
- "kind": 1,
1180
- "detail": "Test if string ends with suffix",
1181
- "documentation": { "value": "Test if strings end with a suffix.\n\n```r\nendsWith(\"file.csv\", \".csv\") # TRUE\n```" },
1182
- "insertText": "endsWith(${1:x}, \"${2:suffix}\")",
1183
- "insertTextRules": 4,
1184
- "sortText": "01_endsWith"
1185
- },
1186
- {
1187
- "label": "apply",
1188
- "kind": 1,
1189
- "detail": "Apply function over margins",
1190
- "documentation": { "value": "Apply a function over rows or columns of a matrix.\n\n```r\napply(mat, 1, sum) # row sums\napply(mat, 2, mean) # column means\n```" },
1191
- "insertText": "apply(${1:X}, ${2:MARGIN}, ${3:FUN})",
1192
- "insertTextRules": 4,
1193
- "sortText": "01_apply"
1194
- },
1195
- {
1196
- "label": "sapply",
1197
- "kind": 1,
1198
- "detail": "Apply and simplify",
1199
- "documentation": { "value": "Apply a function and simplify the result.\n\n```r\nsapply(1:5, function(x) x^2) # 1 4 9 16 25\nsapply(df, class)\n```" },
1200
- "insertText": "sapply(${1:X}, ${2:FUN})",
1201
- "insertTextRules": 4,
1202
- "sortText": "01_sapply"
1203
- },
1204
- {
1205
- "label": "lapply",
1206
- "kind": 1,
1207
- "detail": "Apply and return list",
1208
- "documentation": { "value": "Apply a function over a list and return a list.\n\n```r\nlapply(1:3, function(x) x^2) # list(1, 4, 9)\nlapply(files, read.csv)\n```" },
1209
- "insertText": "lapply(${1:X}, ${2:FUN})",
1210
- "insertTextRules": 4,
1211
- "sortText": "01_lapply"
1212
- },
1213
- {
1214
- "label": "vapply",
1215
- "kind": 1,
1216
- "detail": "Apply with type-safe return",
1217
- "documentation": { "value": "Apply with specified return type (safer than sapply).\n\n```r\nvapply(1:5, sqrt, numeric(1))\n```" },
1218
- "insertText": "vapply(${1:X}, ${2:FUN}, ${3:FUN.VALUE})",
1219
- "insertTextRules": 4,
1220
- "sortText": "01_vapply"
1221
- },
1222
- {
1223
- "label": "tapply",
1224
- "kind": 1,
1225
- "detail": "Apply by groups",
1226
- "documentation": { "value": "Apply a function to groups defined by an index.\n\n```r\ntapply(mtcars$mpg, mtcars$cyl, mean)\n```" },
1227
- "insertText": "tapply(${1:X}, ${2:INDEX}, ${3:FUN})",
1228
- "insertTextRules": 4,
1229
- "sortText": "01_tapply"
1230
- },
1231
- {
1232
- "label": "mapply",
1233
- "kind": 1,
1234
- "detail": "Multivariate apply",
1235
- "documentation": { "value": "Apply a function to multiple lists/vectors element-wise.\n\n```r\nmapply(rep, 1:4, 4:1) # rep(1,4), rep(2,3), etc.\n```" },
1236
- "insertText": "mapply(${1:FUN}, ${2:...})",
1237
- "insertTextRules": 4,
1238
- "sortText": "01_mapply"
1239
- },
1240
- {
1241
- "label": "Map",
1242
- "kind": 1,
1243
- "detail": "Wrapper for mapply (no simplify)",
1244
- "documentation": { "value": "Apply a function to corresponding elements (returns list).\n\n```r\nMap(`+`, 1:3, 4:6) # list(5, 7, 9)\n```" },
1245
- "insertText": "Map(${1:f}, ${2:...})",
1246
- "insertTextRules": 4,
1247
- "sortText": "01_Map"
1248
- },
1249
- {
1250
- "label": "Reduce",
1251
- "kind": 1,
1252
- "detail": "Reduce a list to a single value",
1253
- "documentation": { "value": "Apply a binary function cumulatively.\n\n```r\nReduce(`+`, 1:5) # 15\nReduce(merge, list_of_dfs)\n```" },
1254
- "insertText": "Reduce(${1:f}, ${2:x})",
1255
- "insertTextRules": 4,
1256
- "sortText": "01_Reduce"
1257
- },
1258
- {
1259
- "label": "Filter",
1260
- "kind": 1,
1261
- "detail": "Filter elements by predicate",
1262
- "documentation": { "value": "Select elements for which a function returns TRUE.\n\n```r\nFilter(is.numeric, my_list)\nFilter(function(x) x > 0, vec)\n```" },
1263
- "insertText": "Filter(${1:f}, ${2:x})",
1264
- "insertTextRules": 4,
1265
- "sortText": "01_Filter"
1266
- },
1267
- {
1268
- "label": "do.call",
1269
- "kind": 1,
1270
- "detail": "Call a function with args list",
1271
- "documentation": { "value": "Execute a function call with arguments from a list.\n\n```r\ndo.call(rbind, list_of_dfs)\ndo.call(paste, c(words, sep = \"-\"))\n```" },
1272
- "insertText": "do.call(${1:what}, ${2:args})",
1273
- "insertTextRules": 4,
1274
- "sortText": "01_do.call"
1275
- },
1276
- {
1277
- "label": "Vectorize",
1278
- "kind": 1,
1279
- "detail": "Vectorize a scalar function",
1280
- "documentation": { "value": "Create a vectorized version of a function.\n\n```r\nvfunc <- Vectorize(my_scalar_func)\nvfunc(1:5)\n```" },
1281
- "insertText": "Vectorize(${1:FUN})",
1282
- "insertTextRules": 4,
1283
- "sortText": "01_Vectorize"
1284
- },
1285
- {
1286
- "label": "ifelse",
1287
- "kind": 1,
1288
- "detail": "Vectorized conditional",
1289
- "documentation": { "value": "Vectorized conditional: returns values depending on test.\n\n```r\nifelse(x > 0, \"pos\", \"non-pos\")\nifelse(is.na(x), 0, x)\n```" },
1290
- "insertText": "ifelse(${1:test}, ${2:yes}, ${3:no})",
1291
- "insertTextRules": 4,
1292
- "sortText": "01_ifelse"
1293
- },
1294
- {
1295
- "label": "plot",
1296
- "kind": 1,
1297
- "detail": "Generic X-Y plotting",
1298
- "documentation": { "value": "Generic function for plotting R objects.\n\n```r\nplot(x, y)\nplot(1:10, main = \"Title\", xlab = \"X\", ylab = \"Y\", type = \"l\")\n```" },
1299
- "insertText": "plot(${1:x}, ${2:y})",
1300
- "insertTextRules": 4,
1301
- "sortText": "02_plot"
1302
- },
1303
- {
1304
- "label": "hist",
1305
- "kind": 1,
1306
- "detail": "Histogram",
1307
- "documentation": { "value": "Draw a histogram.\n\n```r\nhist(rnorm(1000))\nhist(x, breaks = 30, col = \"steelblue\", main = \"Distribution\")\n```" },
1308
- "insertText": "hist(${1:x})",
1309
- "insertTextRules": 4,
1310
- "sortText": "02_hist"
1311
- },
1312
- {
1313
- "label": "barplot",
1314
- "kind": 1,
1315
- "detail": "Bar plot",
1316
- "documentation": { "value": "Draw a bar plot.\n\n```r\nbarplot(table(x), col = \"steelblue\")\nbarplot(height, names.arg = labels)\n```" },
1317
- "insertText": "barplot(${1:height})",
1318
- "insertTextRules": 4,
1319
- "sortText": "02_barplot"
1320
- },
1321
- {
1322
- "label": "boxplot",
1323
- "kind": 1,
1324
- "detail": "Box-and-whisker plot",
1325
- "documentation": { "value": "Produce box-and-whisker plots.\n\n```r\nboxplot(mpg ~ cyl, data = mtcars)\n```" },
1326
- "insertText": "boxplot(${1:formula}, data = ${2:df})",
1327
- "insertTextRules": 4,
1328
- "sortText": "02_boxplot"
1329
- },
1330
- {
1331
- "label": "lines",
1332
- "kind": 1,
1333
- "detail": "Add lines to a plot",
1334
- "documentation": { "value": "Add connected line segments to an existing plot.\n\n```r\nlines(x, y, col = \"red\", lty = 2)\n```" },
1335
- "insertText": "lines(${1:x}, ${2:y})",
1336
- "insertTextRules": 4,
1337
- "sortText": "02_lines"
1338
- },
1339
- {
1340
- "label": "points",
1341
- "kind": 1,
1342
- "detail": "Add points to a plot",
1343
- "documentation": { "value": "Add points to an existing plot.\n\n```r\npoints(x, y, col = \"red\", pch = 19)\n```" },
1344
- "insertText": "points(${1:x}, ${2:y})",
1345
- "insertTextRules": 4,
1346
- "sortText": "02_points"
1347
- },
1348
- {
1349
- "label": "abline",
1350
- "kind": 1,
1351
- "detail": "Add straight line to a plot",
1352
- "documentation": { "value": "Add straight lines to a plot.\n\n```r\nabline(h = 0, col = \"gray\")\nabline(v = mean(x), lty = 2)\nabline(lm_fit, col = \"red\")\n```" },
1353
- "insertText": "abline(${1:a}, ${2:b})",
1354
- "insertTextRules": 4,
1355
- "sortText": "02_abline"
1356
- },
1357
- {
1358
- "label": "legend",
1359
- "kind": 1,
1360
- "detail": "Add legend to a plot",
1361
- "documentation": { "value": "Add a legend to a plot.\n\n```r\nlegend(\"topright\", legend = c(\"A\", \"B\"), col = c(\"red\", \"blue\"), lty = 1)\n```" },
1362
- "insertText": "legend(\"${1:topright}\", legend = c(${2:...}))",
1363
- "insertTextRules": 4,
1364
- "sortText": "02_legend"
1365
- },
1366
- {
1367
- "label": "title",
1368
- "kind": 1,
1369
- "detail": "Add title to a plot",
1370
- "documentation": { "value": "Add annotations to a plot.\n\n```r\ntitle(main = \"Main Title\", sub = \"Subtitle\", xlab = \"X\", ylab = \"Y\")\n```" },
1371
- "insertText": "title(main = \"${1:Title}\")",
1372
- "insertTextRules": 4,
1373
- "sortText": "02_title"
1374
- },
1375
- {
1376
- "label": "par",
1377
- "kind": 1,
1378
- "detail": "Set graphical parameters",
1379
- "documentation": { "value": "Set or query graphical parameters.\n\n```r\npar(mfrow = c(2, 2)) # 2x2 plot layout\npar(mar = c(5, 4, 4, 2) + 0.1)\n```" },
1380
- "insertText": "par(${1:...})",
1381
- "insertTextRules": 4,
1382
- "sortText": "02_par"
1383
- },
1384
- {
1385
- "label": "ggplot",
1386
- "kind": 1,
1387
- "detail": "Create a ggplot2 plot",
1388
- "documentation": { "value": "Initialize a ggplot2 plot.\n\n```r\nlibrary(ggplot2)\nggplot(df, aes(x = x, y = y)) +\n geom_point() +\n theme_minimal()\n```" },
1389
- "insertText": "ggplot(${1:data}, aes(x = ${2:x}, y = ${3:y})) +\n ${4:geom_point()}",
1390
- "insertTextRules": 4,
1391
- "sortText": "02_ggplot"
1392
- },
1393
- {
1394
- "label": "aes",
1395
- "kind": 1,
1396
- "detail": "Aesthetic mapping (ggplot2)",
1397
- "documentation": { "value": "Define aesthetic mappings for ggplot2.\n\n```r\naes(x = var1, y = var2, color = group)\naes(fill = category, size = value)\n```" },
1398
- "insertText": "aes(x = ${1:x}, y = ${2:y})",
1399
- "insertTextRules": 4,
1400
- "sortText": "02_aes"
1401
- },
1402
- {
1403
- "label": "geom_point",
1404
- "kind": 1,
1405
- "detail": "Scatter plot layer (ggplot2)",
1406
- "documentation": { "value": "Add a scatter plot layer.\n\n```r\nggplot(df, aes(x, y)) + geom_point(size = 3, alpha = 0.7)\n```" },
1407
- "insertText": "geom_point(${1:})",
1408
- "insertTextRules": 4,
1409
- "sortText": "02_geom_point"
1410
- },
1411
- {
1412
- "label": "geom_line",
1413
- "kind": 1,
1414
- "detail": "Line plot layer (ggplot2)",
1415
- "documentation": { "value": "Add a line plot layer.\n\n```r\nggplot(df, aes(x, y)) + geom_line(color = \"blue\")\n```" },
1416
- "insertText": "geom_line(${1:})",
1417
- "insertTextRules": 4,
1418
- "sortText": "02_geom_line"
1419
- },
1420
- {
1421
- "label": "geom_bar",
1422
- "kind": 1,
1423
- "detail": "Bar chart layer (ggplot2)",
1424
- "documentation": { "value": "Add a bar chart layer.\n\n```r\nggplot(df, aes(x = category)) + geom_bar()\nggplot(df, aes(x = cat, y = val)) + geom_bar(stat = \"identity\")\n```" },
1425
- "insertText": "geom_bar(${1:})",
1426
- "insertTextRules": 4,
1427
- "sortText": "02_geom_bar"
1428
- },
1429
- {
1430
- "label": "facet_wrap",
1431
- "kind": 1,
1432
- "detail": "Facet by variable (ggplot2)",
1433
- "documentation": { "value": "Facet a plot by a single variable.\n\n```r\nggplot(df, aes(x, y)) + geom_point() + facet_wrap(~group)\n```" },
1434
- "insertText": "facet_wrap(~${1:variable})",
1435
- "insertTextRules": 4,
1436
- "sortText": "02_facet_wrap"
1437
- },
1438
- {
1439
- "label": "theme",
1440
- "kind": 1,
1441
- "detail": "Customize plot theme (ggplot2)",
1442
- "documentation": { "value": "Modify the non-data components of a plot.\n\n```r\ntheme_minimal()\ntheme(axis.text.x = element_text(angle = 45, hjust = 1))\n```" },
1443
- "insertText": "theme(${1:})",
1444
- "insertTextRules": 4,
1445
- "sortText": "02_theme"
1446
- },
1447
- {
1448
- "label": "install.packages",
1449
- "kind": 1,
1450
- "detail": "Install CRAN packages",
1451
- "documentation": { "value": "Download and install packages from CRAN.\n\n```r\ninstall.packages(\"dplyr\")\ninstall.packages(c(\"ggplot2\", \"tidyr\"))\n```" },
1452
- "insertText": "install.packages(\"${1:package}\")",
1453
- "insertTextRules": 4,
1454
- "sortText": "03_install.packages"
1455
- },
1456
- {
1457
- "label": "remove.packages",
1458
- "kind": 1,
1459
- "detail": "Remove installed packages",
1460
- "documentation": { "value": "Remove installed packages.\n\n```r\nremove.packages(\"old_pkg\")\n```" },
1461
- "insertText": "remove.packages(\"${1:package}\")",
1462
- "insertTextRules": 4,
1463
- "sortText": "03_remove.packages"
1464
- },
1465
- {
1466
- "label": "loadNamespace",
1467
- "kind": 1,
1468
- "detail": "Load a namespace without attaching",
1469
- "documentation": { "value": "Load the namespace of a package without attaching it.\n\n```r\nns <- loadNamespace(\"dplyr\")\n```" },
1470
- "insertText": "loadNamespace(\"${1:package}\")",
1471
- "insertTextRules": 4,
1472
- "sortText": "03_loadNamespace"
1473
- },
1474
- {
1475
- "label": "packageVersion",
1476
- "kind": 1,
1477
- "detail": "Get package version",
1478
- "documentation": { "value": "Return the version of an installed package.\n\n```r\npackageVersion(\"ggplot2\") # '3.4.4'\n```" },
1479
- "insertText": "packageVersion(\"${1:package}\")",
1480
- "insertTextRules": 4,
1481
- "sortText": "03_packageVersion"
1482
- },
1483
- {
1484
- "label": "update.packages",
1485
- "kind": 1,
1486
- "detail": "Update installed packages",
1487
- "documentation": { "value": "Update outdated packages.\n\n```r\nupdate.packages(ask = FALSE)\n```" },
1488
- "insertText": "update.packages(ask = FALSE)",
1489
- "sortText": "03_update.packages"
1490
- },
1491
- {
1492
- "label": "available.packages",
1493
- "kind": 1,
1494
- "detail": "List available packages on CRAN",
1495
- "documentation": { "value": "Return a matrix of available packages on CRAN.\n\n```r\npkgs <- available.packages()\n```" },
1496
- "insertText": "available.packages()",
1497
- "sortText": "03_available.packages"
1498
- },
1499
- {
1500
- "label": "lm",
1501
- "kind": 1,
1502
- "detail": "Fit a linear model",
1503
- "documentation": { "value": "Fit a linear model using ordinary least squares.\n\n```r\nfit <- lm(y ~ x1 + x2, data = df)\nsummary(fit)\ncoef(fit)\n```" },
1504
- "insertText": "lm(${1:formula}, data = ${2:df})",
1505
- "insertTextRules": 4,
1506
- "sortText": "03_lm"
1507
- },
1508
- {
1509
- "label": "glm",
1510
- "kind": 1,
1511
- "detail": "Fit a generalized linear model",
1512
- "documentation": { "value": "Fit a generalized linear model.\n\n```r\nfit <- glm(y ~ x, data = df, family = binomial)\nsummary(fit)\n```" },
1513
- "insertText": "glm(${1:formula}, data = ${2:df}, family = ${3:binomial})",
1514
- "insertTextRules": 4,
1515
- "sortText": "03_glm"
1516
- },
1517
- {
1518
- "label": "t.test",
1519
- "kind": 1,
1520
- "detail": "Student's t-test",
1521
- "documentation": { "value": "Perform a t-test.\n\n```r\nt.test(x, mu = 0)\nt.test(x, y, paired = TRUE)\n```" },
1522
- "insertText": "t.test(${1:x})",
1523
- "insertTextRules": 4,
1524
- "sortText": "03_t.test"
1525
- },
1526
- {
1527
- "label": "cor",
1528
- "kind": 1,
1529
- "detail": "Correlation",
1530
- "documentation": { "value": "Compute correlation between vectors or columns.\n\n```r\ncor(x, y)\ncor(df, use = \"complete.obs\")\n```" },
1531
- "insertText": "cor(${1:x}, ${2:y})",
1532
- "insertTextRules": 4,
1533
- "sortText": "03_cor"
1534
- },
1535
- {
1536
- "label": "cor.test",
1537
- "kind": 1,
1538
- "detail": "Test for correlation",
1539
- "documentation": { "value": "Test for association between paired samples.\n\n```r\ncor.test(x, y, method = \"pearson\")\n```" },
1540
- "insertText": "cor.test(${1:x}, ${2:y})",
1541
- "insertTextRules": 4,
1542
- "sortText": "03_cor.test"
1543
- },
1544
- {
1545
- "label": "chisq.test",
1546
- "kind": 1,
1547
- "detail": "Chi-squared test",
1548
- "documentation": { "value": "Perform a chi-squared test.\n\n```r\nchisq.test(table(x, y))\n```" },
1549
- "insertText": "chisq.test(${1:x})",
1550
- "insertTextRules": 4,
1551
- "sortText": "03_chisq.test"
1552
- },
1553
- {
1554
- "label": "aov",
1555
- "kind": 1,
1556
- "detail": "Analysis of variance",
1557
- "documentation": { "value": "Fit an analysis of variance model.\n\n```r\nfit <- aov(y ~ group, data = df)\nsummary(fit)\n```" },
1558
- "insertText": "aov(${1:formula}, data = ${2:df})",
1559
- "insertTextRules": 4,
1560
- "sortText": "03_aov"
1561
- },
1562
- {
1563
- "label": "anova",
1564
- "kind": 1,
1565
- "detail": "ANOVA table",
1566
- "documentation": { "value": "Compute analysis of variance tables for fitted model objects.\n\n```r\nanova(fit1)\nanova(fit1, fit2)\n```" },
1567
- "insertText": "anova(${1:object})",
1568
- "insertTextRules": 4,
1569
- "sortText": "03_anova"
1570
- },
1571
- {
1572
- "label": "predict",
1573
- "kind": 1,
1574
- "detail": "Model predictions",
1575
- "documentation": { "value": "Obtain predictions from a fitted model.\n\n```r\npredict(fit, newdata = test_df)\npredict(fit, interval = \"confidence\")\n```" },
1576
- "insertText": "predict(${1:object}, newdata = ${2:newdata})",
1577
- "insertTextRules": 4,
1578
- "sortText": "03_predict"
1579
- },
1580
- {
1581
- "label": "residuals",
1582
- "kind": 1,
1583
- "detail": "Model residuals",
1584
- "documentation": { "value": "Extract model residuals.\n\n```r\nresiduals(fit)\nresid(fit) # alias\n```" },
1585
- "insertText": "residuals(${1:object})",
1586
- "insertTextRules": 4,
1587
- "sortText": "03_residuals"
1588
- },
1589
- {
1590
- "label": "fitted",
1591
- "kind": 1,
1592
- "detail": "Fitted values",
1593
- "documentation": { "value": "Extract fitted values from a model.\n\n```r\nfitted(fit)\n```" },
1594
- "insertText": "fitted(${1:object})",
1595
- "insertTextRules": 4,
1596
- "sortText": "03_fitted"
1597
- },
1598
- {
1599
- "label": "confint",
1600
- "kind": 1,
1601
- "detail": "Confidence intervals",
1602
- "documentation": { "value": "Compute confidence intervals for model parameters.\n\n```r\nconfint(fit)\nconfint(fit, level = 0.99)\n```" },
1603
- "insertText": "confint(${1:object})",
1604
- "insertTextRules": 4,
1605
- "sortText": "03_confint"
1606
- },
1607
- {
1608
- "label": "coef",
1609
- "kind": 1,
1610
- "detail": "Model coefficients",
1611
- "documentation": { "value": "Extract model coefficients.\n\n```r\ncoef(fit)\n```" },
1612
- "insertText": "coef(${1:object})",
1613
- "insertTextRules": 4,
1614
- "sortText": "03_coef"
1615
- },
1616
- {
1617
- "label": "setClass",
1618
- "kind": 1,
1619
- "detail": "Define S4 class",
1620
- "documentation": { "value": "Create an S4 class definition.\n\n```r\nsetClass(\"Person\", representation(\n name = \"character\",\n age = \"numeric\"\n))\n```" },
1621
- "insertText": "setClass(\"${1:Class}\", representation(\n ${2:slot} = \"${3:type}\"\n))",
1622
- "insertTextRules": 4,
1623
- "sortText": "04_setClass"
1624
- },
1625
- {
1626
- "label": "setGeneric",
1627
- "kind": 1,
1628
- "detail": "Define S4 generic",
1629
- "documentation": { "value": "Create an S4 generic function.\n\n```r\nsetGeneric(\"greet\", function(object) standardGeneric(\"greet\"))\n```" },
1630
- "insertText": "setGeneric(\"${1:name}\", function(${2:object}) standardGeneric(\"${1:name}\"))",
1631
- "insertTextRules": 4,
1632
- "sortText": "04_setGeneric"
1633
- },
1634
- {
1635
- "label": "setMethod",
1636
- "kind": 1,
1637
- "detail": "Define S4 method",
1638
- "documentation": { "value": "Define an S4 method for a generic.\n\n```r\nsetMethod(\"greet\", \"Person\", function(object) {\n cat(\"Hello,\", object@name, \"\\n\")\n})\n```" },
1639
- "insertText": "setMethod(\"${1:generic}\", \"${2:Class}\", function(${3:object}) {\n ${4}\n})",
1640
- "insertTextRules": 4,
1641
- "sortText": "04_setMethod"
1642
- },
1643
- {
1644
- "label": "setRefClass",
1645
- "kind": 1,
1646
- "detail": "Define reference class (R5)",
1647
- "documentation": { "value": "Create a mutable reference class.\n\n```r\nPerson <- setRefClass(\"Person\",\n fields = list(name = \"character\", age = \"numeric\"),\n methods = list(\n greet = function() cat(\"Hello,\", name, \"\\n\")\n )\n)\n```" },
1648
- "insertText": "setRefClass(\"${1:Class}\",\n fields = list(${2:}),\n methods = list(${3:})\n)",
1649
- "insertTextRules": 4,
1650
- "sortText": "04_setRefClass"
1651
- },
1652
- {
1653
- "label": "R6Class",
1654
- "kind": 1,
1655
- "detail": "Define R6 class",
1656
- "documentation": { "value": "Create an R6 class (requires R6 package).\n\n```r\nlibrary(R6)\nPerson <- R6Class(\"Person\",\n public = list(\n name = NULL,\n initialize = function(name) self$name <- name,\n greet = function() cat(\"Hello,\", self$name, \"\\n\")\n )\n)\np <- Person$new(\"Alice\")\n```" },
1657
- "insertText": "R6Class(\"${1:Class}\",\n public = list(\n initialize = function(${2:}) {\n ${3}\n }\n )\n)",
1658
- "insertTextRules": 4,
1659
- "sortText": "04_R6Class"
1660
- },
1661
- {
1662
- "label": "new.env",
1663
- "kind": 1,
1664
- "detail": "Create a new environment",
1665
- "documentation": { "value": "Create a new environment.\n\n```r\ne <- new.env(parent = emptyenv())\nassign(\"x\", 42, envir = e)\n```" },
1666
- "insertText": "new.env(parent = ${1:emptyenv()})",
1667
- "insertTextRules": 4,
1668
- "sortText": "04_new.env"
1669
- },
1670
- {
1671
- "label": "environment",
1672
- "kind": 1,
1673
- "detail": "Get/set function environment",
1674
- "documentation": { "value": "Get or set the environment of a function.\n\n```r\nenvironment(my_func)\nenvironment() # current environment\n```" },
1675
- "insertText": "environment(${1:fun})",
1676
- "insertTextRules": 4,
1677
- "sortText": "04_environment"
1678
- },
1679
- {
1680
- "label": "globalenv",
1681
- "kind": 1,
1682
- "detail": "Global environment",
1683
- "documentation": { "value": "Return the global environment.\n\n```r\nglobalenv()\nls(envir = globalenv())\n```" },
1684
- "insertText": "globalenv()",
1685
- "sortText": "04_globalenv"
1686
- },
1687
- {
1688
- "label": "baseenv",
1689
- "kind": 1,
1690
- "detail": "Base environment",
1691
- "documentation": { "value": "Return the base environment.\n\n```r\nbaseenv()\n```" },
1692
- "insertText": "baseenv()",
1693
- "sortText": "04_baseenv"
1694
- },
1695
- {
1696
- "label": "emptyenv",
1697
- "kind": 1,
1698
- "detail": "Empty environment",
1699
- "documentation": { "value": "Return the empty environment (has no parent).\n\n```r\nemptyenv()\n```" },
1700
- "insertText": "emptyenv()",
1701
- "sortText": "04_emptyenv"
1702
- },
1703
- {
1704
- "label": "parent.env",
1705
- "kind": 1,
1706
- "detail": "Parent environment",
1707
- "documentation": { "value": "Return or set the parent (enclosing) environment.\n\n```r\nparent.env(e)\n```" },
1708
- "insertText": "parent.env(${1:env})",
1709
- "insertTextRules": 4,
1710
- "sortText": "04_parent.env"
1711
- },
1712
- {
1713
- "label": "exists",
1714
- "kind": 1,
1715
- "detail": "Check if variable exists",
1716
- "documentation": { "value": "Check if a variable exists in an environment.\n\n```r\nexists(\"x\") # TRUE/FALSE\nexists(\"x\", envir = my_env)\n```" },
1717
- "insertText": "exists(\"${1:name}\")",
1718
- "insertTextRules": 4,
1719
- "sortText": "04_exists"
1720
- },
1721
- {
1722
- "label": "get",
1723
- "kind": 1,
1724
- "detail": "Get value of variable",
1725
- "documentation": { "value": "Retrieve a variable by name.\n\n```r\nget(\"x\")\nget(\"func\", envir = ns)\n```" },
1726
- "insertText": "get(\"${1:name}\")",
1727
- "insertTextRules": 4,
1728
- "sortText": "04_get"
1729
- },
1730
- {
1731
- "label": "assign",
1732
- "kind": 1,
1733
- "detail": "Assign value to variable",
1734
- "documentation": { "value": "Assign a value to a name in an environment.\n\n```r\nassign(\"x\", 42)\nassign(\"y\", 100, envir = my_env)\n```" },
1735
- "insertText": "assign(\"${1:name}\", ${2:value})",
1736
- "insertTextRules": 4,
1737
- "sortText": "04_assign"
1738
- },
1739
- {
1740
- "label": "rm",
1741
- "kind": 1,
1742
- "detail": "Remove objects",
1743
- "documentation": { "value": "Remove objects from an environment.\n\n```r\nrm(x, y)\nrm(list = ls()) # clear all\n```" },
1744
- "insertText": "rm(${1:...})",
1745
- "insertTextRules": 4,
1746
- "sortText": "04_rm"
1747
- },
1748
- {
1749
- "label": "ls",
1750
- "kind": 1,
1751
- "detail": "List objects",
1752
- "documentation": { "value": "List objects in an environment.\n\n```r\nls()\nls(envir = my_env)\nls(pattern = \"^data\")\n```" },
1753
- "insertText": "ls()",
1754
- "sortText": "04_ls"
1755
- },
1756
- {
1757
- "label": "attach",
1758
- "kind": 1,
1759
- "detail": "Attach data to search path",
1760
- "documentation": { "value": "Attach a data frame or list to the search path.\n\n```r\nattach(mtcars)\nmpg # directly accessible\ndetach(mtcars)\n```" },
1761
- "insertText": "attach(${1:what})",
1762
- "insertTextRules": 4,
1763
- "sortText": "04_attach"
1764
- },
1765
- {
1766
- "label": "detach",
1767
- "kind": 1,
1768
- "detail": "Detach from search path",
1769
- "documentation": { "value": "Detach a previously attached object.\n\n```r\ndetach(mtcars)\ndetach(\"package:dplyr\")\n```" },
1770
- "insertText": "detach(${1:name})",
1771
- "insertTextRules": 4,
1772
- "sortText": "04_detach"
1773
- },
1774
- {
1775
- "label": "search",
1776
- "kind": 1,
1777
- "detail": "Show search path",
1778
- "documentation": { "value": "Return the current search path.\n\n```r\nsearch()\n# \".GlobalEnv\" \"package:stats\" ...\n```" },
1779
- "insertText": "search()",
1780
- "sortText": "04_search"
1781
- },
1782
- {
1783
- "label": "for_loop",
1784
- "kind": 27,
1785
- "detail": "Snippet: for loop",
1786
- "documentation": { "value": "Standard for loop iterating over a sequence.\n\n```r\nfor (i in 1:n) {\n # body\n}\n```" },
1787
- "insertText": "for (${1:i} in ${2:1:n}) {\n ${3}\n}",
1788
- "insertTextRules": 4,
1789
- "sortText": "05_for_loop"
1790
- },
1791
- {
1792
- "label": "while_loop",
1793
- "kind": 27,
1794
- "detail": "Snippet: while loop",
1795
- "documentation": { "value": "While loop.\n\n```r\nwhile (condition) {\n # body\n}\n```" },
1796
- "insertText": "while (${1:condition}) {\n ${2}\n}",
1797
- "insertTextRules": 4,
1798
- "sortText": "05_while_loop"
1799
- },
1800
- {
1801
- "label": "func_def",
1802
- "kind": 27,
1803
- "detail": "Snippet: function definition",
1804
- "documentation": { "value": "Define a named function.\n\n```r\nmy_func <- function(x, y = 1) {\n x + y\n}\n```" },
1805
- "insertText": "${1:name} <- function(${2:args}) {\n ${3}\n}",
1806
- "insertTextRules": 4,
1807
- "sortText": "05_func_def"
1808
- },
1809
- {
1810
- "label": "if_else_block",
1811
- "kind": 27,
1812
- "detail": "Snippet: if-else block",
1813
- "documentation": { "value": "Full if/else if/else block.\n\n```r\nif (cond1) {\n # ...\n} else if (cond2) {\n # ...\n} else {\n # ...\n}\n```" },
1814
- "insertText": "if (${1:condition}) {\n ${2}\n} else {\n ${3}\n}",
1815
- "insertTextRules": 4,
1816
- "sortText": "05_if_else_block"
1817
- },
1818
- {
1819
- "label": "trycatch_block",
1820
- "kind": 27,
1821
- "detail": "Snippet: tryCatch block",
1822
- "documentation": { "value": "Error handling block.\n\n```r\ntryCatch({\n # risky code\n}, error = function(e) {\n message(e$message)\n})\n```" },
1823
- "insertText": "tryCatch({\n ${1}\n}, warning = function(w) {\n message(\"Warning: \", w$message)\n}, error = function(e) {\n message(\"Error: \", e$message)\n ${2:NULL}\n})",
1824
- "insertTextRules": 4,
1825
- "sortText": "05_trycatch_block"
1826
- },
1827
- {
1828
- "label": "read_csv_snippet",
1829
- "kind": 27,
1830
- "detail": "Snippet: read CSV file",
1831
- "documentation": { "value": "Read a CSV file into a data frame.\n\n```r\ndf <- read.csv(\"data.csv\", stringsAsFactors = FALSE)\nstr(df)\nhead(df)\n```" },
1832
- "insertText": "${1:df} <- read.csv(\"${2:data.csv}\", stringsAsFactors = FALSE)\nstr(${1:df})\nhead(${1:df})",
1833
- "insertTextRules": 4,
1834
- "sortText": "05_read_csv_snippet"
1835
- },
1836
- {
1837
- "label": "ggplot_snippet",
1838
- "kind": 27,
1839
- "detail": "Snippet: ggplot scatter plot",
1840
- "documentation": { "value": "A quick ggplot2 scatter plot.\n\n```r\nlibrary(ggplot2)\nggplot(df, aes(x = x, y = y)) +\n geom_point() +\n labs(title = \"Title\") +\n theme_minimal()\n```" },
1841
- "insertText": "library(ggplot2)\nggplot(${1:df}, aes(x = ${2:x}, y = ${3:y})) +\n geom_point() +\n labs(title = \"${4:Title}\") +\n theme_minimal()",
1842
- "insertTextRules": 4,
1843
- "sortText": "05_ggplot_snippet"
1844
- },
1845
- {
1846
- "label": "pipe_data",
1847
- "kind": 27,
1848
- "detail": "Snippet: data pipeline (pipes)",
1849
- "documentation": { "value": "Data transformation pipeline using the native pipe.\n\n```r\nlibrary(dplyr)\nresult <- df |>\n filter(x > 0) |>\n mutate(y = x * 2) |>\n summarise(mean_y = mean(y))\n```" },
1850
- "insertText": "${1:result} <- ${2:df} |>\n filter(${3:condition}) |>\n mutate(${4:new_col} = ${5:expr}) |>\n summarise(${6:agg} = ${7:mean}(${8:col}))",
1851
- "insertTextRules": 4,
1852
- "sortText": "05_pipe_data"
1853
- },
1854
- {
1855
- "label": "shiny_app",
1856
- "kind": 27,
1857
- "detail": "Snippet: Shiny app skeleton",
1858
- "documentation": { "value": "Basic Shiny application template.\n\n```r\nlibrary(shiny)\nui <- fluidPage(\n titlePanel(\"My App\"),\n sidebarLayout(\n sidebarPanel(sliderInput(\"n\", \"N:\", 1, 100, 50)),\n mainPanel(plotOutput(\"plot\"))\n )\n)\nserver <- function(input, output) {\n output$plot <- renderPlot({ hist(rnorm(input$n)) })\n}\nshinyApp(ui, server)\n```" },
1859
- "insertText": "library(shiny)\n\nui <- fluidPage(\n titlePanel(\"${1:My App}\"),\n sidebarLayout(\n sidebarPanel(\n ${2:sliderInput(\"n\", \"N:\", 1, 100, 50)}\n ),\n mainPanel(\n ${3:plotOutput(\"plot\")}\n )\n )\n)\n\nserver <- function(input, output) {\n output\\$${4:plot} <- renderPlot({\n ${5:hist(rnorm(input\\$n))}\n })\n}\n\nshinyApp(ui, server)",
1860
- "insertTextRules": 4,
1861
- "sortText": "05_shiny_app"
1862
- },
1863
- {
1864
- "label": "r6_class_snippet",
1865
- "kind": 27,
1866
- "detail": "Snippet: R6 class definition",
1867
- "documentation": { "value": "R6 class template.\n\n```r\nlibrary(R6)\nMyClass <- R6Class(\"MyClass\",\n public = list(\n initialize = function(...) { },\n method = function() { }\n )\n)\n```" },
1868
- "insertText": "library(R6)\n${1:MyClass} <- R6Class(\"${1:MyClass}\",\n public = list(\n ${2:field} = NULL,\n initialize = function(${3:}) {\n self\\$${2:field} <- ${3:}\n },\n ${4:method} = function() {\n ${5}\n }\n )\n)",
1869
- "insertTextRules": 4,
1870
- "sortText": "05_r6_class_snippet"
1871
- },
1872
- {
1873
- "label": "integer",
1874
- "kind": 7,
1875
- "detail": "Type: integer",
1876
- "documentation": { "value": "Integer type. Created with `L` suffix or `as.integer()`.\n\n```r\nx <- 42L\ntypeof(x) # \"integer\"\n```" },
1877
- "insertText": "integer",
1878
- "sortText": "06_integer"
1879
- },
1880
- {
1881
- "label": "double",
1882
- "kind": 7,
1883
- "detail": "Type: double",
1884
- "documentation": { "value": "Double-precision floating point number.\n\n```r\nx <- 3.14\ntypeof(x) # \"double\"\n```" },
1885
- "insertText": "double",
1886
- "sortText": "06_double"
1887
- },
1888
- {
1889
- "label": "character",
1890
- "kind": 7,
1891
- "detail": "Type: character",
1892
- "documentation": { "value": "Character (string) type.\n\n```r\nx <- \"hello\"\ntypeof(x) # \"character\"\n```" },
1893
- "insertText": "character",
1894
- "sortText": "06_character"
1895
- },
1896
- {
1897
- "label": "logical",
1898
- "kind": 7,
1899
- "detail": "Type: logical",
1900
- "documentation": { "value": "Logical type (TRUE/FALSE/NA).\n\n```r\nx <- TRUE\ntypeof(x) # \"logical\"\n```" },
1901
- "insertText": "logical",
1902
- "sortText": "06_logical"
1903
- },
1904
- {
1905
- "label": "complex",
1906
- "kind": 7,
1907
- "detail": "Type: complex",
1908
- "documentation": { "value": "Complex number type.\n\n```r\nx <- 1 + 2i\ntypeof(x) # \"complex\"\n```" },
1909
- "insertText": "complex",
1910
- "sortText": "06_complex"
1911
- },
1912
- {
1913
- "label": "raw",
1914
- "kind": 7,
1915
- "detail": "Type: raw",
1916
- "documentation": { "value": "Raw byte type.\n\n```r\nx <- charToRaw(\"A\")\ntypeof(x) # \"raw\"\n```" },
1917
- "insertText": "raw",
1918
- "sortText": "06_raw"
1919
- },
1920
- {
1921
- "label": "data.frame_type",
1922
- "kind": 7,
1923
- "detail": "Type: data.frame",
1924
- "documentation": { "value": "Data frame — tabular data structure with named columns.\n\n```r\ndf <- data.frame(x = 1:3, y = c(\"a\", \"b\", \"c\"))\nclass(df) # \"data.frame\"\n```" },
1925
- "insertText": "data.frame",
1926
- "sortText": "06_data.frame"
1927
- },
1928
- {
1929
- "label": "matrix_type",
1930
- "kind": 7,
1931
- "detail": "Type: matrix",
1932
- "documentation": { "value": "Matrix — 2D array of same-type elements.\n\n```r\nm <- matrix(1:6, nrow = 2)\nclass(m) # \"matrix\" \"array\"\n```" },
1933
- "insertText": "matrix",
1934
- "sortText": "06_matrix"
1935
- },
1936
- {
1937
- "label": "factor_type",
1938
- "kind": 7,
1939
- "detail": "Type: factor",
1940
- "documentation": { "value": "Factor — categorical variable with fixed levels.\n\n```r\nf <- factor(c(\"low\", \"med\", \"high\"))\nclass(f) # \"factor\"\n```" },
1941
- "insertText": "factor",
1942
- "sortText": "06_factor"
1943
- },
1944
- {
1945
- "label": "environment_type",
1946
- "kind": 7,
1947
- "detail": "Type: environment",
1948
- "documentation": { "value": "Environment — frame for variable bindings.\n\n```r\ne <- new.env()\nis.environment(e) # TRUE\n```" },
1949
- "insertText": "environment",
1950
- "sortText": "06_environment"
1951
- },
1952
- {
1953
- "label": "formula",
1954
- "kind": 7,
1955
- "detail": "Type: formula",
1956
- "documentation": { "value": "Formula — symbolic model specification.\n\n```r\nf <- y ~ x1 + x2\nclass(f) # \"formula\"\n```" },
1957
- "insertText": "formula",
1958
- "sortText": "06_formula"
1959
- },
1960
- {
1961
- "label": "expression",
1962
- "kind": 7,
1963
- "detail": "Type: expression",
1964
- "documentation": { "value": "Expression — unevaluated R expressions.\n\n```r\ne <- expression(1 + 2)\neval(e) # 3\n```" },
1965
- "insertText": "expression",
1966
- "sortText": "06_expression"
1967
- },
1968
- {
1969
- "label": "call_type",
1970
- "kind": 7,
1971
- "detail": "Type: call",
1972
- "documentation": { "value": "Call — an unevaluated function call.\n\n```r\ncl <- quote(mean(x))\nclass(cl) # \"call\"\n```" },
1973
- "insertText": "call",
1974
- "sortText": "06_call"
1975
- },
1976
- {
1977
- "label": "symbol_type",
1978
- "kind": 7,
1979
- "detail": "Type: symbol/name",
1980
- "documentation": { "value": "Symbol — a variable name.\n\n```r\ns <- as.name(\"x\")\nclass(s) # \"name\"\n```" },
1981
- "insertText": "symbol",
1982
- "sortText": "06_symbol"
1983
- }
1984
- ]
1985
- }
1
+ {
2
+ "language": "r",
3
+ "completions": [
4
+ {
5
+ "label": "if",
6
+ "kind": 14,
7
+ "detail": "Conditional execution (keyword)",
8
+ "documentation": {
9
+ "value": "Conditional branching.\n\n```r\nif (condition) {\n # true branch\n} else {\n # false branch\n}\n```"
10
+ },
11
+ "insertText": "if (${1:condition}) {\n ${2}\n}",
12
+ "insertTextRules": 4,
13
+ "sortText": "00_if"
14
+ },
15
+ {
16
+ "label": "else",
17
+ "kind": 14,
18
+ "detail": "Alternative branch (keyword)",
19
+ "documentation": {
20
+ "value": "Alternative branch in `if` statement.\n\n```r\nif (x > 0) {\n print(\"positive\")\n} else {\n print(\"non-positive\")\n}\n```"
21
+ },
22
+ "insertText": "else {\n ${1}\n}",
23
+ "insertTextRules": 4,
24
+ "sortText": "00_else"
25
+ },
26
+ {
27
+ "label": "for",
28
+ "kind": 14,
29
+ "detail": "For loop (keyword)",
30
+ "documentation": {
31
+ "value": "Iterate over elements of a vector.\n\n```r\nfor (i in 1:10) {\n print(i)\n}\n\nfor (item in my_list) {\n cat(item, \"\\n\")\n}\n```"
32
+ },
33
+ "insertText": "for (${1:i} in ${2:seq}) {\n ${3}\n}",
34
+ "insertTextRules": 4,
35
+ "sortText": "00_for"
36
+ },
37
+ {
38
+ "label": "while",
39
+ "kind": 14,
40
+ "detail": "While loop (keyword)",
41
+ "documentation": {
42
+ "value": "Execute a block while a condition is TRUE.\n\n```r\nwhile (x > 0) {\n x <- x - 1\n}\n```"
43
+ },
44
+ "insertText": "while (${1:condition}) {\n ${2}\n}",
45
+ "insertTextRules": 4,
46
+ "sortText": "00_while"
47
+ },
48
+ {
49
+ "label": "repeat",
50
+ "kind": 14,
51
+ "detail": "Infinite loop (keyword)",
52
+ "documentation": {
53
+ "value": "Execute a block indefinitely until `break` is called.\n\n```r\nrepeat {\n x <- x + 1\n if (x > 10) break\n}\n```"
54
+ },
55
+ "insertText": "repeat {\n ${1}\n if (${2:condition}) break\n}",
56
+ "insertTextRules": 4,
57
+ "sortText": "00_repeat"
58
+ },
59
+ {
60
+ "label": "in",
61
+ "kind": 14,
62
+ "detail": "Membership operator (keyword)",
63
+ "documentation": {
64
+ "value": "Used in `for` loops to iterate over sequences.\n\n```r\nfor (x in 1:10) print(x)\n```"
65
+ },
66
+ "insertText": "in",
67
+ "sortText": "00_in",
68
+ "insertTextRules": 0
69
+ },
70
+ {
71
+ "label": "next",
72
+ "kind": 14,
73
+ "detail": "Skip to next iteration (keyword)",
74
+ "documentation": {
75
+ "value": "Skip the rest of the current iteration and proceed to the next.\n\n```r\nfor (i in 1:10) {\n if (i %% 2 == 0) next\n print(i)\n}\n```"
76
+ },
77
+ "insertText": "next",
78
+ "sortText": "00_next",
79
+ "insertTextRules": 0
80
+ },
81
+ {
82
+ "label": "break",
83
+ "kind": 14,
84
+ "detail": "Exit loop (keyword)",
85
+ "documentation": {
86
+ "value": "Exit the current `for`, `while`, or `repeat` loop.\n\n```r\nfor (i in 1:100) {\n if (i > 10) break\n}\n```"
87
+ },
88
+ "insertText": "break",
89
+ "sortText": "00_break",
90
+ "insertTextRules": 0
91
+ },
92
+ {
93
+ "label": "function",
94
+ "kind": 14,
95
+ "detail": "Define a function (keyword)",
96
+ "documentation": {
97
+ "value": "Create a function object.\n\n```r\nmy_func <- function(x, y = 1) {\n x + y\n}\n\n# Anonymous function\nsapply(1:5, function(x) x^2)\n```"
98
+ },
99
+ "insertText": "function(${1:args}) {\n ${2}\n}",
100
+ "insertTextRules": 4,
101
+ "sortText": "00_function"
102
+ },
103
+ {
104
+ "label": "return",
105
+ "kind": 14,
106
+ "detail": "Return value from function (keyword)",
107
+ "documentation": {
108
+ "value": "Explicitly return a value from a function.\n\n```r\nmy_func <- function(x) {\n if (x < 0) return(NULL)\n sqrt(x)\n}\n```"
109
+ },
110
+ "insertText": "return(${1:value})",
111
+ "insertTextRules": 4,
112
+ "sortText": "00_return"
113
+ },
114
+ {
115
+ "label": "TRUE",
116
+ "kind": 14,
117
+ "detail": "Logical constant TRUE",
118
+ "documentation": {
119
+ "value": "Logical truth value.\n\n```r\nx <- TRUE\nis.logical(TRUE) # TRUE\n```"
120
+ },
121
+ "insertText": "TRUE",
122
+ "sortText": "00_TRUE",
123
+ "insertTextRules": 0
124
+ },
125
+ {
126
+ "label": "FALSE",
127
+ "kind": 14,
128
+ "detail": "Logical constant FALSE",
129
+ "documentation": {
130
+ "value": "Logical false value.\n\n```r\nx <- FALSE\n!FALSE # TRUE\n```"
131
+ },
132
+ "insertText": "FALSE",
133
+ "sortText": "00_FALSE",
134
+ "insertTextRules": 0
135
+ },
136
+ {
137
+ "label": "NULL",
138
+ "kind": 14,
139
+ "detail": "Null object",
140
+ "documentation": {
141
+ "value": "The NULL object represents the absence of a value.\n\n```r\nx <- NULL\nis.null(x) # TRUE\nlength(NULL) # 0\n```"
142
+ },
143
+ "insertText": "NULL",
144
+ "sortText": "00_NULL",
145
+ "insertTextRules": 0
146
+ },
147
+ {
148
+ "label": "NA",
149
+ "kind": 14,
150
+ "detail": "Missing value indicator",
151
+ "documentation": {
152
+ "value": "Logical constant representing a missing value.\n\n```r\nx <- c(1, NA, 3)\nis.na(x) # FALSE TRUE FALSE\nna.rm = TRUE # common argument to ignore NAs\n```"
153
+ },
154
+ "insertText": "NA",
155
+ "sortText": "00_NA",
156
+ "insertTextRules": 0
157
+ },
158
+ {
159
+ "label": "NA_integer_",
160
+ "kind": 14,
161
+ "detail": "Integer NA",
162
+ "documentation": {
163
+ "value": "Missing value of integer type.\n\n```r\nx <- NA_integer_\nis.na(x) # TRUE\ntypeof(x) # \"integer\"\n```"
164
+ },
165
+ "insertText": "NA_integer_",
166
+ "sortText": "00_NA_integer_",
167
+ "insertTextRules": 0
168
+ },
169
+ {
170
+ "label": "NA_real_",
171
+ "kind": 14,
172
+ "detail": "Double/real NA",
173
+ "documentation": {
174
+ "value": "Missing value of double type.\n\n```r\nx <- NA_real_\ntypeof(x) # \"double\"\n```"
175
+ },
176
+ "insertText": "NA_real_",
177
+ "sortText": "00_NA_real_",
178
+ "insertTextRules": 0
179
+ },
180
+ {
181
+ "label": "NA_complex_",
182
+ "kind": 14,
183
+ "detail": "Complex NA",
184
+ "documentation": {
185
+ "value": "Missing value of complex type.\n\n```r\nx <- NA_complex_\ntypeof(x) # \"complex\"\n```"
186
+ },
187
+ "insertText": "NA_complex_",
188
+ "sortText": "00_NA_complex_",
189
+ "insertTextRules": 0
190
+ },
191
+ {
192
+ "label": "NA_character_",
193
+ "kind": 14,
194
+ "detail": "Character NA",
195
+ "documentation": {
196
+ "value": "Missing value of character type.\n\n```r\nx <- NA_character_\ntypeof(x) # \"character\"\n```"
197
+ },
198
+ "insertText": "NA_character_",
199
+ "sortText": "00_NA_character_",
200
+ "insertTextRules": 0
201
+ },
202
+ {
203
+ "label": "Inf",
204
+ "kind": 14,
205
+ "detail": "Positive infinity",
206
+ "documentation": {
207
+ "value": "Positive infinity.\n\n```r\n1 / 0 # Inf\nis.infinite(Inf) # TRUE\n```"
208
+ },
209
+ "insertText": "Inf",
210
+ "sortText": "00_Inf",
211
+ "insertTextRules": 0
212
+ },
213
+ {
214
+ "label": "NaN",
215
+ "kind": 14,
216
+ "detail": "Not a Number",
217
+ "documentation": {
218
+ "value": "Not a Number — result of undefined numeric operations.\n\n```r\n0 / 0 # NaN\nis.nan(NaN) # TRUE\n```"
219
+ },
220
+ "insertText": "NaN",
221
+ "sortText": "00_NaN",
222
+ "insertTextRules": 0
223
+ },
224
+ {
225
+ "label": "library",
226
+ "kind": 1,
227
+ "detail": "Load and attach a package",
228
+ "documentation": {
229
+ "value": "Load and attach a package namespace.\n\n```r\nlibrary(dplyr)\nlibrary(ggplot2)\nlibrary(tidyr, warn.conflicts = FALSE)\n```"
230
+ },
231
+ "insertText": "library(${1:package})",
232
+ "insertTextRules": 4,
233
+ "sortText": "00_library"
234
+ },
235
+ {
236
+ "label": "require",
237
+ "kind": 1,
238
+ "detail": "Load a package (returns logical)",
239
+ "documentation": {
240
+ "value": "Try to load a package. Returns TRUE/FALSE instead of erroring.\n\n```r\nif (!require(dplyr)) install.packages(\"dplyr\")\n```"
241
+ },
242
+ "insertText": "require(${1:package})",
243
+ "insertTextRules": 4,
244
+ "sortText": "00_require"
245
+ },
246
+ {
247
+ "label": "source",
248
+ "kind": 1,
249
+ "detail": "Read and evaluate R code from a file",
250
+ "documentation": {
251
+ "value": "Parse and evaluate R expressions from a file.\n\n```r\nsource(\"helper_functions.R\")\nsource(\"config.R\", local = TRUE)\n```"
252
+ },
253
+ "insertText": "source(\"${1:file.R}\")",
254
+ "insertTextRules": 4,
255
+ "sortText": "00_source"
256
+ },
257
+ {
258
+ "label": "local",
259
+ "kind": 1,
260
+ "detail": "Evaluate in a local environment",
261
+ "documentation": {
262
+ "value": "Evaluate expression in a local environment.\n\n```r\nresult <- local({\n tmp <- 42\n tmp * 2\n})\n```"
263
+ },
264
+ "insertText": "local({\n ${1}\n})",
265
+ "insertTextRules": 4,
266
+ "sortText": "00_local"
267
+ },
268
+ {
269
+ "label": "switch",
270
+ "kind": 1,
271
+ "detail": "Multi-way conditional",
272
+ "documentation": {
273
+ "value": "Select one of several alternatives based on a value.\n\n```r\nresult <- switch(x,\n \"a\" = 1,\n \"b\" = 2,\n \"c\" = 3,\n -1 # default\n)\n```"
274
+ },
275
+ "insertText": "switch(${1:expr},\n ${2:case1} = ${3:value1},\n ${4:default}\n)",
276
+ "insertTextRules": 4,
277
+ "sortText": "00_switch"
278
+ },
279
+ {
280
+ "label": "print",
281
+ "kind": 1,
282
+ "detail": "Print values",
283
+ "documentation": {
284
+ "value": "Generic print function for displaying objects.\n\n```r\nprint(x)\nprint(df, n = 20)\nprint(\"hello\")\n```"
285
+ },
286
+ "insertText": "print(${1:x})",
287
+ "insertTextRules": 4,
288
+ "sortText": "01_print"
289
+ },
290
+ {
291
+ "label": "cat",
292
+ "kind": 1,
293
+ "detail": "Concatenate and print",
294
+ "documentation": {
295
+ "value": "Concatenate and print to stdout or a file.\n\n```r\ncat(\"Hello\", \"world\\n\")\ncat(\"x =\", x, \"\\n\")\ncat(\"line\\n\", file = \"out.txt\", append = TRUE)\n```"
296
+ },
297
+ "insertText": "cat(${1:...})",
298
+ "insertTextRules": 4,
299
+ "sortText": "01_cat"
300
+ },
301
+ {
302
+ "label": "paste",
303
+ "kind": 1,
304
+ "detail": "Concatenate strings with separator",
305
+ "documentation": {
306
+ "value": "Concatenate strings with a separator (default space).\n\n```r\npaste(\"Hello\", \"world\") # \"Hello world\"\npaste(\"a\", \"b\", sep = \"-\") # \"a-b\"\npaste0(\"x\", 1:3) # \"x1\" \"x2\" \"x3\"\n```"
307
+ },
308
+ "insertText": "paste(${1:...}, sep = \"${2: }\")",
309
+ "insertTextRules": 4,
310
+ "sortText": "01_paste"
311
+ },
312
+ {
313
+ "label": "paste0",
314
+ "kind": 1,
315
+ "detail": "Concatenate strings without separator",
316
+ "documentation": {
317
+ "value": "Concatenate strings with no separator (equivalent to `paste(..., sep = \"\")`.\n\n```r\npaste0(\"file\", 1:3, \".csv\") # \"file1.csv\" \"file2.csv\" \"file3.csv\"\npaste0(\"prefix_\", name)\n```"
318
+ },
319
+ "insertText": "paste0(${1:...})",
320
+ "insertTextRules": 4,
321
+ "sortText": "01_paste0"
322
+ },
323
+ {
324
+ "label": "sprintf",
325
+ "kind": 1,
326
+ "detail": "Formatted string output",
327
+ "documentation": {
328
+ "value": "C-style string formatting.\n\n```r\nsprintf(\"%s is %d years old\", name, age)\nsprintf(\"%.2f%%\", pct * 100)\nsprintf(\"%05d\", id)\n```"
329
+ },
330
+ "insertText": "sprintf(\"${1:%s}\", ${2:...})",
331
+ "insertTextRules": 4,
332
+ "sortText": "01_sprintf"
333
+ },
334
+ {
335
+ "label": "c",
336
+ "kind": 1,
337
+ "detail": "Combine values into a vector",
338
+ "documentation": {
339
+ "value": "Combine values into a vector or list.\n\n```r\nx <- c(1, 2, 3)\nnames <- c(\"Alice\", \"Bob\")\nmixed <- c(a = 1, b = 2)\n```"
340
+ },
341
+ "insertText": "c(${1:...})",
342
+ "insertTextRules": 4,
343
+ "sortText": "01_c"
344
+ },
345
+ {
346
+ "label": "length",
347
+ "kind": 1,
348
+ "detail": "Length of an object",
349
+ "documentation": {
350
+ "value": "Get or set the length of a vector or list.\n\n```r\nlength(1:10) # 10\nlength(list(a=1)) # 1\nlength(NULL) # 0\n```"
351
+ },
352
+ "insertText": "length(${1:x})",
353
+ "insertTextRules": 4,
354
+ "sortText": "01_length"
355
+ },
356
+ {
357
+ "label": "nchar",
358
+ "kind": 1,
359
+ "detail": "Number of characters in a string",
360
+ "documentation": {
361
+ "value": "Count the number of characters in a string.\n\n```r\nnchar(\"hello\") # 5\nnchar(c(\"a\", \"bb\")) # 1 2\n```"
362
+ },
363
+ "insertText": "nchar(${1:x})",
364
+ "insertTextRules": 4,
365
+ "sortText": "01_nchar"
366
+ },
367
+ {
368
+ "label": "seq",
369
+ "kind": 1,
370
+ "detail": "Generate a sequence",
371
+ "documentation": {
372
+ "value": "Generate regular sequences.\n\n```r\nseq(1, 10) # 1 2 ... 10\nseq(0, 1, by = 0.1) # 0.0 0.1 ... 1.0\nseq_len(5) # 1 2 3 4 5\nseq_along(x) # 1:length(x)\n```"
373
+ },
374
+ "insertText": "seq(${1:from}, ${2:to}, by = ${3:1})",
375
+ "insertTextRules": 4,
376
+ "sortText": "01_seq"
377
+ },
378
+ {
379
+ "label": "seq_along",
380
+ "kind": 1,
381
+ "detail": "Sequence along an object",
382
+ "documentation": {
383
+ "value": "Generate a sequence `1, 2, ..., length(x)`.\n\n```r\nfor (i in seq_along(x)) {\n cat(i, x[i], \"\\n\")\n}\n```"
384
+ },
385
+ "insertText": "seq_along(${1:x})",
386
+ "insertTextRules": 4,
387
+ "sortText": "01_seq_along"
388
+ },
389
+ {
390
+ "label": "seq_len",
391
+ "kind": 1,
392
+ "detail": "Sequence of given length",
393
+ "documentation": {
394
+ "value": "Generate sequence `1:length.out`.\n\n```r\nseq_len(5) # 1 2 3 4 5\n```"
395
+ },
396
+ "insertText": "seq_len(${1:n})",
397
+ "insertTextRules": 4,
398
+ "sortText": "01_seq_len"
399
+ },
400
+ {
401
+ "label": "rep",
402
+ "kind": 1,
403
+ "detail": "Replicate elements",
404
+ "documentation": {
405
+ "value": "Replicate elements of a vector.\n\n```r\nrep(0, 5) # 0 0 0 0 0\nrep(1:3, times = 2) # 1 2 3 1 2 3\nrep(1:3, each = 2) # 1 1 2 2 3 3\n```"
406
+ },
407
+ "insertText": "rep(${1:x}, ${2:times})",
408
+ "insertTextRules": 4,
409
+ "sortText": "01_rep"
410
+ },
411
+ {
412
+ "label": "rev",
413
+ "kind": 1,
414
+ "detail": "Reverse a vector",
415
+ "documentation": {
416
+ "value": "Reverse the elements of a vector.\n\n```r\nrev(1:5) # 5 4 3 2 1\nrev(c(\"a\", \"b\")) # \"b\" \"a\"\n```"
417
+ },
418
+ "insertText": "rev(${1:x})",
419
+ "insertTextRules": 4,
420
+ "sortText": "01_rev"
421
+ },
422
+ {
423
+ "label": "sort",
424
+ "kind": 1,
425
+ "detail": "Sort a vector",
426
+ "documentation": {
427
+ "value": "Sort a vector in ascending or descending order.\n\n```r\nsort(c(3, 1, 2)) # 1 2 3\nsort(c(3, 1, 2), decreasing = TRUE) # 3 2 1\n```"
428
+ },
429
+ "insertText": "sort(${1:x})",
430
+ "insertTextRules": 4,
431
+ "sortText": "01_sort"
432
+ },
433
+ {
434
+ "label": "order",
435
+ "kind": 1,
436
+ "detail": "Ordering permutation",
437
+ "documentation": {
438
+ "value": "Return a permutation which rearranges its argument into ascending or descending order.\n\n```r\nx <- c(3, 1, 2)\norder(x) # 2 3 1\nx[order(x)] # 1 2 3\ndf[order(df$age), ]\n```"
439
+ },
440
+ "insertText": "order(${1:...})",
441
+ "insertTextRules": 4,
442
+ "sortText": "01_order"
443
+ },
444
+ {
445
+ "label": "which",
446
+ "kind": 1,
447
+ "detail": "Which indices are TRUE",
448
+ "documentation": {
449
+ "value": "Return indices where a logical vector is TRUE.\n\n```r\nwhich(c(FALSE, TRUE, TRUE)) # 2 3\nwhich(x > 5)\nwhich.min(x)\nwhich.max(x)\n```"
450
+ },
451
+ "insertText": "which(${1:x})",
452
+ "insertTextRules": 4,
453
+ "sortText": "01_which"
454
+ },
455
+ {
456
+ "label": "match",
457
+ "kind": 1,
458
+ "detail": "Value matching",
459
+ "documentation": {
460
+ "value": "Return positions of first matches of first argument in second.\n\n```r\nmatch(c(\"b\", \"d\"), c(\"a\", \"b\", \"c\")) # 2 NA\nx %in% table # logical vector\n```"
461
+ },
462
+ "insertText": "match(${1:x}, ${2:table})",
463
+ "insertTextRules": 4,
464
+ "sortText": "01_match"
465
+ },
466
+ {
467
+ "label": "unique",
468
+ "kind": 1,
469
+ "detail": "Unique values",
470
+ "documentation": {
471
+ "value": "Return unique elements of a vector.\n\n```r\nunique(c(1, 2, 2, 3, 3, 3)) # 1 2 3\n```"
472
+ },
473
+ "insertText": "unique(${1:x})",
474
+ "insertTextRules": 4,
475
+ "sortText": "01_unique"
476
+ },
477
+ {
478
+ "label": "duplicated",
479
+ "kind": 1,
480
+ "detail": "Determine duplicate elements",
481
+ "documentation": {
482
+ "value": "Return a logical vector indicating which elements are duplicates.\n\n```r\nduplicated(c(1, 2, 2, 3)) # FALSE FALSE TRUE FALSE\nx[!duplicated(x)] # remove duplicates\n```"
483
+ },
484
+ "insertText": "duplicated(${1:x})",
485
+ "insertTextRules": 4,
486
+ "sortText": "01_duplicated"
487
+ },
488
+ {
489
+ "label": "table",
490
+ "kind": 1,
491
+ "detail": "Contingency table",
492
+ "documentation": {
493
+ "value": "Build a frequency table of factor levels.\n\n```r\ntable(c(\"a\", \"b\", \"a\", \"c\", \"a\")) # a:3 b:1 c:1\ntable(df$gender, df$group)\n```"
494
+ },
495
+ "insertText": "table(${1:...})",
496
+ "insertTextRules": 4,
497
+ "sortText": "01_table"
498
+ },
499
+ {
500
+ "label": "sum",
501
+ "kind": 1,
502
+ "detail": "Sum of values",
503
+ "documentation": {
504
+ "value": "Compute the sum of all values.\n\n```r\nsum(1:10) # 55\nsum(x, na.rm = TRUE)\n```"
505
+ },
506
+ "insertText": "sum(${1:...})",
507
+ "insertTextRules": 4,
508
+ "sortText": "01_sum"
509
+ },
510
+ {
511
+ "label": "mean",
512
+ "kind": 1,
513
+ "detail": "Arithmetic mean",
514
+ "documentation": {
515
+ "value": "Compute the arithmetic mean.\n\n```r\nmean(1:10) # 5.5\nmean(x, na.rm = TRUE)\nmean(x, trim = 0.1)\n```"
516
+ },
517
+ "insertText": "mean(${1:x})",
518
+ "insertTextRules": 4,
519
+ "sortText": "01_mean"
520
+ },
521
+ {
522
+ "label": "median",
523
+ "kind": 1,
524
+ "detail": "Median value",
525
+ "documentation": {
526
+ "value": "Compute the median value.\n\n```r\nmedian(c(1, 3, 5, 7, 9)) # 5\nmedian(x, na.rm = TRUE)\n```"
527
+ },
528
+ "insertText": "median(${1:x})",
529
+ "insertTextRules": 4,
530
+ "sortText": "01_median"
531
+ },
532
+ {
533
+ "label": "sd",
534
+ "kind": 1,
535
+ "detail": "Standard deviation",
536
+ "documentation": {
537
+ "value": "Compute the standard deviation.\n\n```r\nsd(c(1, 2, 3, 4, 5)) # 1.581139\nsd(x, na.rm = TRUE)\n```"
538
+ },
539
+ "insertText": "sd(${1:x})",
540
+ "insertTextRules": 4,
541
+ "sortText": "01_sd"
542
+ },
543
+ {
544
+ "label": "var",
545
+ "kind": 1,
546
+ "detail": "Variance",
547
+ "documentation": {
548
+ "value": "Compute variance (or covariance matrix).\n\n```r\nvar(1:10)\nvar(x, y) # covariance\nvar(df) # covariance matrix\n```"
549
+ },
550
+ "insertText": "var(${1:x})",
551
+ "insertTextRules": 4,
552
+ "sortText": "01_var"
553
+ },
554
+ {
555
+ "label": "min",
556
+ "kind": 1,
557
+ "detail": "Minimum value",
558
+ "documentation": {
559
+ "value": "Return the minimum of all values.\n\n```r\nmin(5, 3, 8) # 3\nmin(x, na.rm = TRUE)\n```"
560
+ },
561
+ "insertText": "min(${1:...})",
562
+ "insertTextRules": 4,
563
+ "sortText": "01_min"
564
+ },
565
+ {
566
+ "label": "max",
567
+ "kind": 1,
568
+ "detail": "Maximum value",
569
+ "documentation": {
570
+ "value": "Return the maximum of all values.\n\n```r\nmax(5, 3, 8) # 8\nmax(x, na.rm = TRUE)\n```"
571
+ },
572
+ "insertText": "max(${1:...})",
573
+ "insertTextRules": 4,
574
+ "sortText": "01_max"
575
+ },
576
+ {
577
+ "label": "range",
578
+ "kind": 1,
579
+ "detail": "Range of values (min and max)",
580
+ "documentation": {
581
+ "value": "Return the minimum and maximum of a vector.\n\n```r\nrange(c(3, 1, 5)) # 1 5\n```"
582
+ },
583
+ "insertText": "range(${1:...})",
584
+ "insertTextRules": 4,
585
+ "sortText": "01_range"
586
+ },
587
+ {
588
+ "label": "abs",
589
+ "kind": 1,
590
+ "detail": "Absolute value",
591
+ "documentation": {
592
+ "value": "Compute the absolute value.\n\n```r\nabs(-5) # 5\nabs(c(-1, 2, -3)) # 1 2 3\n```"
593
+ },
594
+ "insertText": "abs(${1:x})",
595
+ "insertTextRules": 4,
596
+ "sortText": "01_abs"
597
+ },
598
+ {
599
+ "label": "sqrt",
600
+ "kind": 1,
601
+ "detail": "Square root",
602
+ "documentation": {
603
+ "value": "Compute the square root.\n\n```r\nsqrt(16) # 4\nsqrt(1:5)\n```"
604
+ },
605
+ "insertText": "sqrt(${1:x})",
606
+ "insertTextRules": 4,
607
+ "sortText": "01_sqrt"
608
+ },
609
+ {
610
+ "label": "log",
611
+ "kind": 1,
612
+ "detail": "Natural logarithm",
613
+ "documentation": {
614
+ "value": "Compute the natural logarithm (or with specified base).\n\n```r\nlog(exp(1)) # 1\nlog(100, base = 10) # 2\n```"
615
+ },
616
+ "insertText": "log(${1:x})",
617
+ "insertTextRules": 4,
618
+ "sortText": "01_log"
619
+ },
620
+ {
621
+ "label": "log2",
622
+ "kind": 1,
623
+ "detail": "Base-2 logarithm",
624
+ "documentation": {
625
+ "value": "Compute the base-2 logarithm.\n\n```r\nlog2(8) # 3\nlog2(1024) # 10\n```"
626
+ },
627
+ "insertText": "log2(${1:x})",
628
+ "insertTextRules": 4,
629
+ "sortText": "01_log2"
630
+ },
631
+ {
632
+ "label": "log10",
633
+ "kind": 1,
634
+ "detail": "Base-10 logarithm",
635
+ "documentation": {
636
+ "value": "Compute the base-10 logarithm.\n\n```r\nlog10(1000) # 3\n```"
637
+ },
638
+ "insertText": "log10(${1:x})",
639
+ "insertTextRules": 4,
640
+ "sortText": "01_log10"
641
+ },
642
+ {
643
+ "label": "exp",
644
+ "kind": 1,
645
+ "detail": "Exponential function",
646
+ "documentation": {
647
+ "value": "Compute the exponential function e^x.\n\n```r\nexp(1) # 2.718282\nexp(0) # 1\n```"
648
+ },
649
+ "insertText": "exp(${1:x})",
650
+ "insertTextRules": 4,
651
+ "sortText": "01_exp"
652
+ },
653
+ {
654
+ "label": "ceiling",
655
+ "kind": 1,
656
+ "detail": "Round up",
657
+ "documentation": {
658
+ "value": "Round up to the nearest integer.\n\n```r\nceiling(2.3) # 3\nceiling(-2.3) # -2\n```"
659
+ },
660
+ "insertText": "ceiling(${1:x})",
661
+ "insertTextRules": 4,
662
+ "sortText": "01_ceiling"
663
+ },
664
+ {
665
+ "label": "floor",
666
+ "kind": 1,
667
+ "detail": "Round down",
668
+ "documentation": {
669
+ "value": "Round down to the nearest integer.\n\n```r\nfloor(2.7) # 2\nfloor(-2.3) # -3\n```"
670
+ },
671
+ "insertText": "floor(${1:x})",
672
+ "insertTextRules": 4,
673
+ "sortText": "01_floor"
674
+ },
675
+ {
676
+ "label": "round",
677
+ "kind": 1,
678
+ "detail": "Round to n decimal places",
679
+ "documentation": {
680
+ "value": "Round a number to n digits.\n\n```r\nround(3.14159, 2) # 3.14\nround(2.5) # 2 (banker's rounding)\n```"
681
+ },
682
+ "insertText": "round(${1:x}, digits = ${2:0})",
683
+ "insertTextRules": 4,
684
+ "sortText": "01_round"
685
+ },
686
+ {
687
+ "label": "trunc",
688
+ "kind": 1,
689
+ "detail": "Truncate to integer",
690
+ "documentation": {
691
+ "value": "Truncate towards zero.\n\n```r\ntrunc(2.9) # 2\ntrunc(-2.9) # -2\n```"
692
+ },
693
+ "insertText": "trunc(${1:x})",
694
+ "insertTextRules": 4,
695
+ "sortText": "01_trunc"
696
+ },
697
+ {
698
+ "label": "sign",
699
+ "kind": 1,
700
+ "detail": "Sign of values",
701
+ "documentation": {
702
+ "value": "Return the sign: -1, 0, or 1.\n\n```r\nsign(-5) # -1\nsign(0) # 0\nsign(3) # 1\n```"
703
+ },
704
+ "insertText": "sign(${1:x})",
705
+ "insertTextRules": 4,
706
+ "sortText": "01_sign"
707
+ },
708
+ {
709
+ "label": "cumsum",
710
+ "kind": 1,
711
+ "detail": "Cumulative sum",
712
+ "documentation": {
713
+ "value": "Compute the cumulative sum.\n\n```r\ncumsum(1:5) # 1 3 6 10 15\n```"
714
+ },
715
+ "insertText": "cumsum(${1:x})",
716
+ "insertTextRules": 4,
717
+ "sortText": "01_cumsum"
718
+ },
719
+ {
720
+ "label": "cumprod",
721
+ "kind": 1,
722
+ "detail": "Cumulative product",
723
+ "documentation": {
724
+ "value": "Compute the cumulative product.\n\n```r\ncumprod(1:5) # 1 2 6 24 120\n```"
725
+ },
726
+ "insertText": "cumprod(${1:x})",
727
+ "insertTextRules": 4,
728
+ "sortText": "01_cumprod"
729
+ },
730
+ {
731
+ "label": "cummax",
732
+ "kind": 1,
733
+ "detail": "Cumulative maximum",
734
+ "documentation": {
735
+ "value": "Compute the cumulative maxima.\n\n```r\ncummax(c(3, 1, 4, 1, 5)) # 3 3 4 4 5\n```"
736
+ },
737
+ "insertText": "cummax(${1:x})",
738
+ "insertTextRules": 4,
739
+ "sortText": "01_cummax"
740
+ },
741
+ {
742
+ "label": "cummin",
743
+ "kind": 1,
744
+ "detail": "Cumulative minimum",
745
+ "documentation": {
746
+ "value": "Compute the cumulative minima.\n\n```r\ncummin(c(3, 1, 4, 1, 5)) # 3 1 1 1 1\n```"
747
+ },
748
+ "insertText": "cummin(${1:x})",
749
+ "insertTextRules": 4,
750
+ "sortText": "01_cummin"
751
+ },
752
+ {
753
+ "label": "diff",
754
+ "kind": 1,
755
+ "detail": "Lagged differences",
756
+ "documentation": {
757
+ "value": "Compute lagged differences.\n\n```r\ndiff(c(1, 3, 6, 10)) # 2 3 4\ndiff(x, lag = 2)\n```"
758
+ },
759
+ "insertText": "diff(${1:x})",
760
+ "insertTextRules": 4,
761
+ "sortText": "01_diff"
762
+ },
763
+ {
764
+ "label": "head",
765
+ "kind": 1,
766
+ "detail": "First n elements",
767
+ "documentation": {
768
+ "value": "Return the first n elements.\n\n```r\nhead(1:100) # 1 2 3 4 5 6\nhead(df, 10)\n```"
769
+ },
770
+ "insertText": "head(${1:x})",
771
+ "insertTextRules": 4,
772
+ "sortText": "01_head"
773
+ },
774
+ {
775
+ "label": "tail",
776
+ "kind": 1,
777
+ "detail": "Last n elements",
778
+ "documentation": {
779
+ "value": "Return the last n elements.\n\n```r\ntail(1:100) # 95 96 97 98 99 100\ntail(df, 5)\n```"
780
+ },
781
+ "insertText": "tail(${1:x})",
782
+ "insertTextRules": 4,
783
+ "sortText": "01_tail"
784
+ },
785
+ {
786
+ "label": "nrow",
787
+ "kind": 1,
788
+ "detail": "Number of rows",
789
+ "documentation": {
790
+ "value": "Return the number of rows of a matrix or data frame.\n\n```r\nnrow(mtcars) # 32\n```"
791
+ },
792
+ "insertText": "nrow(${1:x})",
793
+ "insertTextRules": 4,
794
+ "sortText": "01_nrow"
795
+ },
796
+ {
797
+ "label": "ncol",
798
+ "kind": 1,
799
+ "detail": "Number of columns",
800
+ "documentation": {
801
+ "value": "Return the number of columns of a matrix or data frame.\n\n```r\nncol(mtcars) # 11\n```"
802
+ },
803
+ "insertText": "ncol(${1:x})",
804
+ "insertTextRules": 4,
805
+ "sortText": "01_ncol"
806
+ },
807
+ {
808
+ "label": "dim",
809
+ "kind": 1,
810
+ "detail": "Dimensions of an object",
811
+ "documentation": {
812
+ "value": "Get or set the dimensions of an object.\n\n```r\ndim(mtcars) # 32 11\ndim(matrix(1:6, nrow = 2)) # 2 3\n```"
813
+ },
814
+ "insertText": "dim(${1:x})",
815
+ "insertTextRules": 4,
816
+ "sortText": "01_dim"
817
+ },
818
+ {
819
+ "label": "names",
820
+ "kind": 1,
821
+ "detail": "Get or set names",
822
+ "documentation": {
823
+ "value": "Get or set the names of an object.\n\n```r\nnames(x)\nnames(x) <- c(\"a\", \"b\", \"c\")\n```"
824
+ },
825
+ "insertText": "names(${1:x})",
826
+ "insertTextRules": 4,
827
+ "sortText": "01_names"
828
+ },
829
+ {
830
+ "label": "colnames",
831
+ "kind": 1,
832
+ "detail": "Column names",
833
+ "documentation": {
834
+ "value": "Get or set column names.\n\n```r\ncolnames(df)\ncolnames(df) <- c(\"x\", \"y\", \"z\")\n```"
835
+ },
836
+ "insertText": "colnames(${1:x})",
837
+ "insertTextRules": 4,
838
+ "sortText": "01_colnames"
839
+ },
840
+ {
841
+ "label": "rownames",
842
+ "kind": 1,
843
+ "detail": "Row names",
844
+ "documentation": {
845
+ "value": "Get or set row names.\n\n```r\nrownames(df)\nrownames(df) <- paste0(\"row\", 1:nrow(df))\n```"
846
+ },
847
+ "insertText": "rownames(${1:x})",
848
+ "insertTextRules": 4,
849
+ "sortText": "01_rownames"
850
+ },
851
+ {
852
+ "label": "str",
853
+ "kind": 1,
854
+ "detail": "Display structure of an object",
855
+ "documentation": {
856
+ "value": "Compactly display the internal structure.\n\n```r\nstr(mtcars)\nstr(my_list)\n```"
857
+ },
858
+ "insertText": "str(${1:object})",
859
+ "insertTextRules": 4,
860
+ "sortText": "01_str"
861
+ },
862
+ {
863
+ "label": "summary",
864
+ "kind": 1,
865
+ "detail": "Summary of an object",
866
+ "documentation": {
867
+ "value": "Produce result summaries (dispatched by class).\n\n```r\nsummary(mtcars)\nsummary(lm_fit)\nsummary(factor_var)\n```"
868
+ },
869
+ "insertText": "summary(${1:object})",
870
+ "insertTextRules": 4,
871
+ "sortText": "01_summary"
872
+ },
873
+ {
874
+ "label": "class",
875
+ "kind": 1,
876
+ "detail": "Object class",
877
+ "documentation": {
878
+ "value": "Get or set the class attribute.\n\n```r\nclass(mtcars) # \"data.frame\"\nclass(1:5) # \"integer\"\n```"
879
+ },
880
+ "insertText": "class(${1:x})",
881
+ "insertTextRules": 4,
882
+ "sortText": "01_class"
883
+ },
884
+ {
885
+ "label": "typeof",
886
+ "kind": 1,
887
+ "detail": "Internal type of an object",
888
+ "documentation": {
889
+ "value": "Return the internal storage type.\n\n```r\ntypeof(1L) # \"integer\"\ntypeof(1.0) # \"double\"\ntypeof(\"a\") # \"character\"\n```"
890
+ },
891
+ "insertText": "typeof(${1:x})",
892
+ "insertTextRules": 4,
893
+ "sortText": "01_typeof"
894
+ },
895
+ {
896
+ "label": "is.numeric",
897
+ "kind": 1,
898
+ "detail": "Test if numeric",
899
+ "documentation": {
900
+ "value": "Test whether an object is numeric (integer or double).\n\n```r\nis.numeric(1.5) # TRUE\nis.numeric(\"a\") # FALSE\n```"
901
+ },
902
+ "insertText": "is.numeric(${1:x})",
903
+ "insertTextRules": 4,
904
+ "sortText": "01_is.numeric"
905
+ },
906
+ {
907
+ "label": "is.character",
908
+ "kind": 1,
909
+ "detail": "Test if character",
910
+ "documentation": {
911
+ "value": "Test whether an object is of type character.\n\n```r\nis.character(\"hello\") # TRUE\nis.character(42) # FALSE\n```"
912
+ },
913
+ "insertText": "is.character(${1:x})",
914
+ "insertTextRules": 4,
915
+ "sortText": "01_is.character"
916
+ },
917
+ {
918
+ "label": "is.logical",
919
+ "kind": 1,
920
+ "detail": "Test if logical",
921
+ "documentation": {
922
+ "value": "Test whether an object is of type logical.\n\n```r\nis.logical(TRUE) # TRUE\nis.logical(1) # FALSE\n```"
923
+ },
924
+ "insertText": "is.logical(${1:x})",
925
+ "insertTextRules": 4,
926
+ "sortText": "01_is.logical"
927
+ },
928
+ {
929
+ "label": "is.na",
930
+ "kind": 1,
931
+ "detail": "Test for NA values",
932
+ "documentation": {
933
+ "value": "Test each element for NA.\n\n```r\nis.na(c(1, NA, 3)) # FALSE TRUE FALSE\nsum(is.na(x)) # count NAs\n```"
934
+ },
935
+ "insertText": "is.na(${1:x})",
936
+ "insertTextRules": 4,
937
+ "sortText": "01_is.na"
938
+ },
939
+ {
940
+ "label": "is.null",
941
+ "kind": 1,
942
+ "detail": "Test for NULL",
943
+ "documentation": {
944
+ "value": "Test if an object is NULL.\n\n```r\nis.null(NULL) # TRUE\nis.null(NA) # FALSE\n```"
945
+ },
946
+ "insertText": "is.null(${1:x})",
947
+ "insertTextRules": 4,
948
+ "sortText": "01_is.null"
949
+ },
950
+ {
951
+ "label": "as.numeric",
952
+ "kind": 1,
953
+ "detail": "Coerce to numeric",
954
+ "documentation": {
955
+ "value": "Coerce an object to numeric (double).\n\n```r\nas.numeric(\"3.14\") # 3.14\nas.numeric(TRUE) # 1\n```"
956
+ },
957
+ "insertText": "as.numeric(${1:x})",
958
+ "insertTextRules": 4,
959
+ "sortText": "01_as.numeric"
960
+ },
961
+ {
962
+ "label": "as.character",
963
+ "kind": 1,
964
+ "detail": "Coerce to character",
965
+ "documentation": {
966
+ "value": "Coerce an object to character string.\n\n```r\nas.character(42) # \"42\"\nas.character(TRUE) # \"TRUE\"\n```"
967
+ },
968
+ "insertText": "as.character(${1:x})",
969
+ "insertTextRules": 4,
970
+ "sortText": "01_as.character"
971
+ },
972
+ {
973
+ "label": "as.logical",
974
+ "kind": 1,
975
+ "detail": "Coerce to logical",
976
+ "documentation": {
977
+ "value": "Coerce to logical.\n\n```r\nas.logical(0) # FALSE\nas.logical(1) # TRUE\nas.logical(\"TRUE\") # TRUE\n```"
978
+ },
979
+ "insertText": "as.logical(${1:x})",
980
+ "insertTextRules": 4,
981
+ "sortText": "01_as.logical"
982
+ },
983
+ {
984
+ "label": "as.integer",
985
+ "kind": 1,
986
+ "detail": "Coerce to integer",
987
+ "documentation": {
988
+ "value": "Coerce to integer.\n\n```r\nas.integer(3.7) # 3\nas.integer(\"42\") # 42\n```"
989
+ },
990
+ "insertText": "as.integer(${1:x})",
991
+ "insertTextRules": 4,
992
+ "sortText": "01_as.integer"
993
+ },
994
+ {
995
+ "label": "as.double",
996
+ "kind": 1,
997
+ "detail": "Coerce to double",
998
+ "documentation": {
999
+ "value": "Coerce to double-precision floating point.\n\n```r\nas.double(1L) # 1\nas.double(\"3.14\") # 3.14\n```"
1000
+ },
1001
+ "insertText": "as.double(${1:x})",
1002
+ "insertTextRules": 4,
1003
+ "sortText": "01_as.double"
1004
+ },
1005
+ {
1006
+ "label": "as.data.frame",
1007
+ "kind": 1,
1008
+ "detail": "Coerce to data frame",
1009
+ "documentation": {
1010
+ "value": "Coerce to a data.frame.\n\n```r\nas.data.frame(matrix(1:6, nrow = 2))\nas.data.frame(my_list)\n```"
1011
+ },
1012
+ "insertText": "as.data.frame(${1:x})",
1013
+ "insertTextRules": 4,
1014
+ "sortText": "01_as.data.frame"
1015
+ },
1016
+ {
1017
+ "label": "data.frame",
1018
+ "kind": 1,
1019
+ "detail": "Create a data frame",
1020
+ "documentation": {
1021
+ "value": "Create a data frame from column vectors.\n\n```r\ndf <- data.frame(\n name = c(\"Alice\", \"Bob\"),\n age = c(25, 30),\n stringsAsFactors = FALSE\n)\n```"
1022
+ },
1023
+ "insertText": "data.frame(${1:...})",
1024
+ "insertTextRules": 4,
1025
+ "sortText": "01_data.frame"
1026
+ },
1027
+ {
1028
+ "label": "matrix",
1029
+ "kind": 1,
1030
+ "detail": "Create a matrix",
1031
+ "documentation": {
1032
+ "value": "Create a matrix from the given values.\n\n```r\nmatrix(1:6, nrow = 2, ncol = 3)\nmatrix(0, nrow = 3, ncol = 3)\n```"
1033
+ },
1034
+ "insertText": "matrix(${1:data}, nrow = ${2:nrow})",
1035
+ "insertTextRules": 4,
1036
+ "sortText": "01_matrix"
1037
+ },
1038
+ {
1039
+ "label": "array",
1040
+ "kind": 1,
1041
+ "detail": "Create a multi-dimensional array",
1042
+ "documentation": {
1043
+ "value": "Create a multi-dimensional array.\n\n```r\narray(1:24, dim = c(2, 3, 4))\n```"
1044
+ },
1045
+ "insertText": "array(${1:data}, dim = c(${2:dims}))",
1046
+ "insertTextRules": 4,
1047
+ "sortText": "01_array"
1048
+ },
1049
+ {
1050
+ "label": "list",
1051
+ "kind": 1,
1052
+ "detail": "Create a list",
1053
+ "documentation": {
1054
+ "value": "Create a list (generic container).\n\n```r\nx <- list(a = 1, b = \"text\", c = TRUE)\nx[[1]]\nx$a\n```"
1055
+ },
1056
+ "insertText": "list(${1:...})",
1057
+ "insertTextRules": 4,
1058
+ "sortText": "01_list"
1059
+ },
1060
+ {
1061
+ "label": "vector",
1062
+ "kind": 1,
1063
+ "detail": "Create a vector",
1064
+ "documentation": {
1065
+ "value": "Create a vector of given mode and length.\n\n```r\nvector(\"numeric\", 5) # 0 0 0 0 0\nvector(\"character\", 3) # \"\" \"\" \"\"\n```"
1066
+ },
1067
+ "insertText": "vector(\"${1:mode}\", ${2:length})",
1068
+ "insertTextRules": 4,
1069
+ "sortText": "01_vector"
1070
+ },
1071
+ {
1072
+ "label": "factor",
1073
+ "kind": 1,
1074
+ "detail": "Create a factor",
1075
+ "documentation": {
1076
+ "value": "Encode a vector as a factor (categorical variable).\n\n```r\nfactor(c(\"low\", \"med\", \"high\"), levels = c(\"low\", \"med\", \"high\"), ordered = TRUE)\n```"
1077
+ },
1078
+ "insertText": "factor(${1:x})",
1079
+ "insertTextRules": 4,
1080
+ "sortText": "01_factor"
1081
+ },
1082
+ {
1083
+ "label": "read.csv",
1084
+ "kind": 1,
1085
+ "detail": "Read CSV file",
1086
+ "documentation": {
1087
+ "value": "Read a CSV file into a data frame.\n\n```r\ndf <- read.csv(\"data.csv\")\ndf <- read.csv(\"data.csv\", stringsAsFactors = FALSE, na.strings = c(\"\", \"NA\"))\n```"
1088
+ },
1089
+ "insertText": "read.csv(\"${1:file.csv}\")",
1090
+ "insertTextRules": 4,
1091
+ "sortText": "01_read.csv"
1092
+ },
1093
+ {
1094
+ "label": "read.table",
1095
+ "kind": 1,
1096
+ "detail": "Read tabular data",
1097
+ "documentation": {
1098
+ "value": "Read a table formatted file into a data frame.\n\n```r\ndf <- read.table(\"data.txt\", header = TRUE, sep = \"\\t\")\n```"
1099
+ },
1100
+ "insertText": "read.table(\"${1:file}\", header = ${2:TRUE}, sep = \"${3:\\t}\")",
1101
+ "insertTextRules": 4,
1102
+ "sortText": "01_read.table"
1103
+ },
1104
+ {
1105
+ "label": "write.csv",
1106
+ "kind": 1,
1107
+ "detail": "Write CSV file",
1108
+ "documentation": {
1109
+ "value": "Write a data frame to a CSV file.\n\n```r\nwrite.csv(df, \"output.csv\", row.names = FALSE)\n```"
1110
+ },
1111
+ "insertText": "write.csv(${1:x}, \"${2:file.csv}\", row.names = FALSE)",
1112
+ "insertTextRules": 4,
1113
+ "sortText": "01_write.csv"
1114
+ },
1115
+ {
1116
+ "label": "write.table",
1117
+ "kind": 1,
1118
+ "detail": "Write tabular data",
1119
+ "documentation": {
1120
+ "value": "Write a data frame to a file.\n\n```r\nwrite.table(df, \"output.txt\", sep = \"\\t\", row.names = FALSE)\n```"
1121
+ },
1122
+ "insertText": "write.table(${1:x}, \"${2:file}\", sep = \"${3:\\t}\")",
1123
+ "insertTextRules": 4,
1124
+ "sortText": "01_write.table"
1125
+ },
1126
+ {
1127
+ "label": "readRDS",
1128
+ "kind": 1,
1129
+ "detail": "Read RDS file",
1130
+ "documentation": {
1131
+ "value": "Read a single R object from file.\n\n```r\nobj <- readRDS(\"data.rds\")\n```"
1132
+ },
1133
+ "insertText": "readRDS(\"${1:file.rds}\")",
1134
+ "insertTextRules": 4,
1135
+ "sortText": "01_readRDS"
1136
+ },
1137
+ {
1138
+ "label": "saveRDS",
1139
+ "kind": 1,
1140
+ "detail": "Save RDS file",
1141
+ "documentation": {
1142
+ "value": "Serialize an R object to file.\n\n```r\nsaveRDS(obj, \"data.rds\")\n```"
1143
+ },
1144
+ "insertText": "saveRDS(${1:object}, \"${2:file.rds}\")",
1145
+ "insertTextRules": 4,
1146
+ "sortText": "01_saveRDS"
1147
+ },
1148
+ {
1149
+ "label": "file.path",
1150
+ "kind": 1,
1151
+ "detail": "Construct file paths",
1152
+ "documentation": {
1153
+ "value": "Construct platform-independent file paths.\n\n```r\nfile.path(\"data\", \"input\", \"file.csv\")\n```"
1154
+ },
1155
+ "insertText": "file.path(${1:...})",
1156
+ "insertTextRules": 4,
1157
+ "sortText": "01_file.path"
1158
+ },
1159
+ {
1160
+ "label": "file.exists",
1161
+ "kind": 1,
1162
+ "detail": "Check if file exists",
1163
+ "documentation": {
1164
+ "value": "Test whether files exist.\n\n```r\nfile.exists(\"data.csv\") # TRUE/FALSE\n```"
1165
+ },
1166
+ "insertText": "file.exists(\"${1:path}\")",
1167
+ "insertTextRules": 4,
1168
+ "sortText": "01_file.exists"
1169
+ },
1170
+ {
1171
+ "label": "dir.create",
1172
+ "kind": 1,
1173
+ "detail": "Create a directory",
1174
+ "documentation": {
1175
+ "value": "Create a directory.\n\n```r\ndir.create(\"output\", recursive = TRUE, showWarnings = FALSE)\n```"
1176
+ },
1177
+ "insertText": "dir.create(\"${1:path}\", recursive = TRUE)",
1178
+ "insertTextRules": 4,
1179
+ "sortText": "01_dir.create"
1180
+ },
1181
+ {
1182
+ "label": "getwd",
1183
+ "kind": 1,
1184
+ "detail": "Get working directory",
1185
+ "documentation": {
1186
+ "value": "Return the current working directory.\n\n```r\ngetwd() # \"/home/user/project\"\n```"
1187
+ },
1188
+ "insertText": "getwd()",
1189
+ "sortText": "01_getwd",
1190
+ "insertTextRules": 0
1191
+ },
1192
+ {
1193
+ "label": "setwd",
1194
+ "kind": 1,
1195
+ "detail": "Set working directory",
1196
+ "documentation": {
1197
+ "value": "Change the working directory.\n\n```r\nsetwd(\"/path/to/project\")\n```"
1198
+ },
1199
+ "insertText": "setwd(\"${1:dir}\")",
1200
+ "insertTextRules": 4,
1201
+ "sortText": "01_setwd"
1202
+ },
1203
+ {
1204
+ "label": "Sys.time",
1205
+ "kind": 1,
1206
+ "detail": "Current date/time",
1207
+ "documentation": {
1208
+ "value": "Return the current date and time.\n\n```r\nSys.time() # \"2024-01-15 14:30:00 UTC\"\n```"
1209
+ },
1210
+ "insertText": "Sys.time()",
1211
+ "sortText": "01_Sys.time",
1212
+ "insertTextRules": 0
1213
+ },
1214
+ {
1215
+ "label": "Sys.sleep",
1216
+ "kind": 1,
1217
+ "detail": "Pause execution",
1218
+ "documentation": {
1219
+ "value": "Suspend execution for a given number of seconds.\n\n```r\nSys.sleep(2) # pause 2 seconds\n```"
1220
+ },
1221
+ "insertText": "Sys.sleep(${1:seconds})",
1222
+ "insertTextRules": 4,
1223
+ "sortText": "01_Sys.sleep"
1224
+ },
1225
+ {
1226
+ "label": "system",
1227
+ "kind": 1,
1228
+ "detail": "Run system command",
1229
+ "documentation": {
1230
+ "value": "Invoke an OS command.\n\n```r\nsystem(\"ls -la\")\noutput <- system(\"whoami\", intern = TRUE)\n```"
1231
+ },
1232
+ "insertText": "system(\"${1:command}\", intern = ${2:TRUE})",
1233
+ "insertTextRules": 4,
1234
+ "sortText": "01_system"
1235
+ },
1236
+ {
1237
+ "label": "system2",
1238
+ "kind": 1,
1239
+ "detail": "Run system command (modern)",
1240
+ "documentation": {
1241
+ "value": "Invoke an OS command (safer interface).\n\n```r\nsystem2(\"git\", c(\"status\", \"--short\"), stdout = TRUE)\n```"
1242
+ },
1243
+ "insertText": "system2(\"${1:command}\", args = c(${2:}))",
1244
+ "insertTextRules": 4,
1245
+ "sortText": "01_system2"
1246
+ },
1247
+ {
1248
+ "label": "tryCatch",
1249
+ "kind": 1,
1250
+ "detail": "Error handling",
1251
+ "documentation": {
1252
+ "value": "Handle errors and conditions.\n\n```r\nresult <- tryCatch({\n log(-1)\n}, warning = function(w) {\n message(\"Warning: \", w$message)\n}, error = function(e) {\n message(\"Error: \", e$message)\n NA\n}, finally = {\n cat(\"Done\\n\")\n})\n```"
1253
+ },
1254
+ "insertText": "tryCatch({\n ${1}\n}, error = function(e) {\n ${2:message(e$message)}\n})",
1255
+ "insertTextRules": 4,
1256
+ "sortText": "01_tryCatch"
1257
+ },
1258
+ {
1259
+ "label": "withCallingHandlers",
1260
+ "kind": 1,
1261
+ "detail": "Condition handler (non-exiting)",
1262
+ "documentation": {
1263
+ "value": "Establish calling handlers for conditions.\n\n```r\nwithCallingHandlers(\n expr,\n warning = function(w) invokeRestart(\"muffleWarning\")\n)\n```"
1264
+ },
1265
+ "insertText": "withCallingHandlers({\n ${1}\n}, warning = function(w) {\n ${2}\n})",
1266
+ "insertTextRules": 4,
1267
+ "sortText": "01_withCallingHandlers"
1268
+ },
1269
+ {
1270
+ "label": "stop",
1271
+ "kind": 1,
1272
+ "detail": "Signal an error",
1273
+ "documentation": {
1274
+ "value": "Stop execution and signal an error condition.\n\n```r\nstop(\"invalid argument\")\nstop(\"x must be > 0, got: \", x)\n```"
1275
+ },
1276
+ "insertText": "stop(\"${1:message}\")",
1277
+ "insertTextRules": 4,
1278
+ "sortText": "01_stop"
1279
+ },
1280
+ {
1281
+ "label": "warning",
1282
+ "kind": 1,
1283
+ "detail": "Signal a warning",
1284
+ "documentation": {
1285
+ "value": "Generate a warning message.\n\n```r\nwarning(\"deprecated function\")\nwarning(\"NAs introduced by coercion\", call. = FALSE)\n```"
1286
+ },
1287
+ "insertText": "warning(\"${1:message}\")",
1288
+ "insertTextRules": 4,
1289
+ "sortText": "01_warning"
1290
+ },
1291
+ {
1292
+ "label": "message",
1293
+ "kind": 1,
1294
+ "detail": "Diagnostic message",
1295
+ "documentation": {
1296
+ "value": "Generate a diagnostic message (to stderr).\n\n```r\nmessage(\"Processing file: \", filename)\nmessage(\"Step \", i, \" of \", n)\n```"
1297
+ },
1298
+ "insertText": "message(\"${1:...}\")",
1299
+ "insertTextRules": 4,
1300
+ "sortText": "01_message"
1301
+ },
1302
+ {
1303
+ "label": "format",
1304
+ "kind": 1,
1305
+ "detail": "Format values",
1306
+ "documentation": {
1307
+ "value": "Format an R object for pretty printing.\n\n```r\nformat(3.14159, digits = 3) # \"3.14\"\nformat(Sys.Date(), \"%Y-%m-%d\")\n```"
1308
+ },
1309
+ "insertText": "format(${1:x})",
1310
+ "insertTextRules": 4,
1311
+ "sortText": "01_format"
1312
+ },
1313
+ {
1314
+ "label": "substr",
1315
+ "kind": 1,
1316
+ "detail": "Extract/replace substring",
1317
+ "documentation": {
1318
+ "value": "Extract or replace substrings.\n\n```r\nsubstr(\"Hello\", 1, 3) # \"Hel\"\n```"
1319
+ },
1320
+ "insertText": "substr(${1:x}, ${2:start}, ${3:stop})",
1321
+ "insertTextRules": 4,
1322
+ "sortText": "01_substr"
1323
+ },
1324
+ {
1325
+ "label": "substring",
1326
+ "kind": 1,
1327
+ "detail": "Extract substring (vectorized)",
1328
+ "documentation": {
1329
+ "value": "Extract substrings (compatible with replacement).\n\n```r\nsubstring(\"Hello world\", 7) # \"world\"\n```"
1330
+ },
1331
+ "insertText": "substring(${1:text}, ${2:first})",
1332
+ "insertTextRules": 4,
1333
+ "sortText": "01_substring"
1334
+ },
1335
+ {
1336
+ "label": "gsub",
1337
+ "kind": 1,
1338
+ "detail": "Global pattern replacement",
1339
+ "documentation": {
1340
+ "value": "Replace all occurrences of a pattern.\n\n```r\ngsub(\"o\", \"0\", \"foo bar boo\") # \"f00 bar b00\"\ngsub(\"[[:space:]]+\", \"_\", text)\n```"
1341
+ },
1342
+ "insertText": "gsub(\"${1:pattern}\", \"${2:replacement}\", ${3:x})",
1343
+ "insertTextRules": 4,
1344
+ "sortText": "01_gsub"
1345
+ },
1346
+ {
1347
+ "label": "sub",
1348
+ "kind": 1,
1349
+ "detail": "First pattern replacement",
1350
+ "documentation": {
1351
+ "value": "Replace the first occurrence of a pattern.\n\n```r\nsub(\"o\", \"0\", \"foo\") # \"f0o\"\n```"
1352
+ },
1353
+ "insertText": "sub(\"${1:pattern}\", \"${2:replacement}\", ${3:x})",
1354
+ "insertTextRules": 4,
1355
+ "sortText": "01_sub"
1356
+ },
1357
+ {
1358
+ "label": "grep",
1359
+ "kind": 1,
1360
+ "detail": "Pattern matching (indices)",
1361
+ "documentation": {
1362
+ "value": "Search for pattern matches and return indices.\n\n```r\ngrep(\"^a\", c(\"apple\", \"banana\", \"avocado\")) # 1 3\ngrep(\"error\", log_lines, value = TRUE)\n```"
1363
+ },
1364
+ "insertText": "grep(\"${1:pattern}\", ${2:x})",
1365
+ "insertTextRules": 4,
1366
+ "sortText": "01_grep"
1367
+ },
1368
+ {
1369
+ "label": "grepl",
1370
+ "kind": 1,
1371
+ "detail": "Pattern matching (logical)",
1372
+ "documentation": {
1373
+ "value": "Test for pattern matches, return logical vector.\n\n```r\ngrepl(\"^a\", c(\"apple\", \"banana\")) # TRUE FALSE\n```"
1374
+ },
1375
+ "insertText": "grepl(\"${1:pattern}\", ${2:x})",
1376
+ "insertTextRules": 4,
1377
+ "sortText": "01_grepl"
1378
+ },
1379
+ {
1380
+ "label": "regexpr",
1381
+ "kind": 1,
1382
+ "detail": "First regex match position",
1383
+ "documentation": {
1384
+ "value": "Find the first match of a pattern.\n\n```r\nm <- regexpr(\"[0-9]+\", \"abc123def\")\nregmatches(\"abc123def\", m) # \"123\"\n```"
1385
+ },
1386
+ "insertText": "regexpr(\"${1:pattern}\", ${2:text})",
1387
+ "insertTextRules": 4,
1388
+ "sortText": "01_regexpr"
1389
+ },
1390
+ {
1391
+ "label": "gregexpr",
1392
+ "kind": 1,
1393
+ "detail": "All regex match positions",
1394
+ "documentation": {
1395
+ "value": "Find all matches of a pattern.\n\n```r\nm <- gregexpr(\"[0-9]+\", \"a1b2c3\")\nregmatches(\"a1b2c3\", m) # list(c(\"1\", \"2\", \"3\"))\n```"
1396
+ },
1397
+ "insertText": "gregexpr(\"${1:pattern}\", ${2:text})",
1398
+ "insertTextRules": 4,
1399
+ "sortText": "01_gregexpr"
1400
+ },
1401
+ {
1402
+ "label": "strsplit",
1403
+ "kind": 1,
1404
+ "detail": "Split strings",
1405
+ "documentation": {
1406
+ "value": "Split character strings by a pattern.\n\n```r\nstrsplit(\"a,b,c\", \",\") # list(c(\"a\", \"b\", \"c\"))\nstrsplit(\"hello\", \"\") # list(c(\"h\",\"e\",\"l\",\"l\",\"o\"))\n```"
1407
+ },
1408
+ "insertText": "strsplit(${1:x}, \"${2:split}\")",
1409
+ "insertTextRules": 4,
1410
+ "sortText": "01_strsplit"
1411
+ },
1412
+ {
1413
+ "label": "trimws",
1414
+ "kind": 1,
1415
+ "detail": "Trim whitespace",
1416
+ "documentation": {
1417
+ "value": "Remove leading and/or trailing whitespace.\n\n```r\ntrimws(\" hello \") # \"hello\"\ntrimws(\" hello \", \"left\") # \"hello \"\n```"
1418
+ },
1419
+ "insertText": "trimws(${1:x})",
1420
+ "insertTextRules": 4,
1421
+ "sortText": "01_trimws"
1422
+ },
1423
+ {
1424
+ "label": "toupper",
1425
+ "kind": 1,
1426
+ "detail": "Convert to uppercase",
1427
+ "documentation": {
1428
+ "value": "Convert strings to uppercase.\n\n```r\ntoupper(\"hello\") # \"HELLO\"\n```"
1429
+ },
1430
+ "insertText": "toupper(${1:x})",
1431
+ "insertTextRules": 4,
1432
+ "sortText": "01_toupper"
1433
+ },
1434
+ {
1435
+ "label": "tolower",
1436
+ "kind": 1,
1437
+ "detail": "Convert to lowercase",
1438
+ "documentation": {
1439
+ "value": "Convert strings to lowercase.\n\n```r\ntolower(\"HELLO\") # \"hello\"\n```"
1440
+ },
1441
+ "insertText": "tolower(${1:x})",
1442
+ "insertTextRules": 4,
1443
+ "sortText": "01_tolower"
1444
+ },
1445
+ {
1446
+ "label": "startsWith",
1447
+ "kind": 1,
1448
+ "detail": "Test if string starts with prefix",
1449
+ "documentation": {
1450
+ "value": "Test if strings start with a prefix.\n\n```r\nstartsWith(\"Hello\", \"He\") # TRUE\n```"
1451
+ },
1452
+ "insertText": "startsWith(${1:x}, \"${2:prefix}\")",
1453
+ "insertTextRules": 4,
1454
+ "sortText": "01_startsWith"
1455
+ },
1456
+ {
1457
+ "label": "endsWith",
1458
+ "kind": 1,
1459
+ "detail": "Test if string ends with suffix",
1460
+ "documentation": {
1461
+ "value": "Test if strings end with a suffix.\n\n```r\nendsWith(\"file.csv\", \".csv\") # TRUE\n```"
1462
+ },
1463
+ "insertText": "endsWith(${1:x}, \"${2:suffix}\")",
1464
+ "insertTextRules": 4,
1465
+ "sortText": "01_endsWith"
1466
+ },
1467
+ {
1468
+ "label": "apply",
1469
+ "kind": 1,
1470
+ "detail": "Apply function over margins",
1471
+ "documentation": {
1472
+ "value": "Apply a function over rows or columns of a matrix.\n\n```r\napply(mat, 1, sum) # row sums\napply(mat, 2, mean) # column means\n```"
1473
+ },
1474
+ "insertText": "apply(${1:X}, ${2:MARGIN}, ${3:FUN})",
1475
+ "insertTextRules": 4,
1476
+ "sortText": "01_apply"
1477
+ },
1478
+ {
1479
+ "label": "sapply",
1480
+ "kind": 1,
1481
+ "detail": "Apply and simplify",
1482
+ "documentation": {
1483
+ "value": "Apply a function and simplify the result.\n\n```r\nsapply(1:5, function(x) x^2) # 1 4 9 16 25\nsapply(df, class)\n```"
1484
+ },
1485
+ "insertText": "sapply(${1:X}, ${2:FUN})",
1486
+ "insertTextRules": 4,
1487
+ "sortText": "01_sapply"
1488
+ },
1489
+ {
1490
+ "label": "lapply",
1491
+ "kind": 1,
1492
+ "detail": "Apply and return list",
1493
+ "documentation": {
1494
+ "value": "Apply a function over a list and return a list.\n\n```r\nlapply(1:3, function(x) x^2) # list(1, 4, 9)\nlapply(files, read.csv)\n```"
1495
+ },
1496
+ "insertText": "lapply(${1:X}, ${2:FUN})",
1497
+ "insertTextRules": 4,
1498
+ "sortText": "01_lapply"
1499
+ },
1500
+ {
1501
+ "label": "vapply",
1502
+ "kind": 1,
1503
+ "detail": "Apply with type-safe return",
1504
+ "documentation": {
1505
+ "value": "Apply with specified return type (safer than sapply).\n\n```r\nvapply(1:5, sqrt, numeric(1))\n```"
1506
+ },
1507
+ "insertText": "vapply(${1:X}, ${2:FUN}, ${3:FUN.VALUE})",
1508
+ "insertTextRules": 4,
1509
+ "sortText": "01_vapply"
1510
+ },
1511
+ {
1512
+ "label": "tapply",
1513
+ "kind": 1,
1514
+ "detail": "Apply by groups",
1515
+ "documentation": {
1516
+ "value": "Apply a function to groups defined by an index.\n\n```r\ntapply(mtcars$mpg, mtcars$cyl, mean)\n```"
1517
+ },
1518
+ "insertText": "tapply(${1:X}, ${2:INDEX}, ${3:FUN})",
1519
+ "insertTextRules": 4,
1520
+ "sortText": "01_tapply"
1521
+ },
1522
+ {
1523
+ "label": "mapply",
1524
+ "kind": 1,
1525
+ "detail": "Multivariate apply",
1526
+ "documentation": {
1527
+ "value": "Apply a function to multiple lists/vectors element-wise.\n\n```r\nmapply(rep, 1:4, 4:1) # rep(1,4), rep(2,3), etc.\n```"
1528
+ },
1529
+ "insertText": "mapply(${1:FUN}, ${2:...})",
1530
+ "insertTextRules": 4,
1531
+ "sortText": "01_mapply"
1532
+ },
1533
+ {
1534
+ "label": "Map",
1535
+ "kind": 1,
1536
+ "detail": "Wrapper for mapply (no simplify)",
1537
+ "documentation": {
1538
+ "value": "Apply a function to corresponding elements (returns list).\n\n```r\nMap(`+`, 1:3, 4:6) # list(5, 7, 9)\n```"
1539
+ },
1540
+ "insertText": "Map(${1:f}, ${2:...})",
1541
+ "insertTextRules": 4,
1542
+ "sortText": "01_Map"
1543
+ },
1544
+ {
1545
+ "label": "Reduce",
1546
+ "kind": 1,
1547
+ "detail": "Reduce a list to a single value",
1548
+ "documentation": {
1549
+ "value": "Apply a binary function cumulatively.\n\n```r\nReduce(`+`, 1:5) # 15\nReduce(merge, list_of_dfs)\n```"
1550
+ },
1551
+ "insertText": "Reduce(${1:f}, ${2:x})",
1552
+ "insertTextRules": 4,
1553
+ "sortText": "01_Reduce"
1554
+ },
1555
+ {
1556
+ "label": "Filter",
1557
+ "kind": 1,
1558
+ "detail": "Filter elements by predicate",
1559
+ "documentation": {
1560
+ "value": "Select elements for which a function returns TRUE.\n\n```r\nFilter(is.numeric, my_list)\nFilter(function(x) x > 0, vec)\n```"
1561
+ },
1562
+ "insertText": "Filter(${1:f}, ${2:x})",
1563
+ "insertTextRules": 4,
1564
+ "sortText": "01_Filter"
1565
+ },
1566
+ {
1567
+ "label": "do.call",
1568
+ "kind": 1,
1569
+ "detail": "Call a function with args list",
1570
+ "documentation": {
1571
+ "value": "Execute a function call with arguments from a list.\n\n```r\ndo.call(rbind, list_of_dfs)\ndo.call(paste, c(words, sep = \"-\"))\n```"
1572
+ },
1573
+ "insertText": "do.call(${1:what}, ${2:args})",
1574
+ "insertTextRules": 4,
1575
+ "sortText": "01_do.call"
1576
+ },
1577
+ {
1578
+ "label": "Vectorize",
1579
+ "kind": 1,
1580
+ "detail": "Vectorize a scalar function",
1581
+ "documentation": {
1582
+ "value": "Create a vectorized version of a function.\n\n```r\nvfunc <- Vectorize(my_scalar_func)\nvfunc(1:5)\n```"
1583
+ },
1584
+ "insertText": "Vectorize(${1:FUN})",
1585
+ "insertTextRules": 4,
1586
+ "sortText": "01_Vectorize"
1587
+ },
1588
+ {
1589
+ "label": "ifelse",
1590
+ "kind": 1,
1591
+ "detail": "Vectorized conditional",
1592
+ "documentation": {
1593
+ "value": "Vectorized conditional: returns values depending on test.\n\n```r\nifelse(x > 0, \"pos\", \"non-pos\")\nifelse(is.na(x), 0, x)\n```"
1594
+ },
1595
+ "insertText": "ifelse(${1:test}, ${2:yes}, ${3:no})",
1596
+ "insertTextRules": 4,
1597
+ "sortText": "01_ifelse"
1598
+ },
1599
+ {
1600
+ "label": "plot",
1601
+ "kind": 1,
1602
+ "detail": "Generic X-Y plotting",
1603
+ "documentation": {
1604
+ "value": "Generic function for plotting R objects.\n\n```r\nplot(x, y)\nplot(1:10, main = \"Title\", xlab = \"X\", ylab = \"Y\", type = \"l\")\n```"
1605
+ },
1606
+ "insertText": "plot(${1:x}, ${2:y})",
1607
+ "insertTextRules": 4,
1608
+ "sortText": "02_plot"
1609
+ },
1610
+ {
1611
+ "label": "hist",
1612
+ "kind": 1,
1613
+ "detail": "Histogram",
1614
+ "documentation": {
1615
+ "value": "Draw a histogram.\n\n```r\nhist(rnorm(1000))\nhist(x, breaks = 30, col = \"steelblue\", main = \"Distribution\")\n```"
1616
+ },
1617
+ "insertText": "hist(${1:x})",
1618
+ "insertTextRules": 4,
1619
+ "sortText": "02_hist"
1620
+ },
1621
+ {
1622
+ "label": "barplot",
1623
+ "kind": 1,
1624
+ "detail": "Bar plot",
1625
+ "documentation": {
1626
+ "value": "Draw a bar plot.\n\n```r\nbarplot(table(x), col = \"steelblue\")\nbarplot(height, names.arg = labels)\n```"
1627
+ },
1628
+ "insertText": "barplot(${1:height})",
1629
+ "insertTextRules": 4,
1630
+ "sortText": "02_barplot"
1631
+ },
1632
+ {
1633
+ "label": "boxplot",
1634
+ "kind": 1,
1635
+ "detail": "Box-and-whisker plot",
1636
+ "documentation": {
1637
+ "value": "Produce box-and-whisker plots.\n\n```r\nboxplot(mpg ~ cyl, data = mtcars)\n```"
1638
+ },
1639
+ "insertText": "boxplot(${1:formula}, data = ${2:df})",
1640
+ "insertTextRules": 4,
1641
+ "sortText": "02_boxplot"
1642
+ },
1643
+ {
1644
+ "label": "lines",
1645
+ "kind": 1,
1646
+ "detail": "Add lines to a plot",
1647
+ "documentation": {
1648
+ "value": "Add connected line segments to an existing plot.\n\n```r\nlines(x, y, col = \"red\", lty = 2)\n```"
1649
+ },
1650
+ "insertText": "lines(${1:x}, ${2:y})",
1651
+ "insertTextRules": 4,
1652
+ "sortText": "02_lines"
1653
+ },
1654
+ {
1655
+ "label": "points",
1656
+ "kind": 1,
1657
+ "detail": "Add points to a plot",
1658
+ "documentation": {
1659
+ "value": "Add points to an existing plot.\n\n```r\npoints(x, y, col = \"red\", pch = 19)\n```"
1660
+ },
1661
+ "insertText": "points(${1:x}, ${2:y})",
1662
+ "insertTextRules": 4,
1663
+ "sortText": "02_points"
1664
+ },
1665
+ {
1666
+ "label": "abline",
1667
+ "kind": 1,
1668
+ "detail": "Add straight line to a plot",
1669
+ "documentation": {
1670
+ "value": "Add straight lines to a plot.\n\n```r\nabline(h = 0, col = \"gray\")\nabline(v = mean(x), lty = 2)\nabline(lm_fit, col = \"red\")\n```"
1671
+ },
1672
+ "insertText": "abline(${1:a}, ${2:b})",
1673
+ "insertTextRules": 4,
1674
+ "sortText": "02_abline"
1675
+ },
1676
+ {
1677
+ "label": "legend",
1678
+ "kind": 1,
1679
+ "detail": "Add legend to a plot",
1680
+ "documentation": {
1681
+ "value": "Add a legend to a plot.\n\n```r\nlegend(\"topright\", legend = c(\"A\", \"B\"), col = c(\"red\", \"blue\"), lty = 1)\n```"
1682
+ },
1683
+ "insertText": "legend(\"${1:topright}\", legend = c(${2:...}))",
1684
+ "insertTextRules": 4,
1685
+ "sortText": "02_legend"
1686
+ },
1687
+ {
1688
+ "label": "title",
1689
+ "kind": 1,
1690
+ "detail": "Add title to a plot",
1691
+ "documentation": {
1692
+ "value": "Add annotations to a plot.\n\n```r\ntitle(main = \"Main Title\", sub = \"Subtitle\", xlab = \"X\", ylab = \"Y\")\n```"
1693
+ },
1694
+ "insertText": "title(main = \"${1:Title}\")",
1695
+ "insertTextRules": 4,
1696
+ "sortText": "02_title"
1697
+ },
1698
+ {
1699
+ "label": "par",
1700
+ "kind": 1,
1701
+ "detail": "Set graphical parameters",
1702
+ "documentation": {
1703
+ "value": "Set or query graphical parameters.\n\n```r\npar(mfrow = c(2, 2)) # 2x2 plot layout\npar(mar = c(5, 4, 4, 2) + 0.1)\n```"
1704
+ },
1705
+ "insertText": "par(${1:...})",
1706
+ "insertTextRules": 4,
1707
+ "sortText": "02_par"
1708
+ },
1709
+ {
1710
+ "label": "ggplot",
1711
+ "kind": 1,
1712
+ "detail": "Create a ggplot2 plot",
1713
+ "documentation": {
1714
+ "value": "Initialize a ggplot2 plot.\n\n```r\nlibrary(ggplot2)\nggplot(df, aes(x = x, y = y)) +\n geom_point() +\n theme_minimal()\n```"
1715
+ },
1716
+ "insertText": "ggplot(${1:data}, aes(x = ${2:x}, y = ${3:y})) +\n ${4:geom_point()}",
1717
+ "insertTextRules": 4,
1718
+ "sortText": "02_ggplot"
1719
+ },
1720
+ {
1721
+ "label": "aes",
1722
+ "kind": 1,
1723
+ "detail": "Aesthetic mapping (ggplot2)",
1724
+ "documentation": {
1725
+ "value": "Define aesthetic mappings for ggplot2.\n\n```r\naes(x = var1, y = var2, color = group)\naes(fill = category, size = value)\n```"
1726
+ },
1727
+ "insertText": "aes(x = ${1:x}, y = ${2:y})",
1728
+ "insertTextRules": 4,
1729
+ "sortText": "02_aes"
1730
+ },
1731
+ {
1732
+ "label": "geom_point",
1733
+ "kind": 1,
1734
+ "detail": "Scatter plot layer (ggplot2)",
1735
+ "documentation": {
1736
+ "value": "Add a scatter plot layer.\n\n```r\nggplot(df, aes(x, y)) + geom_point(size = 3, alpha = 0.7)\n```"
1737
+ },
1738
+ "insertText": "geom_point(${1:})",
1739
+ "insertTextRules": 4,
1740
+ "sortText": "02_geom_point"
1741
+ },
1742
+ {
1743
+ "label": "geom_line",
1744
+ "kind": 1,
1745
+ "detail": "Line plot layer (ggplot2)",
1746
+ "documentation": {
1747
+ "value": "Add a line plot layer.\n\n```r\nggplot(df, aes(x, y)) + geom_line(color = \"blue\")\n```"
1748
+ },
1749
+ "insertText": "geom_line(${1:})",
1750
+ "insertTextRules": 4,
1751
+ "sortText": "02_geom_line"
1752
+ },
1753
+ {
1754
+ "label": "geom_bar",
1755
+ "kind": 1,
1756
+ "detail": "Bar chart layer (ggplot2)",
1757
+ "documentation": {
1758
+ "value": "Add a bar chart layer.\n\n```r\nggplot(df, aes(x = category)) + geom_bar()\nggplot(df, aes(x = cat, y = val)) + geom_bar(stat = \"identity\")\n```"
1759
+ },
1760
+ "insertText": "geom_bar(${1:})",
1761
+ "insertTextRules": 4,
1762
+ "sortText": "02_geom_bar"
1763
+ },
1764
+ {
1765
+ "label": "facet_wrap",
1766
+ "kind": 1,
1767
+ "detail": "Facet by variable (ggplot2)",
1768
+ "documentation": {
1769
+ "value": "Facet a plot by a single variable.\n\n```r\nggplot(df, aes(x, y)) + geom_point() + facet_wrap(~group)\n```"
1770
+ },
1771
+ "insertText": "facet_wrap(~${1:variable})",
1772
+ "insertTextRules": 4,
1773
+ "sortText": "02_facet_wrap"
1774
+ },
1775
+ {
1776
+ "label": "theme",
1777
+ "kind": 1,
1778
+ "detail": "Customize plot theme (ggplot2)",
1779
+ "documentation": {
1780
+ "value": "Modify the non-data components of a plot.\n\n```r\ntheme_minimal()\ntheme(axis.text.x = element_text(angle = 45, hjust = 1))\n```"
1781
+ },
1782
+ "insertText": "theme(${1:})",
1783
+ "insertTextRules": 4,
1784
+ "sortText": "02_theme"
1785
+ },
1786
+ {
1787
+ "label": "install.packages",
1788
+ "kind": 1,
1789
+ "detail": "Install CRAN packages",
1790
+ "documentation": {
1791
+ "value": "Download and install packages from CRAN.\n\n```r\ninstall.packages(\"dplyr\")\ninstall.packages(c(\"ggplot2\", \"tidyr\"))\n```"
1792
+ },
1793
+ "insertText": "install.packages(\"${1:package}\")",
1794
+ "insertTextRules": 4,
1795
+ "sortText": "03_install.packages"
1796
+ },
1797
+ {
1798
+ "label": "remove.packages",
1799
+ "kind": 1,
1800
+ "detail": "Remove installed packages",
1801
+ "documentation": {
1802
+ "value": "Remove installed packages.\n\n```r\nremove.packages(\"old_pkg\")\n```"
1803
+ },
1804
+ "insertText": "remove.packages(\"${1:package}\")",
1805
+ "insertTextRules": 4,
1806
+ "sortText": "03_remove.packages"
1807
+ },
1808
+ {
1809
+ "label": "loadNamespace",
1810
+ "kind": 1,
1811
+ "detail": "Load a namespace without attaching",
1812
+ "documentation": {
1813
+ "value": "Load the namespace of a package without attaching it.\n\n```r\nns <- loadNamespace(\"dplyr\")\n```"
1814
+ },
1815
+ "insertText": "loadNamespace(\"${1:package}\")",
1816
+ "insertTextRules": 4,
1817
+ "sortText": "03_loadNamespace"
1818
+ },
1819
+ {
1820
+ "label": "packageVersion",
1821
+ "kind": 1,
1822
+ "detail": "Get package version",
1823
+ "documentation": {
1824
+ "value": "Return the version of an installed package.\n\n```r\npackageVersion(\"ggplot2\") # '3.4.4'\n```"
1825
+ },
1826
+ "insertText": "packageVersion(\"${1:package}\")",
1827
+ "insertTextRules": 4,
1828
+ "sortText": "03_packageVersion"
1829
+ },
1830
+ {
1831
+ "label": "update.packages",
1832
+ "kind": 1,
1833
+ "detail": "Update installed packages",
1834
+ "documentation": {
1835
+ "value": "Update outdated packages.\n\n```r\nupdate.packages(ask = FALSE)\n```"
1836
+ },
1837
+ "insertText": "update.packages(ask = FALSE)",
1838
+ "sortText": "03_update.packages",
1839
+ "insertTextRules": 0
1840
+ },
1841
+ {
1842
+ "label": "available.packages",
1843
+ "kind": 1,
1844
+ "detail": "List available packages on CRAN",
1845
+ "documentation": {
1846
+ "value": "Return a matrix of available packages on CRAN.\n\n```r\npkgs <- available.packages()\n```"
1847
+ },
1848
+ "insertText": "available.packages()",
1849
+ "sortText": "03_available.packages",
1850
+ "insertTextRules": 0
1851
+ },
1852
+ {
1853
+ "label": "lm",
1854
+ "kind": 1,
1855
+ "detail": "Fit a linear model",
1856
+ "documentation": {
1857
+ "value": "Fit a linear model using ordinary least squares.\n\n```r\nfit <- lm(y ~ x1 + x2, data = df)\nsummary(fit)\ncoef(fit)\n```"
1858
+ },
1859
+ "insertText": "lm(${1:formula}, data = ${2:df})",
1860
+ "insertTextRules": 4,
1861
+ "sortText": "03_lm"
1862
+ },
1863
+ {
1864
+ "label": "glm",
1865
+ "kind": 1,
1866
+ "detail": "Fit a generalized linear model",
1867
+ "documentation": {
1868
+ "value": "Fit a generalized linear model.\n\n```r\nfit <- glm(y ~ x, data = df, family = binomial)\nsummary(fit)\n```"
1869
+ },
1870
+ "insertText": "glm(${1:formula}, data = ${2:df}, family = ${3:binomial})",
1871
+ "insertTextRules": 4,
1872
+ "sortText": "03_glm"
1873
+ },
1874
+ {
1875
+ "label": "t.test",
1876
+ "kind": 1,
1877
+ "detail": "Student's t-test",
1878
+ "documentation": {
1879
+ "value": "Perform a t-test.\n\n```r\nt.test(x, mu = 0)\nt.test(x, y, paired = TRUE)\n```"
1880
+ },
1881
+ "insertText": "t.test(${1:x})",
1882
+ "insertTextRules": 4,
1883
+ "sortText": "03_t.test"
1884
+ },
1885
+ {
1886
+ "label": "cor",
1887
+ "kind": 1,
1888
+ "detail": "Correlation",
1889
+ "documentation": {
1890
+ "value": "Compute correlation between vectors or columns.\n\n```r\ncor(x, y)\ncor(df, use = \"complete.obs\")\n```"
1891
+ },
1892
+ "insertText": "cor(${1:x}, ${2:y})",
1893
+ "insertTextRules": 4,
1894
+ "sortText": "03_cor"
1895
+ },
1896
+ {
1897
+ "label": "cor.test",
1898
+ "kind": 1,
1899
+ "detail": "Test for correlation",
1900
+ "documentation": {
1901
+ "value": "Test for association between paired samples.\n\n```r\ncor.test(x, y, method = \"pearson\")\n```"
1902
+ },
1903
+ "insertText": "cor.test(${1:x}, ${2:y})",
1904
+ "insertTextRules": 4,
1905
+ "sortText": "03_cor.test"
1906
+ },
1907
+ {
1908
+ "label": "chisq.test",
1909
+ "kind": 1,
1910
+ "detail": "Chi-squared test",
1911
+ "documentation": {
1912
+ "value": "Perform a chi-squared test.\n\n```r\nchisq.test(table(x, y))\n```"
1913
+ },
1914
+ "insertText": "chisq.test(${1:x})",
1915
+ "insertTextRules": 4,
1916
+ "sortText": "03_chisq.test"
1917
+ },
1918
+ {
1919
+ "label": "aov",
1920
+ "kind": 1,
1921
+ "detail": "Analysis of variance",
1922
+ "documentation": {
1923
+ "value": "Fit an analysis of variance model.\n\n```r\nfit <- aov(y ~ group, data = df)\nsummary(fit)\n```"
1924
+ },
1925
+ "insertText": "aov(${1:formula}, data = ${2:df})",
1926
+ "insertTextRules": 4,
1927
+ "sortText": "03_aov"
1928
+ },
1929
+ {
1930
+ "label": "anova",
1931
+ "kind": 1,
1932
+ "detail": "ANOVA table",
1933
+ "documentation": {
1934
+ "value": "Compute analysis of variance tables for fitted model objects.\n\n```r\nanova(fit1)\nanova(fit1, fit2)\n```"
1935
+ },
1936
+ "insertText": "anova(${1:object})",
1937
+ "insertTextRules": 4,
1938
+ "sortText": "03_anova"
1939
+ },
1940
+ {
1941
+ "label": "predict",
1942
+ "kind": 1,
1943
+ "detail": "Model predictions",
1944
+ "documentation": {
1945
+ "value": "Obtain predictions from a fitted model.\n\n```r\npredict(fit, newdata = test_df)\npredict(fit, interval = \"confidence\")\n```"
1946
+ },
1947
+ "insertText": "predict(${1:object}, newdata = ${2:newdata})",
1948
+ "insertTextRules": 4,
1949
+ "sortText": "03_predict"
1950
+ },
1951
+ {
1952
+ "label": "residuals",
1953
+ "kind": 1,
1954
+ "detail": "Model residuals",
1955
+ "documentation": {
1956
+ "value": "Extract model residuals.\n\n```r\nresiduals(fit)\nresid(fit) # alias\n```"
1957
+ },
1958
+ "insertText": "residuals(${1:object})",
1959
+ "insertTextRules": 4,
1960
+ "sortText": "03_residuals"
1961
+ },
1962
+ {
1963
+ "label": "fitted",
1964
+ "kind": 1,
1965
+ "detail": "Fitted values",
1966
+ "documentation": {
1967
+ "value": "Extract fitted values from a model.\n\n```r\nfitted(fit)\n```"
1968
+ },
1969
+ "insertText": "fitted(${1:object})",
1970
+ "insertTextRules": 4,
1971
+ "sortText": "03_fitted"
1972
+ },
1973
+ {
1974
+ "label": "confint",
1975
+ "kind": 1,
1976
+ "detail": "Confidence intervals",
1977
+ "documentation": {
1978
+ "value": "Compute confidence intervals for model parameters.\n\n```r\nconfint(fit)\nconfint(fit, level = 0.99)\n```"
1979
+ },
1980
+ "insertText": "confint(${1:object})",
1981
+ "insertTextRules": 4,
1982
+ "sortText": "03_confint"
1983
+ },
1984
+ {
1985
+ "label": "coef",
1986
+ "kind": 1,
1987
+ "detail": "Model coefficients",
1988
+ "documentation": {
1989
+ "value": "Extract model coefficients.\n\n```r\ncoef(fit)\n```"
1990
+ },
1991
+ "insertText": "coef(${1:object})",
1992
+ "insertTextRules": 4,
1993
+ "sortText": "03_coef"
1994
+ },
1995
+ {
1996
+ "label": "setClass",
1997
+ "kind": 1,
1998
+ "detail": "Define S4 class",
1999
+ "documentation": {
2000
+ "value": "Create an S4 class definition.\n\n```r\nsetClass(\"Person\", representation(\n name = \"character\",\n age = \"numeric\"\n))\n```"
2001
+ },
2002
+ "insertText": "setClass(\"${1:Class}\", representation(\n ${2:slot} = \"${3:type}\"\n))",
2003
+ "insertTextRules": 4,
2004
+ "sortText": "04_setClass"
2005
+ },
2006
+ {
2007
+ "label": "setGeneric",
2008
+ "kind": 1,
2009
+ "detail": "Define S4 generic",
2010
+ "documentation": {
2011
+ "value": "Create an S4 generic function.\n\n```r\nsetGeneric(\"greet\", function(object) standardGeneric(\"greet\"))\n```"
2012
+ },
2013
+ "insertText": "setGeneric(\"${1:name}\", function(${2:object}) standardGeneric(\"${1:name}\"))",
2014
+ "insertTextRules": 4,
2015
+ "sortText": "04_setGeneric"
2016
+ },
2017
+ {
2018
+ "label": "setMethod",
2019
+ "kind": 1,
2020
+ "detail": "Define S4 method",
2021
+ "documentation": {
2022
+ "value": "Define an S4 method for a generic.\n\n```r\nsetMethod(\"greet\", \"Person\", function(object) {\n cat(\"Hello,\", object@name, \"\\n\")\n})\n```"
2023
+ },
2024
+ "insertText": "setMethod(\"${1:generic}\", \"${2:Class}\", function(${3:object}) {\n ${4}\n})",
2025
+ "insertTextRules": 4,
2026
+ "sortText": "04_setMethod"
2027
+ },
2028
+ {
2029
+ "label": "setRefClass",
2030
+ "kind": 1,
2031
+ "detail": "Define reference class (R5)",
2032
+ "documentation": {
2033
+ "value": "Create a mutable reference class.\n\n```r\nPerson <- setRefClass(\"Person\",\n fields = list(name = \"character\", age = \"numeric\"),\n methods = list(\n greet = function() cat(\"Hello,\", name, \"\\n\")\n )\n)\n```"
2034
+ },
2035
+ "insertText": "setRefClass(\"${1:Class}\",\n fields = list(${2:}),\n methods = list(${3:})\n)",
2036
+ "insertTextRules": 4,
2037
+ "sortText": "04_setRefClass"
2038
+ },
2039
+ {
2040
+ "label": "R6Class",
2041
+ "kind": 1,
2042
+ "detail": "Define R6 class",
2043
+ "documentation": {
2044
+ "value": "Create an R6 class (requires R6 package).\n\n```r\nlibrary(R6)\nPerson <- R6Class(\"Person\",\n public = list(\n name = NULL,\n initialize = function(name) self$name <- name,\n greet = function() cat(\"Hello,\", self$name, \"\\n\")\n )\n)\np <- Person$new(\"Alice\")\n```"
2045
+ },
2046
+ "insertText": "R6Class(\"${1:Class}\",\n public = list(\n initialize = function(${2:}) {\n ${3}\n }\n )\n)",
2047
+ "insertTextRules": 4,
2048
+ "sortText": "04_R6Class"
2049
+ },
2050
+ {
2051
+ "label": "new.env",
2052
+ "kind": 1,
2053
+ "detail": "Create a new environment",
2054
+ "documentation": {
2055
+ "value": "Create a new environment.\n\n```r\ne <- new.env(parent = emptyenv())\nassign(\"x\", 42, envir = e)\n```"
2056
+ },
2057
+ "insertText": "new.env(parent = ${1:emptyenv()})",
2058
+ "insertTextRules": 4,
2059
+ "sortText": "04_new.env"
2060
+ },
2061
+ {
2062
+ "label": "environment",
2063
+ "kind": 1,
2064
+ "detail": "Get/set function environment",
2065
+ "documentation": {
2066
+ "value": "Get or set the environment of a function.\n\n```r\nenvironment(my_func)\nenvironment() # current environment\n```"
2067
+ },
2068
+ "insertText": "environment(${1:fun})",
2069
+ "insertTextRules": 4,
2070
+ "sortText": "04_environment"
2071
+ },
2072
+ {
2073
+ "label": "globalenv",
2074
+ "kind": 1,
2075
+ "detail": "Global environment",
2076
+ "documentation": {
2077
+ "value": "Return the global environment.\n\n```r\nglobalenv()\nls(envir = globalenv())\n```"
2078
+ },
2079
+ "insertText": "globalenv()",
2080
+ "sortText": "04_globalenv",
2081
+ "insertTextRules": 0
2082
+ },
2083
+ {
2084
+ "label": "baseenv",
2085
+ "kind": 1,
2086
+ "detail": "Base environment",
2087
+ "documentation": {
2088
+ "value": "Return the base environment.\n\n```r\nbaseenv()\n```"
2089
+ },
2090
+ "insertText": "baseenv()",
2091
+ "sortText": "04_baseenv",
2092
+ "insertTextRules": 0
2093
+ },
2094
+ {
2095
+ "label": "emptyenv",
2096
+ "kind": 1,
2097
+ "detail": "Empty environment",
2098
+ "documentation": {
2099
+ "value": "Return the empty environment (has no parent).\n\n```r\nemptyenv()\n```"
2100
+ },
2101
+ "insertText": "emptyenv()",
2102
+ "sortText": "04_emptyenv",
2103
+ "insertTextRules": 0
2104
+ },
2105
+ {
2106
+ "label": "parent.env",
2107
+ "kind": 1,
2108
+ "detail": "Parent environment",
2109
+ "documentation": {
2110
+ "value": "Return or set the parent (enclosing) environment.\n\n```r\nparent.env(e)\n```"
2111
+ },
2112
+ "insertText": "parent.env(${1:env})",
2113
+ "insertTextRules": 4,
2114
+ "sortText": "04_parent.env"
2115
+ },
2116
+ {
2117
+ "label": "exists",
2118
+ "kind": 1,
2119
+ "detail": "Check if variable exists",
2120
+ "documentation": {
2121
+ "value": "Check if a variable exists in an environment.\n\n```r\nexists(\"x\") # TRUE/FALSE\nexists(\"x\", envir = my_env)\n```"
2122
+ },
2123
+ "insertText": "exists(\"${1:name}\")",
2124
+ "insertTextRules": 4,
2125
+ "sortText": "04_exists"
2126
+ },
2127
+ {
2128
+ "label": "get",
2129
+ "kind": 1,
2130
+ "detail": "Get value of variable",
2131
+ "documentation": {
2132
+ "value": "Retrieve a variable by name.\n\n```r\nget(\"x\")\nget(\"func\", envir = ns)\n```"
2133
+ },
2134
+ "insertText": "get(\"${1:name}\")",
2135
+ "insertTextRules": 4,
2136
+ "sortText": "04_get"
2137
+ },
2138
+ {
2139
+ "label": "assign",
2140
+ "kind": 1,
2141
+ "detail": "Assign value to variable",
2142
+ "documentation": {
2143
+ "value": "Assign a value to a name in an environment.\n\n```r\nassign(\"x\", 42)\nassign(\"y\", 100, envir = my_env)\n```"
2144
+ },
2145
+ "insertText": "assign(\"${1:name}\", ${2:value})",
2146
+ "insertTextRules": 4,
2147
+ "sortText": "04_assign"
2148
+ },
2149
+ {
2150
+ "label": "rm",
2151
+ "kind": 1,
2152
+ "detail": "Remove objects",
2153
+ "documentation": {
2154
+ "value": "Remove objects from an environment.\n\n```r\nrm(x, y)\nrm(list = ls()) # clear all\n```"
2155
+ },
2156
+ "insertText": "rm(${1:...})",
2157
+ "insertTextRules": 4,
2158
+ "sortText": "04_rm"
2159
+ },
2160
+ {
2161
+ "label": "ls",
2162
+ "kind": 1,
2163
+ "detail": "List objects",
2164
+ "documentation": {
2165
+ "value": "List objects in an environment.\n\n```r\nls()\nls(envir = my_env)\nls(pattern = \"^data\")\n```"
2166
+ },
2167
+ "insertText": "ls()",
2168
+ "sortText": "04_ls",
2169
+ "insertTextRules": 0
2170
+ },
2171
+ {
2172
+ "label": "attach",
2173
+ "kind": 1,
2174
+ "detail": "Attach data to search path",
2175
+ "documentation": {
2176
+ "value": "Attach a data frame or list to the search path.\n\n```r\nattach(mtcars)\nmpg # directly accessible\ndetach(mtcars)\n```"
2177
+ },
2178
+ "insertText": "attach(${1:what})",
2179
+ "insertTextRules": 4,
2180
+ "sortText": "04_attach"
2181
+ },
2182
+ {
2183
+ "label": "detach",
2184
+ "kind": 1,
2185
+ "detail": "Detach from search path",
2186
+ "documentation": {
2187
+ "value": "Detach a previously attached object.\n\n```r\ndetach(mtcars)\ndetach(\"package:dplyr\")\n```"
2188
+ },
2189
+ "insertText": "detach(${1:name})",
2190
+ "insertTextRules": 4,
2191
+ "sortText": "04_detach"
2192
+ },
2193
+ {
2194
+ "label": "search",
2195
+ "kind": 1,
2196
+ "detail": "Show search path",
2197
+ "documentation": {
2198
+ "value": "Return the current search path.\n\n```r\nsearch()\n# \".GlobalEnv\" \"package:stats\" ...\n```"
2199
+ },
2200
+ "insertText": "search()",
2201
+ "sortText": "04_search",
2202
+ "insertTextRules": 0
2203
+ },
2204
+ {
2205
+ "label": "for_loop",
2206
+ "kind": 27,
2207
+ "detail": "Snippet: for loop",
2208
+ "documentation": {
2209
+ "value": "Standard for loop iterating over a sequence.\n\n```r\nfor (i in 1:n) {\n # body\n}\n```"
2210
+ },
2211
+ "insertText": "for (${1:i} in ${2:1:n}) {\n ${3}\n}",
2212
+ "insertTextRules": 4,
2213
+ "sortText": "05_for_loop"
2214
+ },
2215
+ {
2216
+ "label": "while_loop",
2217
+ "kind": 27,
2218
+ "detail": "Snippet: while loop",
2219
+ "documentation": {
2220
+ "value": "While loop.\n\n```r\nwhile (condition) {\n # body\n}\n```"
2221
+ },
2222
+ "insertText": "while (${1:condition}) {\n ${2}\n}",
2223
+ "insertTextRules": 4,
2224
+ "sortText": "05_while_loop"
2225
+ },
2226
+ {
2227
+ "label": "func_def",
2228
+ "kind": 27,
2229
+ "detail": "Snippet: function definition",
2230
+ "documentation": {
2231
+ "value": "Define a named function.\n\n```r\nmy_func <- function(x, y = 1) {\n x + y\n}\n```"
2232
+ },
2233
+ "insertText": "${1:name} <- function(${2:args}) {\n ${3}\n}",
2234
+ "insertTextRules": 4,
2235
+ "sortText": "05_func_def"
2236
+ },
2237
+ {
2238
+ "label": "if_else_block",
2239
+ "kind": 27,
2240
+ "detail": "Snippet: if-else block",
2241
+ "documentation": {
2242
+ "value": "Full if/else if/else block.\n\n```r\nif (cond1) {\n # ...\n} else if (cond2) {\n # ...\n} else {\n # ...\n}\n```"
2243
+ },
2244
+ "insertText": "if (${1:condition}) {\n ${2}\n} else {\n ${3}\n}",
2245
+ "insertTextRules": 4,
2246
+ "sortText": "05_if_else_block"
2247
+ },
2248
+ {
2249
+ "label": "trycatch_block",
2250
+ "kind": 27,
2251
+ "detail": "Snippet: tryCatch block",
2252
+ "documentation": {
2253
+ "value": "Error handling block.\n\n```r\ntryCatch({\n # risky code\n}, error = function(e) {\n message(e$message)\n})\n```"
2254
+ },
2255
+ "insertText": "tryCatch({\n ${1}\n}, warning = function(w) {\n message(\"Warning: \", w$message)\n}, error = function(e) {\n message(\"Error: \", e$message)\n ${2:NULL}\n})",
2256
+ "insertTextRules": 4,
2257
+ "sortText": "05_trycatch_block"
2258
+ },
2259
+ {
2260
+ "label": "read_csv_snippet",
2261
+ "kind": 27,
2262
+ "detail": "Snippet: read CSV file",
2263
+ "documentation": {
2264
+ "value": "Read a CSV file into a data frame.\n\n```r\ndf <- read.csv(\"data.csv\", stringsAsFactors = FALSE)\nstr(df)\nhead(df)\n```"
2265
+ },
2266
+ "insertText": "${1:df} <- read.csv(\"${2:data.csv}\", stringsAsFactors = FALSE)\nstr(${1:df})\nhead(${1:df})",
2267
+ "insertTextRules": 4,
2268
+ "sortText": "05_read_csv_snippet"
2269
+ },
2270
+ {
2271
+ "label": "ggplot_snippet",
2272
+ "kind": 27,
2273
+ "detail": "Snippet: ggplot scatter plot",
2274
+ "documentation": {
2275
+ "value": "A quick ggplot2 scatter plot.\n\n```r\nlibrary(ggplot2)\nggplot(df, aes(x = x, y = y)) +\n geom_point() +\n labs(title = \"Title\") +\n theme_minimal()\n```"
2276
+ },
2277
+ "insertText": "library(ggplot2)\nggplot(${1:df}, aes(x = ${2:x}, y = ${3:y})) +\n geom_point() +\n labs(title = \"${4:Title}\") +\n theme_minimal()",
2278
+ "insertTextRules": 4,
2279
+ "sortText": "05_ggplot_snippet"
2280
+ },
2281
+ {
2282
+ "label": "pipe_data",
2283
+ "kind": 27,
2284
+ "detail": "Snippet: data pipeline (pipes)",
2285
+ "documentation": {
2286
+ "value": "Data transformation pipeline using the native pipe.\n\n```r\nlibrary(dplyr)\nresult <- df |>\n filter(x > 0) |>\n mutate(y = x * 2) |>\n summarise(mean_y = mean(y))\n```"
2287
+ },
2288
+ "insertText": "${1:result} <- ${2:df} |>\n filter(${3:condition}) |>\n mutate(${4:new_col} = ${5:expr}) |>\n summarise(${6:agg} = ${7:mean}(${8:col}))",
2289
+ "insertTextRules": 4,
2290
+ "sortText": "05_pipe_data"
2291
+ },
2292
+ {
2293
+ "label": "shiny_app",
2294
+ "kind": 27,
2295
+ "detail": "Snippet: Shiny app skeleton",
2296
+ "documentation": {
2297
+ "value": "Basic Shiny application template.\n\n```r\nlibrary(shiny)\nui <- fluidPage(\n titlePanel(\"My App\"),\n sidebarLayout(\n sidebarPanel(sliderInput(\"n\", \"N:\", 1, 100, 50)),\n mainPanel(plotOutput(\"plot\"))\n )\n)\nserver <- function(input, output) {\n output$plot <- renderPlot({ hist(rnorm(input$n)) })\n}\nshinyApp(ui, server)\n```"
2298
+ },
2299
+ "insertText": "library(shiny)\n\nui <- fluidPage(\n titlePanel(\"${1:My App}\"),\n sidebarLayout(\n sidebarPanel(\n ${2:sliderInput(\"n\", \"N:\", 1, 100, 50)}\n ),\n mainPanel(\n ${3:plotOutput(\"plot\")}\n )\n )\n)\n\nserver <- function(input, output) {\n output\\$${4:plot} <- renderPlot({\n ${5:hist(rnorm(input\\$n))}\n })\n}\n\nshinyApp(ui, server)",
2300
+ "insertTextRules": 4,
2301
+ "sortText": "05_shiny_app"
2302
+ },
2303
+ {
2304
+ "label": "r6_class_snippet",
2305
+ "kind": 27,
2306
+ "detail": "Snippet: R6 class definition",
2307
+ "documentation": {
2308
+ "value": "R6 class template.\n\n```r\nlibrary(R6)\nMyClass <- R6Class(\"MyClass\",\n public = list(\n initialize = function(...) { },\n method = function() { }\n )\n)\n```"
2309
+ },
2310
+ "insertText": "library(R6)\n${1:MyClass} <- R6Class(\"${1:MyClass}\",\n public = list(\n ${2:field} = NULL,\n initialize = function(${3:}) {\n self\\$${2:field} <- ${3:}\n },\n ${4:method} = function() {\n ${5}\n }\n )\n)",
2311
+ "insertTextRules": 4,
2312
+ "sortText": "05_r6_class_snippet"
2313
+ },
2314
+ {
2315
+ "label": "integer",
2316
+ "kind": 7,
2317
+ "detail": "Type: integer",
2318
+ "documentation": {
2319
+ "value": "Integer type. Created with `L` suffix or `as.integer()`.\n\n```r\nx <- 42L\ntypeof(x) # \"integer\"\n```"
2320
+ },
2321
+ "insertText": "integer",
2322
+ "sortText": "06_integer",
2323
+ "insertTextRules": 0
2324
+ },
2325
+ {
2326
+ "label": "double",
2327
+ "kind": 7,
2328
+ "detail": "Type: double",
2329
+ "documentation": {
2330
+ "value": "Double-precision floating point number.\n\n```r\nx <- 3.14\ntypeof(x) # \"double\"\n```"
2331
+ },
2332
+ "insertText": "double",
2333
+ "sortText": "06_double",
2334
+ "insertTextRules": 0
2335
+ },
2336
+ {
2337
+ "label": "character",
2338
+ "kind": 7,
2339
+ "detail": "Type: character",
2340
+ "documentation": {
2341
+ "value": "Character (string) type.\n\n```r\nx <- \"hello\"\ntypeof(x) # \"character\"\n```"
2342
+ },
2343
+ "insertText": "character",
2344
+ "sortText": "06_character",
2345
+ "insertTextRules": 0
2346
+ },
2347
+ {
2348
+ "label": "logical",
2349
+ "kind": 7,
2350
+ "detail": "Type: logical",
2351
+ "documentation": {
2352
+ "value": "Logical type (TRUE/FALSE/NA).\n\n```r\nx <- TRUE\ntypeof(x) # \"logical\"\n```"
2353
+ },
2354
+ "insertText": "logical",
2355
+ "sortText": "06_logical",
2356
+ "insertTextRules": 0
2357
+ },
2358
+ {
2359
+ "label": "complex",
2360
+ "kind": 7,
2361
+ "detail": "Type: complex",
2362
+ "documentation": {
2363
+ "value": "Complex number type.\n\n```r\nx <- 1 + 2i\ntypeof(x) # \"complex\"\n```"
2364
+ },
2365
+ "insertText": "complex",
2366
+ "sortText": "06_complex",
2367
+ "insertTextRules": 0
2368
+ },
2369
+ {
2370
+ "label": "raw",
2371
+ "kind": 7,
2372
+ "detail": "Type: raw",
2373
+ "documentation": {
2374
+ "value": "Raw byte type.\n\n```r\nx <- charToRaw(\"A\")\ntypeof(x) # \"raw\"\n```"
2375
+ },
2376
+ "insertText": "raw",
2377
+ "sortText": "06_raw",
2378
+ "insertTextRules": 0
2379
+ },
2380
+ {
2381
+ "label": "data.frame_type",
2382
+ "kind": 7,
2383
+ "detail": "Type: data.frame",
2384
+ "documentation": {
2385
+ "value": "Data frame — tabular data structure with named columns.\n\n```r\ndf <- data.frame(x = 1:3, y = c(\"a\", \"b\", \"c\"))\nclass(df) # \"data.frame\"\n```"
2386
+ },
2387
+ "insertText": "data.frame",
2388
+ "sortText": "06_data.frame",
2389
+ "insertTextRules": 0
2390
+ },
2391
+ {
2392
+ "label": "matrix_type",
2393
+ "kind": 7,
2394
+ "detail": "Type: matrix",
2395
+ "documentation": {
2396
+ "value": "Matrix — 2D array of same-type elements.\n\n```r\nm <- matrix(1:6, nrow = 2)\nclass(m) # \"matrix\" \"array\"\n```"
2397
+ },
2398
+ "insertText": "matrix",
2399
+ "sortText": "06_matrix",
2400
+ "insertTextRules": 0
2401
+ },
2402
+ {
2403
+ "label": "factor_type",
2404
+ "kind": 7,
2405
+ "detail": "Type: factor",
2406
+ "documentation": {
2407
+ "value": "Factor — categorical variable with fixed levels.\n\n```r\nf <- factor(c(\"low\", \"med\", \"high\"))\nclass(f) # \"factor\"\n```"
2408
+ },
2409
+ "insertText": "factor",
2410
+ "sortText": "06_factor",
2411
+ "insertTextRules": 0
2412
+ },
2413
+ {
2414
+ "label": "environment_type",
2415
+ "kind": 7,
2416
+ "detail": "Type: environment",
2417
+ "documentation": {
2418
+ "value": "Environment — frame for variable bindings.\n\n```r\ne <- new.env()\nis.environment(e) # TRUE\n```"
2419
+ },
2420
+ "insertText": "environment",
2421
+ "sortText": "06_environment",
2422
+ "insertTextRules": 0
2423
+ },
2424
+ {
2425
+ "label": "formula",
2426
+ "kind": 7,
2427
+ "detail": "Type: formula",
2428
+ "documentation": {
2429
+ "value": "Formula — symbolic model specification.\n\n```r\nf <- y ~ x1 + x2\nclass(f) # \"formula\"\n```"
2430
+ },
2431
+ "insertText": "formula",
2432
+ "sortText": "06_formula",
2433
+ "insertTextRules": 0
2434
+ },
2435
+ {
2436
+ "label": "expression",
2437
+ "kind": 7,
2438
+ "detail": "Type: expression",
2439
+ "documentation": {
2440
+ "value": "Expression — unevaluated R expressions.\n\n```r\ne <- expression(1 + 2)\neval(e) # 3\n```"
2441
+ },
2442
+ "insertText": "expression",
2443
+ "sortText": "06_expression",
2444
+ "insertTextRules": 0
2445
+ },
2446
+ {
2447
+ "label": "call_type",
2448
+ "kind": 7,
2449
+ "detail": "Type: call",
2450
+ "documentation": {
2451
+ "value": "Call — an unevaluated function call.\n\n```r\ncl <- quote(mean(x))\nclass(cl) # \"call\"\n```"
2452
+ },
2453
+ "insertText": "call",
2454
+ "sortText": "06_call",
2455
+ "insertTextRules": 0
2456
+ },
2457
+ {
2458
+ "label": "symbol_type",
2459
+ "kind": 7,
2460
+ "detail": "Type: symbol/name",
2461
+ "documentation": {
2462
+ "value": "Symbol — a variable name.\n\n```r\ns <- as.name(\"x\")\nclass(s) # \"name\"\n```"
2463
+ },
2464
+ "insertText": "symbol",
2465
+ "sortText": "06_symbol",
2466
+ "insertTextRules": 0
2467
+ }
2468
+ ]
2469
+ }