./devel/R-xfun, Miscellaneous functions by Yihui Xie

[ CVSweb ] [ Homepage ] [ RSS ] [ Required by ] [ Add to tracker ]


Branch: CURRENT, Version: 0.42, Package name: R-xfun-0.42, Maintainer: pkgsrc-users

Miscellaneous functions commonly used in other packages maintained by
'Yihui Xie'.


Required to run:
[math/R]

Required to build:
[pkgtools/cwrappers]

Master sites: (Expand)


Version history: (Expand)


CVS history: (Expand)


   2024-02-18 15:22:58 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(devel/R-xfun) Updated 0.41 to 0.42

# CHANGES IN xfun VERSION 0.42

- `isFALSE()` has been fully deprecated for R >= 3.5.0, and will be
  completely removed from this package in the future
  (<https://yihui.org/en/2023/02/xfun-isfalse/>).

- Added a function `record()` to run R code and record the results,
  which is similar to `evaluate::evaluate()` but less sophisticated
  and technically simpler. One major difference is that
  `xfun::record()` records plots directly to files instead of saving
  them as display lists.

- `yaml_load()` gained an `envir` argument, which can be used to
  specify the environment to evaluate R expressions in YAML (i.e.,
  expressions written after `!expr` or `!r`). This is not
  straightforward in the upstream **yaml** package (thanks, @viking,
  vubiostat/r-yaml#54).

- `yaml_body()` gained the `...` argument to pass more arguments to
  `yaml_load()`.

- `split_source()` gained a `merge_comments` argument to merge
  consecutive lines of comments into the next code block, a
  `line_number` argument to store the line number of each expression
  in the returned value, and a `skip` argument to skip the rest of the
  code when the skip token is found.

- `check_old_package()` has been vectorized, i.e., the arguments
  `name` and `version` can take vectors now.

- Factored out the code for parsing chunk options and dividing a chunk
  into chunk options and chunk body from **knitr** to this package as
  functions `csv_options()` and `divide_chunk()`, respectively. They
  will be used by **knitr** and other packages in future.

- Added a function `decimal_dot()` to evaluate an expression after
  forcing `options(OutDec = '.')` and `Sys.setlocale(LC_NUMERIC =
  'C')` (for rstudio/rmarkdown#2525).
   2024-02-05 22:19:44 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(devel/R-xfun) Updated 0.36 to 0.41, make test missing TEST_DEPENDS

# CHANGES IN xfun VERSION 0.41

- `process_file()` will write to the file only if the processed text
  is different with the input text. This is to avoid writing files
  unnecessarily.

- `session_info()` will remove extra blank lines (thanks, @chuxinyuan,
  #82) and also omit the time zone info.

# CHANGES IN xfun VERSION 0.40

- `number_to_words()` supports decimal numbers now (thanks,
  @harshvardhaniimi, #80).

- `is_ascii()` is more robust now (thanks, @bastistician, #81).

# CHANGES IN xfun VERSION 0.39

- Fixed a bug that `protect_math()` fails to protect the starting `$$`
  that has leading white spaces.

- Added a function `strip_html()` to remove HTML tags and comments from text.

- The function `alnum_id()` will remove HTML tags and comments from
  text (using `strip_html()`) before converting it to an ID string.

- Added a function `env_option()` to retrieve an option value from
  `options()`. If the option does not exist there, check the
  environment variables. This provides a way for users to set an
  option via either `options()` or an environment variable.

# CHANGES IN xfun VERSION 0.38

- Added an object `download_cache`, which is a list of methods to
  download a URL, cache the result, retrieve the result from the
  cache, and clear the cache.

- Added an argument `default` to `url_filename()` to provide a default
  filename when it cannot be determined from the URL.

- Added a function `yaml_load()` to read YAML data when the **yaml**
  package is not available. It only supports a limited number of data
  types and is supposed to be used as a fallback method. See the help
  page `?xfun::yaml_load` for details.

- Added a function `yaml_body()` to split a document into YAML metadata and the body.

- `is_arm64()` also supports Linux now (thanks, @eitsupi, #74).

- `is_blank()` returns a logical vector of the same length as the
  input vector now, indicating if each element of the input is
  blank. Previously it returns a logical scalar indicating whether
  *all* elements are blank. If you want the old behavior, you can use
  `all(is_blank())`.

# CHANGES IN xfun VERSION 0.37

- Added a function `is_arm64()` to test the CPU type (thanks, @AlbanSagouis, #72).

- Started deprecating `xfun::isFALSE()` in favor of `base::isFALSE()`
  for R >= 3.5.0 (thanks, @mmaechler, #66); `isFALSE()` will
  eventually be removed from **xfun** when we do not need to support R
  < 3.5.0.
   2023-06-03 15:40:21 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(devel/R-xfun) Updated 0.37 to 0.39

# CHANGES IN xfun VERSION 0.39

- Fixed a bug that `protect_math()` fails to protect the starting `$$`
  that has leading white spaces.

- Added a function `strip_html()` to remove HTML tags and comments
  from text.

- The function `alnum_id()` will remove HTML tags and comments from
  text (using `strip_html()`) before converting it to an ID string.

- Added a function `env_option()` to retrieve an option value from
  `options()`. If the option does not exist there, check the
  environment variables. This provides a way for users to set an
  option via either `options()` or an environment variable.

# CHANGES IN xfun VERSION 0.38

- Added an object `download_cache`, which is a list of methods to
  download a URL, cache the result, retrieve the result from the
  cache, and clear the cache.

- Added an argument `default` to `url_filename()` to provide a default
  filename when it cannot be determined from the URL.

- Added a function `yaml_load()` to read YAML data when the **yaml**
  package is not available. It only supports a limited number of data
  types and is supposed to be used as a fallback method. See the help
  page `?xfun::yaml_load` for details.

- Added a function `yaml_body()` to split a document into YAML
  metadata and the body.

- `is_arm64()` also supports Linux now (thanks, @eitsupi, #74).

- `is_blank()` returns a logical vector of the same length as the
  input vector now, indicating if each element of the input is
  blank. Previously it returns a logical scalar indicating whether
  *all* elements are blank. If you want the old behavior, you can use
  `all(is_blank())`.
   2023-02-19 13:48:24 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(devel/R-xfun) Updated 0.36 to 0.37

# CHANGES IN xfun VERSION 0.37

- Added a function `is_arm64()` to test the CPU type (thanks, @AlbanSagouis, #72).

- Started deprecating `xfun::isFALSE()` in favor of `base::isFALSE()`
  for R >= 3.5.0 (thanks, @mmaechler, #66); `isFALSE()` will
  eventually be removed from **xfun** when we do not need to support R
  < 3.5.0.
   2022-12-31 13:44:14 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(devel/R-xfun) Updated 0.35 to 0.36

# CHANGES IN xfun VERSION 0.36

- Added a new argument `resolve_symlink` to `normalize_path()` to get
  the absolute paths of symlinks without resolving them (with
  `resolve_symlink = FALSE`).
   2022-12-18 06:08:39 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(devel/R-xfun) Updated 0.31 to 0.35

# CHANGES IN xfun VERSION 0.35

- Added a new argument `token` to `protect_math()` to optionally
  include a token around math expressions.

- `base64_uri()` relies less on the **mime** package now. For some
  common file extensions (e.g., `.jpg`/`.png`), this function knows
  their MIME types.

- `stringsAsStrings()` has been removed from this package.

# CHANGES IN xfun VERSION 0.34

- Added a new function `alnum_id()` to generate ID strings from a character vector.

- The function `stringsAsStrings()` has been deprecated.

# CHANGES IN xfun VERSION 0.33

- Reverted the change for #68: the characters `-+!_#` are no longer
  accepted by default in filename extensions, since they are
  relatively rare and caused a breakage in rstudio/bookdown#1369. If
  you wish to allow for these characters, you may use the new `extra`
  argument in `file_ext()` and related functions, e.g.,
  `xfun::file_ext(x, extra = '-+!_#')`.

- The function `stringsAsStrings()` will be deprecated in a future
  release of **xfun**, because the global option `stringsAsFactors =
  FALSE` has become the default in base R since 4.0.0.

# CHANGES IN xfun VERSION 0.32

- Added a function `shrink_images()` to shrink images to a maximum
  width using the **magick** package (thanks, @apreshill,
  rstudio/blogdown#614).

- Added a function `tinify_dir()` as a wrapper of `tinify()` to
  compress images under a directory.

- `file_ext()` supports more file extensions now, such as `.c++`,
  `.FB2K-COMPONENT`, and so on (thanks, @tentacles-from-outer-space,
  #68).

- Fixed the issue that `xfun::base_pkgs()` could hang R (thanks,
  @mmaechler, #66).

- The `...` argument in `dir_create()` was not passed to `dir.create()`.
   2022-05-30 17:11:36 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(devel/R-xfun) Updated 0.30 to 0.31

# CHANGES IN xfun VERSION 0.31

- `github_releases(use_jsonlite = FALSE)` supports R versions below 4.1.0 now.

- `session_info()` silently drops empty package names now (thanks, @phargarten2, \ 
#65).
   2022-04-23 03:54:49 by Makoto Fujiwara | Files touched by this commit (2)
Log message:
(devel/R-xfun) Updated 0.26 to 0.30

# CHANGES IN xfun VERSION 0.30

- Added a new function `is_blank()` (previously existed in **knitr**)
  to test if all elements of a character vector are blank (white
  spaces or empty strings).

- Added a new argument `error = TRUE` to `existing_files()`.

# CHANGES IN xfun VERSION 0.29

- `github_releases()` can fetch all releases (tags) of a Github repo
  now.

- Added an argument `.error` to `download_file()` so that users can
  customize the error message when the download fails.

- Added functions `rest_api_raw()` and `rest_api()` to get data from a
  REST API; also added the function `github_api()` to get data from
  the Github API based on `rest_api_raw()`.

- Added a wrapper function `system3()` based on `system2()` to mark
  the character output of `system2()` as UTF-8 if appropriate.

- Added a function `existing_files()` to return file paths that exist
  (a shorthand of `x[file.exists(x)]`).

- Added a function `read_all()` to read multiple files and concatenate
  the content into a character vector.

- `url_accessible()` uses `curlGetHeaders()` by default (instead of
  `download_file()`) to test if a URL is accessible when the **curl**
  package is not available.

- When `options(xfun.rev_check.compare = FALSE)`, `rev_check()` will
  run `R CMD check` on reverse dependencies against a source package
  but not the CRAN version of this package. By default, this option is
  `TRUE`, meaning that `R CMD check` will run against both versions of
  the package.

# CHANGES IN xfun VERSION 0.28

- Added a new function `url_accessible()` to test if a URL can be
  downloaded.

- Added a new function `try_error()` to try an expression and see if
  it throws an error.

# CHANGES IN xfun VERSION 0.27

- Exported and documented the function `xfun::base_pkgs()` (to return
  base R package names).

- Changed the default value of the `status_only` argument of
  `compare_Rcheck()` from `FALSE` to `TRUE`.

- Added new functions `crandalf_check()` and `crandalf_results()` for
  checking (especially large numbers of) reverse dependencies of
  packages via [**crandalf**](https://github.com/yihui/crandalf).

- Added new functions `append_utf8()` and `append_unique()` based on
  `read_utf8()` and `write_utf8()` to append content to files or
  connections.