njeru
njeru

Reputation: 89

How does one correctly import data into h2o client in R?

I am trying to upload csv into h20 server from a client running n R from the RStudio. This is how it looks like:

library(dplyr)
library(ggplot2)
library(h2o)

localH2O = h2o.init(ip = "127.0.0.1", port = 54323)
market_data_file = system.file("extdata", "bank_customer_data.csv", package = "h2o")

market_data  = h2o.importFile(localH2O, path = market_data_file, key = "market_data")

class(market_data)

summary(market_data)

The output on the console shows the following read out:

market_data_file = system.file("extdata", "bank_customer_data.csv", package = "h2o")

market_data = h2o.importFile(localH2O, path = market_data_file, key = "market_data") Error in h2o.importFile(localH2O, path = market_data_file, key = "market_data") : unused argument (key = "market_data")

class(market_data) Error: object 'market_data' not found

summary(market_data) Error in summary(market_data) : object 'market_data' not found

Is there anything am doing wrong?

Upvotes: 0

Views: 587

Answers (1)

Lauren
Lauren

Reputation: 5778

key is not a parameter in h2o.importFile, which is why you are getting the unused argument error. Here are the current parameters

  h2o.importFile(path, destination_frame = "", parse = TRUE, header = NA,
  sep = "", col.names = NULL, col.types = NULL, na.strings = NULL,
  decrypt_tool = NULL)

all of which is explained in the docs

As others have noted in the comments "bank_customer_data.csv" doesn't exist in the h2o package which is why system.file is not returning anything.

You should try to import a file you know exists using the process you have above, and see if that works for you. Otherwise if you want to use a dataset in the R package take a look at an example in the R docs for example

h2o.init(ip = "localhost", port = 54321, startH2O = TRUE)
prosPath = system.file("extdata", "prostate.csv", package = "h2o")
prostate.hex = h2o.importFile(path = prosPath, destination_frame = "prostate.hex")
class(prostate.hex)
summary(prostate.hex)

Upvotes: 2

Related Questions