Skip to content

Commit

Permalink
Merge pull request #37 from JuliaStats/expand_readme
Browse files Browse the repository at this point in the history
Expand README.md
  • Loading branch information
alyst committed Dec 5, 2017
2 parents 7e17dcf + a15e600 commit 4abc967
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions README.md
@@ -1,4 +1,4 @@
# RData
# RData.jl

[![Julia 0.6 Status](http://pkg.julialang.org/badges/RData_0.6.svg)](http://pkg.julialang.org/?pkg=RData&ver=0.6)

Expand All @@ -10,6 +10,16 @@ Read R data files (.rda, .RData) and optionally convert the contents into Julia

Can read any R data archive, although not all R types could be converted into Julia.

For running R code from Julia see [RCall.jl](https://github.com/JuliaInterop/RCall.jl).

Installation
------------

From Julia REPL:
```julia
Pkg.add("RData")
```

Usage
-----

Expand All @@ -20,13 +30,16 @@ using RData
objs = load("path_to/example.rda")
```

The result is a dictionary of all R objects that are stored in "example.rda".
The result is a dictionary (`Dict{String, Any}`) of all R objects stored in "example.rda".

If `convert=true` keyword option is specified, `load()` will try to automatically
convert R objects into Julia equivalents:
* data frames into `DataFrames.DataFrame`
* named vectors into `DictoVec` objects that allow indexing both by element indices and by names
* ...

If the conversion to Julia type is not supported (e.g. R closure or language expression),
the internal RData representation of the object will be provided.
| R object | Julia object | |
|--------------|------------------------|--|
| named vector, list | `DictoVec` | `DictoVec` allows indexing both by element index and by its name, just as R vectors and lists |
| vector | `Vector{T}` | `T` is the appropriate Julia type. If R vector contains `NA` values, they are converted to [`missing`](https://github.com/JuliaData/Missings.jl), and the elements type of the resulting `Vector` is `Union{T, Missing}`.
| factor | `CategoricalArray` | [CategoricalArrays.jl](https://github.com/JuliaData/CategoricalArrays.jl) |
| data frame | `DataFrame` | [DataFrames.jl](https://github.com/JuliaData/DataFrames.jl) |

If conversion to the Julia type is not supported (e.g. R closure or language expression), `load()` will return the internal RData representation of the object (`RSEXPREC` subtype).

0 comments on commit 4abc967

Please sign in to comment.