| Type: | Package |
| Title: | Translate R Help Pages to Chinese with 'DeepSeek' |
| Version: | 0.3.5 |
| Description: | Renders on-the-fly Simplified-Chinese translations of R help pages in the help pane of 'RStudio' or 'Positron', using the 'DeepSeek' chat model with reasoning (thinking mode) disabled for fast, low-cost, clean output. Works as a drop-in replacement for ? and help(). Translations are cached on disk. |
| License: | MIT + file LICENSE |
| URL: | https://github.com/Exceptions-del/deephelp |
| BugReports: | https://github.com/Exceptions-del/deephelp/issues |
| Encoding: | UTF-8 |
| Depends: | R (≥ 4.1.0) |
| Imports: | httr, jsonlite, tools, utils, xml2 |
| Suggests: | rstudioapi |
| Config/roxygen2/version: | 8.1.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-11-04 06:08:49 UTC; shi |
| Author: | Xing Shi [aut, cre] |
| Maintainer: | Xing Shi <1902186493@qq.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-11-25 12:40:14 UTC |
Translate and display an R help page in Chinese
Description
Translate and display an R help page in Chinese
Usage
deephelp(topic, package = NULL, lang = NULL, type = NULL, ...)
Arguments
topic |
A name or character string specifying the help topic. |
package |
Optional package name. If 'NULL', loaded packages are searched. |
lang |
Target language. Defaults to the value set via [deephelp_use()]. |
type |
Output type: '"html"' (default, opens the translated page in the Help pane of RStudio or Positron) or '"text"' (prints plain text). |
... |
Currently ignored. |
Value
An object of class '"deephelp_topic"', a list with components 'topic', 'package', 'rd' (the parsed, translated Rd object) and 'type'. It has a 'print()' method that renders the translated help page. On error, the call falls back to [utils::help()] and returns its value instead.
Clear the translation cache
Description
Clear the translation cache
Usage
deephelp_clear_cache(cache = NULL)
Arguments
cache |
Cache directory to clear. Defaults to the current cache location. |
Value
Invisibly 'NULL'. Called for its side effect of deleting the on-disk translation cache.
Disable automatic translation of '?' and 'help()'
Description
Disable automatic translation of '?' and 'help()'
Usage
deephelp_off()
Value
Invisibly 'FALSE'. Called for its side effect of disabling automatic translation.
Enable automatic translation of '?' and 'help()'
Description
Enable automatic translation of '?' and 'help()'
Usage
deephelp_on()
Value
Invisibly 'TRUE'. Called for its side effect of enabling automatic translation and attaching the '?'/'help()' shims.
Translate fuzzy help-search results ('??', 'help.search')
Description
Translate fuzzy help-search results ('??', 'help.search')
Usage
deephelp_search(pattern, package = NULL, ...)
Arguments
pattern |
Keyword pattern to search for. |
package |
Optional package name to restrict the search. |
... |
Passed to [utils::help.search()]. |
Value
The value returned by [utils::help.search()], an object of class '"help_files_with_topic"' (a list including the 'matches' data frame), with the 'Title' column of 'matches' translated to the target language.
Print the current configuration
Description
Print the current configuration
Usage
deephelp_status()
Value
Invisibly, the current configuration as a named list. Called for its side effect of printing the configuration.
Examples
deephelp_status()
Configure the DeepSeek backend
Description
Configure the DeepSeek backend
Usage
deephelp_use(
api_key = NULL,
model = NULL,
base_url = NULL,
lang = NULL,
cache = NULL,
temperature = NULL,
max_tokens = NULL,
timeout = NULL,
cjk_spacing = NULL,
glossary = NULL
)
Arguments
api_key |
DeepSeek API key. Falls back to 'getOption("deephelp.api_key")' and then the 'DEEPSEEK_API_KEY' environment variable. |
model |
Model name. Defaults to '"deepseek-flash"' (fast, cheap, non-reasoning). Use '"deepseek-v4-pro"' for higher quality at higher cost. |
base_url |
API base URL. Defaults to '"https://api.deepseek.com"'. |
lang |
Target language. Defaults to Simplified Chinese. |
cache |
Cache directory. 'NULL' uses the default location; '""' disables caching; otherwise a directory path. |
temperature |
Optional sampling temperature passed to the API. |
max_tokens |
Optional maximum number of output tokens. |
timeout |
HTTP timeout in seconds. |
cjk_spacing |
Logical. Insert consistent single spaces between Chinese and Latin letters/digits (and around code) in the translated output. Defaults to 'TRUE'. |
glossary |
Named character vector mapping English statistical terms to Chinese translations. Merged over the built-in glossary; use 'character(0)' to disable the glossary entirely. |
Value
Invisibly, the updated configuration as a named list. Called for its side effect of updating the stored configuration and printing the new status via [deephelp_status()].