dropna {SparkR} | R Documentation |
Returns a new SparkDataFrame omitting rows with null values.
Replace null values.
## S4 method for signature 'SparkDataFrame' dropna(x, how = c("any", "all"), minNonNulls = NULL, cols = NULL) ## S4 method for signature 'SparkDataFrame' na.omit(object, how = c("any", "all"), minNonNulls = NULL, cols = NULL) ## S4 method for signature 'SparkDataFrame' fillna(x, value, cols = NULL) dropna(x, how = c("any", "all"), minNonNulls = NULL, cols = NULL) na.omit(object, ...) fillna(x, value, cols = NULL)
x |
A SparkDataFrame. |
how |
"any" or "all". if "any", drop a row if it contains any nulls. if "all", drop a row only if all its values are null. if minNonNulls is specified, how is ignored. |
minNonNulls |
If specified, drop rows that have less than minNonNulls non-null values. This overwrites the how parameter. |
cols |
Optional list of column names to consider. |
value |
Value to replace null values with. Should be an integer, numeric, character or named list. If the value is a named list, then cols is ignored and value must be a mapping from column name (character) to replacement value. The replacement value must be an integer, numeric or character. |
x |
A SparkDataFrame. |
cols |
optional list of column names to consider. Columns specified in cols that do not have matching data type are ignored. For example, if value is a character, and subset contains a non-character column, then the non-character column is simply ignored. |
A SparkDataFrame
Other SparkDataFrame functions: $
,
$<-
, select
,
select
,
select,SparkDataFrame,Column-method
,
select,SparkDataFrame,list-method
,
selectExpr
;
SparkDataFrame-class
,
dataFrame
; [
,
[[
, subset
;
agg
, agg
,
count,GroupedData-method
,
summarize
, summarize
;
arrange
, arrange
,
arrange
, orderBy
,
orderBy
, orderBy
,
orderBy
; as.data.frame
,
as.data.frame,SparkDataFrame-method
;
attach
,
attach,SparkDataFrame-method
;
cache
; collect
;
colnames
, colnames
,
colnames<-
, colnames<-
,
columns
, names
,
names<-
; coltypes
,
coltypes
, coltypes<-
,
coltypes<-
; columns
,
dtypes
, printSchema
,
schema
, schema
;
count
, nrow
;
dapply
, dapply
,
dapplyCollect
, dapplyCollect
;
describe
, describe
,
describe
, summary
,
summary
,
summary,AFTSurvivalRegressionModel-method
,
summary,GeneralizedLinearRegressionModel-method
,
summary,KMeansModel-method
,
summary,NaiveBayesModel-method
;
dim
; distinct
,
unique
; dropDuplicates
,
dropDuplicates
; drop
,
drop
; dtypes
;
except
, except
;
explain
, explain
;
filter
, filter
,
where
, where
;
first
, first
;
groupBy
, groupBy
,
group_by
, group_by
;
head
; histogram
;
insertInto
, insertInto
;
intersect
, intersect
;
isLocal
, isLocal
;
join
; limit
,
limit
; merge
,
merge
; mutate
,
mutate
, transform
,
transform
; ncol
;
persist
; printSchema
;
rbind
, rbind
,
unionAll
, unionAll
;
registerTempTable
,
registerTempTable
; rename
,
rename
, withColumnRenamed
,
withColumnRenamed
;
repartition
; sample
,
sample
, sample_frac
,
sample_frac
;
saveAsParquetFile
,
saveAsParquetFile
,
write.parquet
, write.parquet
;
saveAsTable
, saveAsTable
;
saveDF
, saveDF
,
write.df
, write.df
,
write.df
; selectExpr
;
showDF
, showDF
;
show
, show
,
show,GroupedData-method
,
show,WindowSpec-method
; str
;
take
; unpersist
;
withColumn
, withColumn
;
write.jdbc
, write.jdbc
;
write.json
, write.json
;
write.text
, write.text
## Not run: sc <- sparkR.init() sqlCtx <- sparkRSQL.init(sc) path <- "path/to/file.json" df <- read.json(sqlCtx, path) dropna(df) ## End(Not run) ## Not run: sc <- sparkR.init() sqlCtx <- sparkRSQL.init(sc) path <- "path/to/file.json" df <- read.json(sqlCtx, path) fillna(df, 1) fillna(df, list("age" = 20, "name" = "unknown")) ## End(Not run)