溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

如何使用R語言在SAP Analytics Cloud里繪制各種統(tǒng)計圖表

發(fā)布時間:2021-11-22 16:07:42 來源:億速云 閱讀:170 作者:柒染 欄目:大數(shù)據(jù)

這期內(nèi)容當中小編將會給大家?guī)碛嘘P(guān)如何使用R語言在SAP Analytics Cloud里繪制各種統(tǒng)計圖表,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

插入一個R visualization:

如何使用R語言在SAP Analytics Cloud里繪制各種統(tǒng)計圖表

一定要確保圖形出現(xiàn)這個model的小圖標,代表這個R visualization的模型數(shù)據(jù)成功綁定之后才能進行下一步操作:

如何使用R語言在SAP Analytics Cloud里繪制各種統(tǒng)計圖表

模型綁定成功后,在R script編輯器Environment標簽頁的Data下拉菜單里能看到模型數(shù)據(jù)。

如何使用R語言在SAP Analytics Cloud里繪制各種統(tǒng)計圖表

使用這個SAP Analytics Cloud官方教程里提供的excel文件作為數(shù)據(jù)源:

https://www.rial-r-visualization/https://www.ontent/uploads/2019/09/R-Script-Plot.txt

# Discription:
# Creating a histogram of the log returns, adding the kernel density of the log returns
# and the normal density as reference distribution 
#
# Requirements: 
# ggplot requires a data frame
# 
# Output:
# Histogram Plot
# 
library(ggplot2)
Simulated_data <- data.frame(Simulated_data)
histgg <- ggplot(data = Simulated_data, aes(logreturns))
histgg + geom_histogram(aes(y = ..density..),fill = "lightblue",color = "black", alpha = 0.8, position = "identity") +
  geom_density(aes(color = "Kernel Density"), size = 1) +
  stat_function(aes(color = "Normal Distribution"), fun = dnorm, args = list(mean = mean(Simulated_data$logreturns), sd = sd(Simulated_data$logreturns)), size = 1) +
  ggtitle("Histogram") +
  theme(panel.grid = element_line(linetype = "dashed", color = "lightgrey"), panel.background = element_rect(fill = "white"),
        panel.border = element_rect(colour = "black", fill=NA),
        plot.title = element_text(hjust = 0.5)) +
  scale_colour_manual("Density", values = c("red", "darkgreen")) +
  xlab(" ")+
  ylab("Frequency")

點擊Execute按鈕,就可以看到R腳本繪制出來的圖形了:

如何使用R語言在SAP Analytics Cloud里繪制各種統(tǒng)計圖表

上述就是小編為大家分享的如何使用R語言在SAP Analytics Cloud里繪制各種統(tǒng)計圖表了,如果剛好有類似的疑惑,不妨參照上述分析進行理解。如果想知道更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI