Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/privefl/mmapcharr
Memory-map text files of characters as R matrices
https://github.com/privefl/mmapcharr
Last synced: 3 months ago
JSON representation
Memory-map text files of characters as R matrices
- Host: GitHub
- URL: https://github.com/privefl/mmapcharr
- Owner: privefl
- Created: 2017-12-07T09:08:59.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-02-26T09:12:01.000Z (almost 6 years ago)
- Last Synced: 2024-10-27T04:38:35.157Z (4 months ago)
- Language: R
- Size: 2.72 MB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.org/privefl/mmapcharr)
[](https://ci.appveyor.com/project/privefl/mmapcharr)
[](https://codecov.io/github/privefl/mmapcharr?branch=master)
[](https://cran.r-project.org/package=mmapcharr)# mmapcharr
Memory-map text files of characters.
## Installation
```r
# For the CRAN version
install.packages("mmapcharr")# For the current development version
devtools::install_github("privefl/mmapcharr")
```## Input format
As inputs, package **mmapcharr** uses text files of characters separated by another character.
Lines should be the same so that the file can be viewed as a matrix.
Files should end up with an empty line.You can play with the `code` parameter to access whatever you want instead of characters (see the example code below).

You can access files in such shape the same way as for R(cpp) matrices.
## Example code
```r
library(mmapcharr)test_file <- system.file("testdata/test-windows.txt", package = "mmapcharr")
readLines(test_file)# Create the memory-mapping object based on the text file
test <- mmapchar(test_file, code = mmapcharr:::CODE_012)
test[]
test[, 1:10]# Underlying characters
(CHAR256 <- rawToChar(as.raw(0:255), multiple = TRUE))# Change the code to access true characters
test2 <- test$copy(code = CHAR256)
test2[, 1:10]# Change the code to access logicals (why not?)
test3 <- test$copy(code = rep(c(TRUE, FALSE), 256 / 2))
test3[, 1:10]
```## Bug report / Help
Please open an issue if you find a bug.