SparkR中的NCHAR替代方案

问题描述 投票:0回答:1

我需要计算一个字符串中的字符数,在R中我们使用ncharsparkR中的替代函数是什么

r apache-spark sparkr
1个回答
2
投票

使用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
© www.soinside.com 2019 - 2024. All rights reserved.