說明:
此函數計算給定 SparkR 列的直方圖。
用法:
## S4 method for signature 'SparkDataFrame,characterOrColumn'
histogram(df, col, nbins = 10)
參數:
df
SparkDataFrame 包含要從中構建直方圖的 Column。col
列作為字符串或用於構建直方圖的列。nbins
箱子的數量(可選)。默認值為 10。
返回:
具有直方圖統計信息的 data.frame,即計數和質心。
注意:
自 2.0.0 以來的直方圖
例子:
# Create a SparkDataFrame from the Iris dataset
irisDF <- createDataFrame(iris)
# Compute histogram statistics
histStats <- histogram(irisDF, irisDF$Sepal_Length, nbins = 12)
# Once SparkR has computed the histogram statistics, the histogram can be
# rendered using the ggplot2 library:
require(ggplot2)
plot <- ggplot(histStats, aes(x = centroids, y = counts)) +
geom_bar(stat = "identity") +
xlab("Sepal_Length") + ylab("Frequency")
相關用法
- R SparkR hint用法及代碼示例
- R SparkR hashCode用法及代碼示例
- R SparkR head用法及代碼示例
- R matrix轉list用法及代碼示例
- R SparkR freqItems用法及代碼示例
- R SparkR intersectAll用法及代碼示例
- R SparkR spark.decisionTree用法及代碼示例
- R SparkR sparkR.callJMethod用法及代碼示例
- R SparkR sample用法及代碼示例
- R SparkR approxQuantile用法及代碼示例
- R SparkR glm用法及代碼示例
- R SparkR randomSplit用法及代碼示例
- R SparkR describe用法及代碼示例
- R SparkR withColumn用法及代碼示例
- R SparkR read.stream用法及代碼示例
- R SparkR join用法及代碼示例
- R SparkR rbind用法及代碼示例
- R SparkR windowPartitionBy用法及代碼示例
- R SparkR count用法及代碼示例
- R SparkR column用法及代碼示例
注:本文由純淨天空篩選整理自spark.apache.org大神的英文原創作品 Compute histogram statistics for given column。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。