@@ -4109,6 +4109,7 @@ use.package <- function(package,
4109
4109
# '
4110
4110
# ' @param x An \code{R} object.
4111
4111
# ' @param destination_frame A string with the desired name for the H2OFrame
4112
+ # ' @param skipped_columns A list of integer containing columns to be skipped and not parsed into the final frame
4112
4113
# ' @param use_datatable allow usage of data.table
4113
4114
# ' @param \dots arguments passed to method arguments.
4114
4115
# ' @export
@@ -4135,15 +4136,19 @@ use.package <- function(package,
4135
4136
# ' stopifnot(is.h2o(m_hf), dim(m_hf) == dim(m))
4136
4137
# ' }
4137
4138
# ' }
4138
- as.h2o <- function (x , destination_frame = " " , ... ) {
4139
+ as.h2o <- function (x , destination_frame = " " , skipped_columns = NULL , ... ) {
4139
4140
.key.validate(destination_frame )
4140
- UseMethod(" as.h2o" )
4141
+ if (is.null(skipped_columns )) {
4142
+ UseMethod(" as.h2o" )
4143
+ } else {
4144
+ as.h2o.data.frame(x , destination_frame = destination_frame , skipped_columns = skipped_columns )
4145
+ }
4141
4146
}
4142
4147
4143
4148
# ' @rdname as.h2o
4144
4149
# ' @method as.h2o default
4145
4150
# ' @export
4146
- as.h2o.default <- function (x , destination_frame = " " , ... ) {
4151
+ as.h2o.default <- function (x , destination_frame = " " , skipped_columns = NULL , ... ) {
4147
4152
if ( destination_frame == " " ) {
4148
4153
subx <- destination_frame.guess(deparse(substitute(x )))
4149
4154
destination_frame <- .key.make(if (nzchar(subx )) subx else paste0(class(x ), " _" , collapse = " " ))
@@ -4152,13 +4157,13 @@ as.h2o.default <- function(x, destination_frame="", ...) {
4152
4157
data.frame (C1 = x )
4153
4158
else
4154
4159
as.data.frame(x , ... )
4155
- as.h2o.data.frame(x , destination_frame = destination_frame )
4160
+ as.h2o.data.frame(x , destination_frame = destination_frame , skipped_columns = skipped_columns )
4156
4161
}
4157
4162
4158
4163
# ' @rdname as.h2o
4159
4164
# ' @method as.h2o H2OFrame
4160
4165
# ' @export
4161
- as.h2o.H2OFrame <- function (x , destination_frame = " " , ... ) {
4166
+ as.h2o.H2OFrame <- function (x , destination_frame = " " , skipped_columns = NULL , ... ) {
4162
4167
if ( destination_frame == " " ) {
4163
4168
subx <- destination_frame.guess(deparse(substitute(x )))
4164
4169
destination_frame <- .key.make(if (nzchar(subx )) subx else " H2OFrame_copy" )
@@ -4173,7 +4178,7 @@ as.h2o.H2OFrame <- function(x, destination_frame="", ...) {
4173
4178
# ' @seealso \code{\link{use.package}}
4174
4179
# ' @references \url{https://h2o.ai/blog/2016/fast-csv-writing-for-r/}
4175
4180
# ' @export
4176
- as.h2o.data.frame <- function (x , destination_frame = " " , use_datatable = TRUE , ... ) {
4181
+ as.h2o.data.frame <- function (x , destination_frame = " " , skipped_columns = NULL , use_datatable = TRUE , ... ) {
4177
4182
if ( destination_frame == " " ) {
4178
4183
subx <- destination_frame.guess(deparse(substitute(x )))
4179
4184
destination_frame <- .key.make(if (nzchar(subx )) subx else " data.frame" )
@@ -4203,7 +4208,8 @@ as.h2o.data.frame <- function(x, destination_frame="", use_datatable=TRUE, ...)
4203
4208
if (verbose ) cat(sprintf(" writing csv to disk using '%s' took %.2fs\n " , fun , proc.time()[[3 ]]- pt ))
4204
4209
# if (verbose) pt <- proc.time()[[3]] # timings inside
4205
4210
h2f <- h2o.uploadFile(tmpf , destination_frame = destination_frame , header = TRUE , col.types = types ,
4206
- col.names = colnames(x , do.NULL = FALSE , prefix = " C" ), na.strings = rep(c(" NA_h2o" ),ncol(x )))
4211
+ col.names = colnames(x , do.NULL = FALSE , prefix = " C" ), na.strings = rep(c(" NA_h2o" ),ncol(x )),
4212
+ skipped_columns = skipped_columns )
4207
4213
# if (verbose) cat(sprintf("uploading csv to h2o using 'h2o.uploadFile' took %.2fs\n", proc.time()[[3]]-pt))
4208
4214
file.remove(tmpf )
4209
4215
h2f
@@ -4215,7 +4221,7 @@ as.h2o.data.frame <- function(x, destination_frame="", use_datatable=TRUE, ...)
4215
4221
# ' To speedup execution time for large sparse matrices, use h2o datatable. Make sure you have installed and imported data.table and slam packages.
4216
4222
# ' Turn on h2o datatable by options("h2o.use.data.table"=TRUE)
4217
4223
# ' @export
4218
- as.h2o.Matrix <- function (x , destination_frame = " " , use_datatable = TRUE , ... ) {
4224
+ as.h2o.Matrix <- function (x , destination_frame = " " , skipped_columns = NULL , use_datatable = TRUE , ... ) {
4219
4225
if ( destination_frame == " " ) {
4220
4226
subx <- destination_frame.guess(deparse(substitute(x )))
4221
4227
destination_frame <- .key.make(if (nzchar(subx )) subx else " Matrix" )
0 commit comments