Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
10 of 374 committers (2.7%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (17.7%) to scientific vocabulary
Keywords
filesystem
libuv
r
Keywords from Contributors
unit-testing
tidy-data
devtools
rmarkdown
setup
package-creation
latex
csv
visualisation
fwf
Last synced: 6 months ago
·
JSON representation
Repository
Provide cross platform file operations based on libuv.
Basic Info
- Host: GitHub
- Owner: r-lib
- License: other
- Language: C
- Default Branch: main
- Homepage: https://fs.r-lib.org/
- Size: 15.6 MB
Statistics
- Stars: 374
- Watchers: 11
- Forks: 82
- Open Issues: 66
- Releases: 22
Topics
filesystem
libuv
r
Created about 8 years ago
· Last pushed 10 months ago
Metadata Files
Readme
Changelog
License
Code of conduct
README.Rmd
---
output: github_document
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
if (basename(getwd()) == "docs") {
knitr::opts_knit$set(root.dir = file.path(getwd(), ".."))
}
fs:::pkgdown_tmp(c("/tmp/filedd463d6d7e0f", "/tmp/filedd464dbb3467"))
```
# fs
[](https://lifecycle.r-lib.org/articles/stages.html#maturing)
[](https://github.com/r-lib/fs/actions/workflows/R-CMD-check.yaml)
[](https://app.codecov.io/gh/r-lib/fs)
**fs** provides a cross-platform, uniform interface to file system operations.
It shares the same back-end component as [nodejs](https://nodejs.org), the
[libuv](https://docs.libuv.org/en/v1.x/fs.html) C library, which brings the
benefit of extensive real-world use and rigorous cross-platform testing. The
name, and some of the interface, is partially inspired by Rust's [fs
module](https://doc.rust-lang.org/std/fs/index.html).
## Installation
You can install the released version of **fs** from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("fs")
```
And the development version from [GitHub](https://github.com/) with:
```r
pak::pak("r-lib/fs")
```
## Comparison vs base equivalents
**fs** functions smooth over some of the idiosyncrasies of file handling with
base R functions:
* Vectorization. All **fs** functions are vectorized, accepting multiple paths
as input. Base functions are inconsistently vectorized.
* Predictable return values that always convey a path. All **fs** functions
return a character vector of paths, a named integer or a logical vector, where
the names give the paths. Base return values are more varied: they are often
logical or contain error codes which require downstream processing.
* Explicit failure. If **fs** operations fail, they throw an error. Base
functions tend to generate a warning and a system dependent error code. This
makes it easy to miss a failure.
* UTF-8 all the things. **fs** functions always convert input paths to UTF-8 and
return results as UTF-8. This gives you path encoding consistency across OSes.
Base functions rely on the native system encoding.
* Naming convention. **fs** functions use a consistent naming convention.
Because base R's functions were gradually added over time there are a number
of different conventions used (e.g. `path.expand()` vs `normalizePath()`;
`Sys.chmod()` vs `file.access()`).
### Tidy paths
**fs** functions always return 'tidy' paths. Tidy paths
- Always use `/` to delimit directories
- never have multiple `/` or trailing `/`
Tidy paths are also coloured (if your terminal supports it) based on the
file permissions and file type. This colouring can be customized or extended by
setting the `LS_COLORS` environment variable, in the same output format as [GNU
dircolors](https://www.bigsoft.co.uk/blog/index.php/2008/04/11/configuring-ls_colors).
## Usage
**fs** functions are divided into four main categories:
* `path_` for manipulating and constructing paths
* `file_` for files
* `dir_` for directories
* `link_` for links
Directories and links are special types of files, so `file_` functions
will generally also work when applied to a directory or link.
```{r}
library(fs)
# Construct a path to a file with `path()`
path("foo", "bar", letters[1:3], ext = "txt")
# list files in the current directory
dir_ls()
# create a new directory
tmp <- dir_create(file_temp())
tmp
# create new files in that directory
file_create(path(tmp, "my-file.txt"))
dir_ls(tmp)
# remove files from the directory
file_delete(path(tmp, "my-file.txt"))
dir_ls(tmp)
# remove the directory
dir_delete(tmp)
```
**fs** is designed to work well with the pipe, though because it is a
minimal-dependency infrastructure package it doesn't provide the pipe itself.
You will need to attach [magrittr](https://magrittr.tidyverse.org) or similar.
```{r}
library(magrittr)
paths <- file_temp() |>
dir_create() |>
path(letters[1:5]) |>
file_create()
paths
paths |> file_delete()
```
**fs** functions also work well in conjunction with other
[tidyverse](https://www.tidyverse.org/) packages, like
[dplyr](https://dplyr.tidyverse.org) and [purrr](https://purrr.tidyverse.org).
Some examples...
```{r}
suppressMessages(
library(tidyverse))
```
Filter files by type, permission and size
```{r}
dir_info("src", recurse = FALSE) |>
filter(type == "file", permissions == "u+r", size > "10KB") |>
arrange(desc(size)) |>
select(path, permissions, size, modification_time)
```
Tabulate and display folder size.
```{r}
dir_info("src", recurse = TRUE) |>
group_by(directory = path_dir(path)) |>
tally(wt = size, sort = TRUE)
```
Read a collection of files into one data frame.
`dir_ls()` returns a named vector, so it can be used directly with
`purrr::map_df(.id)`.
```{r}
# Create separate files for each species
iris |>
(\(x) split(x, x$Species))() |>
map(select, -Species) |>
iwalk(\(.x, .y) write_tsv(.x, paste0(.y, ".tsv")))
# Show the files
iris_files <- dir_ls(glob = "*.tsv")
iris_files
# Read the data into a single table, including the filenames
iris_files |>
map_df(read_tsv, .id = "file", col_types = cols(), n_max = 2)
file_delete(iris_files)
```
## Feedback wanted!
We hope **fs** is a useful tool for both analysis scripts and packages.
Please open [GitHub issues](https://github.com/r-lib/fs) for any feature requests or bugs.
In particular, we have found non-ASCII filenames in non-English locales on
Windows to be especially tricky to reproduce and handle correctly. Feedback
from users who use commonly have this situation is greatly appreciated.
## Code of Conduct
Please note that the fs project is released with a
[Contributor Code of Conduct](https://fs.r-lib.org/dev/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.
Owner
- Name: R infrastructure
- Login: r-lib
- Kind: organization
- Repositories: 154
- Profile: https://github.com/r-lib
GitHub Events
Total
- Create event: 6
- Release event: 2
- Issues event: 29
- Watch event: 9
- Issue comment event: 57
- Push event: 76
- Pull request review event: 2
- Pull request event: 25
- Fork event: 3
Last Year
- Create event: 6
- Release event: 2
- Issues event: 29
- Watch event: 9
- Issue comment event: 57
- Push event: 76
- Pull request review event: 2
- Pull request event: 25
- Fork event: 3
Committers
Last synced: 8 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Ben Noordhuis | i****o@b****l | 1,165 |
| Jim Hester | j****r@g****m | 663 |
| Bert Belder | b****r@g****m | 644 |
| Saúl Ibarra Corretgé | s****l@g****m | 400 |
| Ryan Dahl | ry@t****g | 335 |
| Igor Zinkovsky | i****i@m****m | 136 |
| Gábor Csárdi | c****r@g****m | 131 |
| Fedor Indutny | f****y@g****m | 106 |
| cjihrig | c****g@g****m | 82 |
| Timothy J Fontaine | t****e@g****m | 69 |
| John Barboza | j****a@c****m | 42 |
| hadley | h****m@g****m | 33 |
| Santiago Gimeno | s****o@g****m | 29 |
| Andrius Bentkus | a****s@g****m | 28 |
| isaacs | i@i****e | 26 |
| Bartosz Sosnowski | b****z@j****m | 26 |
| Brad King | b****g@k****m | 21 |
| Erick Tryzelaar | e****r@g****m | 21 |
| Marc Schlaich | m****h@g****m | 18 |
| Henry Rawas | h****r@s****m | 15 |
| Alexis Campailla | a****s@j****m | 14 |
| Imran Iqbal | i****n@i****g | 14 |
| Frank Denis | g****b@p****g | 14 |
| Brian White | m****x@m****t | 14 |
| Maciej Małecki | m****i@n****g | 14 |
| Rasmus Christian Pedersen | z****n@y****m | 13 |
| Imran Iqbal | i****i@c****m | 13 |
| Charlie McConnell | c****e@c****m | 12 |
| Shigeki Ohtsu | o****u@i****p | 12 |
| Alex Crichton | a****x@a****m | 11 |
| and 344 more... | ||
Committer Domains (Top 20 + Academic)
microsoft.com: 6
ca.ibm.com: 4
janeasystems.com: 3
intel.com: 3
qq.com: 3
joyent.com: 3
rackspace.com: 2
apache.org: 2
uk.ibm.com: 2
in.ibm.com: 2
freebsd.org: 2
cpan.org: 2
debian.org: 2
gmx.de: 2
gmx.com: 2
me.com: 2
datastax.com: 2
bloomberg.net: 2
kelman.net: 1
vu.nl: 1
eurac.edu: 1
college.harvard.edu: 1
ieee.org: 1
mail.uc.edu: 1
mail.usf.edu: 1
eagle.fgcu.edu: 1
ualberta.ca: 1
vt.edu: 1
wustl.edu: 1
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 127
- Total pull requests: 61
- Average time to close issues: 10 months
- Average time to close pull requests: 11 months
- Total issue authors: 91
- Total pull request authors: 32
- Average comments per issue: 2.62
- Average comments per pull request: 1.59
- Merged pull requests: 48
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 19
- Pull requests: 12
- Average time to close issues: about 1 month
- Average time to close pull requests: 3 months
- Issue authors: 16
- Pull request authors: 5
- Average comments per issue: 1.63
- Average comments per pull request: 0.75
- Merged pull requests: 9
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- gaborcsardi (18)
- MichaelChirico (4)
- jennybc (4)
- jimhester (3)
- olivroy (3)
- DarwinAwardWinner (2)
- tentacles-from-outer-space (2)
- Moohan (2)
- heavywatal (2)
- mgirlich (2)
- cboettig (2)
- orgadish (2)
- sda030 (2)
- wch (2)
- siriusb-nox (1)
Pull Request Authors
- gaborcsardi (13)
- MichaelChirico (8)
- olivroy (8)
- IndrajeetPatil (7)
- jgaeb (2)
- jameslairdsmith (2)
- barracuda156 (2)
- Tazinho (2)
- ayappanec (2)
- cheungxi (2)
- jeroen (2)
- mgirlich (2)
- Moohan (2)
- tin900 (2)
- UchidaMizuki (2)
Top Labels
Issue Labels
bug (26)
feature (19)
upkeep (7)
help wanted :heart: (5)
reprex (5)
documentation (3)
good first issue :heart: (1)
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- cran 848,708 last-month
- Total docker downloads: 132,607,276
-
Total dependent packages: 284
(may contain duplicates) -
Total dependent repositories: 1,530
(may contain duplicates) - Total versions: 39
- Total maintainers: 1
cran.r-project.org: fs
Cross-Platform File System Operations Based on 'libuv'
- Homepage: https://fs.r-lib.org
- Documentation: http://cran.r-project.org/web/packages/fs/fs.pdf
- License: MIT + file LICENSE
-
Latest release: 1.6.6
published 10 months ago
Rankings
Downloads: 0.2%
Dependent repos count: 0.3%
Dependent packages count: 0.5%
Forks count: 0.9%
Stargazers count: 1.1%
Average: 3.4%
Docker downloads count: 17.3%
Maintainers (1)
Last synced:
6 months ago
conda-forge.org: r-fs
- Homepage: http://fs.r-lib.org
- License: MIT
-
Latest release: 1.5.2
published about 4 years ago
Rankings
Dependent packages count: 2.3%
Dependent repos count: 5.5%
Average: 12.5%
Stargazers count: 21.1%
Forks count: 21.1%
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.4 depends
- methods * imports
- covr * suggests
- crayon * suggests
- knitr * suggests
- pillar >= 1.0.0 suggests
- rmarkdown * suggests
- spelling * suggests
- testthat >= 3.0.0 suggests
- tibble >= 1.1.0 suggests
- vctrs >= 0.3.0 suggests
- withr * suggests
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml
actions
- JamesIves/github-pages-deploy-action 4.1.4 composite
- actions/checkout v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pr-commands.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/pr-fetch v2 composite
- r-lib/actions/pr-push v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml
actions
- actions/checkout v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/rhub.yaml
actions
- actions/checkout v3 composite
- r-hub/rhub2/actions/rhub-check v1 composite
- r-hub/rhub2/actions/rhub-setup v1 composite
- r-hub/rhub2/actions/rhub-setup-r v1 composite