Quantcast
Channel: All Developer posts
Viewing all articles
Browse latest Browse all 48084

Re: R Control Chart

$
0
0

Here's is an example of creating a histogram with a density distribution line.

 

hist(dataset$Age, 
     main = "Customer Count by Age",
     ylab="Customer Count", 
     xlab="Customer Age",
     xlim = c(18, 100),
     border="black",
     breaks=20,
     col=c("lightyellow", "lightblue"), 
     las=1,
     probability = TRUE
)

lines(density(dataset$Age),lty="dotdash", lwd=4, col="red")

Here's an example of creating a barblot

 

barplot(dataset$'Sales Revenue',        
        names.arg = dataset$'Age Group', 
        main = "Sales Revenue by Customer Age Group",
        col = c("red","yellow","orange","blue", "green")
)

minValue <- 0
maxValue <- max(as.vector(dataset$'Sales Revenue'))
yTicks <- seq(from=minValue, to = maxValue, length.out = 10)
yTicks <- pretty(yTicks)
yTickLabels <- paste("$",format(yTicks/1000, , big.mark=","), "K",sep="")
axis(2, at=yTicks, labels = yTickLabels, lty = 1, las=1, cex.axis=0.7 )

Of course, these are simple examples using the built-in R graphics functionality. You can also use a richer graphics package such as lattice or ggplot2 to create some really detailed charts and graphs.

 

Is this what you are looking for?


Viewing all articles
Browse latest Browse all 48084

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>