I need to count the number of characters in a string, in R
we use nchar
, what is the alternative function in sparkR
Use length
:
Welcome to
____ __
/ __/__ ___ _____/ /__
_\ \/ _ \/ _ `/ __/ '_/
/___/ .__/\_,_/_/ /_/\_\ version 2.2.1
/_/
SparkSession available as 'spark'.
> df <- createDataFrame(data.frame(s=c("foo", "foobar")))
> head(select(df, length(df$s)))
length(s)
1 3
2 6