Learn R Programming

gcForest (version 0.2.7)

gcdata: R Data Transform to Python Data

Description

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

Usage

gcdata(x)

Arguments

x

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

Examples

Run this code
# NOT RUN {
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!')
}


# }

Run the code above in your browser using DataLab