first {SparkR} | R Documentation |
Return the first row of a SparkDataFrame
Aggregate function: returns the first value in a group.
## S4 method for signature 'SparkDataFrame' first(x) ## S4 method for signature 'characterOrColumn' first(x, na.rm = FALSE)
x |
A SparkDataFrame |
The function by default returns the first values it sees. It will return the first non-missing value it sees when na.rm is set to true. If all values are missing, then NA is returned.
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
; dropna
,
dropna
, fillna
,
fillna
, na.omit
,
na.omit
; drop
,
drop
; dtypes
;
except
, except
;
explain
, explain
;
filter
, filter
,
where
, where
;
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
Other agg_funcs: agg
,
summarize
;
approxCountDistinct
,
approxCountDistinct
,
approxCountDistinct
; avg
,
avg
; countDistinct
,
countDistinct
, n_distinct
,
n_distinct
; count
,
n
, n
; kurtosis
,
kurtosis
; last
,
last
; max
;
mean
; min
; sd
,
sd
, stddev
,
stddev
; skewness
,
skewness
; stddev_pop
,
stddev_pop
; stddev_samp
,
stddev_samp
; sumDistinct
,
sumDistinct
; sum
;
var_pop
, var_pop
;
var_samp
, var_samp
;
var
, var
,
variance
, variance
## Not run: sc <- sparkR.init() sqlContext <- sparkRSQL.init(sc) path <- "path/to/file.json" df <- read.json(sqlContext, path) first(df) ## End(Not run) ## Not run: first(df$c) first(df$c, TRUE) ## End(Not run)