gcdata: R Data Transform to Python Data

Description Usage Arguments Author(s) Examples

View source: R/gcForest.R

Description

A function to tansform R data structure to Python data structure, which based on the reticulate package.

Usage

1
gcdata(x)

Arguments

x

The R project like data.frame,vector, array etc..

Author(s)

Xu Jing

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
have_numpy <- reticulate::py_module_available("numpy")
have_sklearn <- reticulate::py_module_available("sklearn")

if(have_numpy && have_sklearn){

    library(gcForest)
    req_py()

    r_dat <- data.frame('x1'=c(1L,2L,3L),'x2'=c(2L,3L,4L))
    py_dat <- gcdata(r_dat)
    class(py_dat)

    r_vec <- c('a','b','c')
    py_vec <- gcdata(r_vec)
    class(py_vec)
}else{
    print('You should have the Python testing environment!')
}

gcForest documentation built on May 2, 2019, 5:40 a.m.