https://github.com/konrad1991/rpointer
A small and very dangerous R package. You can create a vector on the heap from R. Therefore, three classes exist: bool, integer and numeric which create the memory during the construction. The memory is not automatically freed. You have to use the method delete in order to three the memory.
https://github.com/konrad1991/rpointer
c cpp pointer r rstats
Last synced: 9 months ago
JSON representation
A small and very dangerous R package. You can create a vector on the heap from R. Therefore, three classes exist: bool, integer and numeric which create the memory during the construction. The memory is not automatically freed. You have to use the method delete in order to three the memory.
- Host: GitHub
- URL: https://github.com/konrad1991/rpointer
- Owner: Konrad1991
- License: gpl-2.0
- Created: 2022-03-22T17:30:02.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-02-06T15:22:54.000Z (almost 3 years ago)
- Last Synced: 2025-02-08T22:25:29.558Z (11 months ago)
- Topics: c, cpp, pointer, r, rstats
- Language: C++
- Homepage:
- Size: 5.09 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# RPointer
A small and **very dangerous** R package. You can create a vector on the heap from R. Therefore, three classes exist: *bool*, *integer* and *numeric* which create the memory during the construction. The memory is not automatically freed. You have to use the method *delete* in order to three the memory. Furthermore, the following methods are implemented:
* size --> returns the size of the vector
* print --> prints vector elements on console
* [[ --> for indexing; Index starts at 0 not 1!
* resize --> for resizing the vector
```R
# Installation:
remotes::install_github("konrad1991/RPointer")
# bool values
b <- bools$new(10)
b$print()
b$delete()
# integer vector
i <- integer$new(5)
i[[1]] <- 2
i$print()
i$resize(4)
i$print()
i$delete()
# double vector
d <- numeric$new(6)
d[[1]] <- 4
d[[2]] <- d[[1]]*5
d$print()
d$delete()
```