logo

How to Load a Built-in Dataset in R Used in Julia 📂Julia

How to Load a Built-in Dataset in R Used in Julia

Guide

Using the RDatasets.jl package should do the trick. The following is an example of how to load the simplest iris dataset. It includes a variety of datasets beyond the basic built-in ones, so make sure to check out GitHub1.

julia> using RDatasets

julia> iris = dataset("datasets", "iris")
150×5 DataFrame
 Row │ SepalLength  SepalWidth  PetalLength  PetalWidth  Species
     │ Float64      Float64     Float64      Float64     Cat…
─────┼─────────────────────────────────────────────────────────────
   1 │         5.1         3.5          1.4         0.2  setosa
   2 │         4.9         3.0          1.4         0.2  setosa
   3 │         4.7         3.2          1.3         0.2  setosa
  ⋮  │      ⋮           ⋮            ⋮           ⋮           ⋮
 149 │         6.2         3.4          5.4         2.3  virginica
 150 │         5.9         3.0          5.1         1.8  virginica
                                                   145 rows omitted

See Also

Environment

  • OS: Windows
  • julia: v1.6.3