Difference between revisions of "R: Menggunakan library CRAN"
Jump to navigation
Jump to search
Onnowpurbo (talk | contribs) |
Onnowpurbo (talk | contribs) |
||
| Line 4: | Line 4: | ||
library('txtplot') | library('txtplot') | ||
| − | + | Menggunakan datasets yang ada di txtplot | |
| + | |||
txtplot(cars[,1], cars[,2], xlab = "speed", ylab = "distance") | txtplot(cars[,1], cars[,2], xlab = "speed", ylab = "distance") | ||
| + | |||
| + | Help | ||
| + | |||
| + | help(txtplot) | ||
| + | |||
| + | Contoh program | ||
| + | |||
| + | ## basic plotting function | ||
| + | require(stats) | ||
| + | txtplot(cars[,1], cars[,2]) | ||
| + | ## can include axis labels when desired | ||
| + | txtplot(cars[,1], cars[,2], xlab = "speed", ylab = "distance") | ||
| + | |||
| + | ## text based density plot | ||
| + | txtdensity(rnorm(500)) | ||
| + | |||
| + | ## text based plotting of functions | ||
| + | txtcurve(x/(x+1), 0, 4, xlab = "Emax model") | ||
| + | |||
| + | ## text based acf | ||
| + | txtacf(rnorm(100)) | ||
| + | |||
| + | ## text based barchart | ||
| + | x <- factor(c("orange", "orange", "red", "green", "green", "red", | ||
| + | "yellow", "purple", "purple", "orange")) | ||
| + | txtbarchart(x) | ||
| + | |||
Revision as of 05:34, 28 October 2018
Menggunakan library, contoh (txtplot)
install.packages('txtplot')
library('txtplot')
Menggunakan datasets yang ada di txtplot
txtplot(cars[,1], cars[,2], xlab = "speed", ylab = "distance")
Help
help(txtplot)
Contoh program
## basic plotting function
require(stats)
txtplot(cars[,1], cars[,2])
## can include axis labels when desired
txtplot(cars[,1], cars[,2], xlab = "speed", ylab = "distance")
## text based density plot
txtdensity(rnorm(500))
## text based plotting of functions
txtcurve(x/(x+1), 0, 4, xlab = "Emax model")
## text based acf
txtacf(rnorm(100))
## text based barchart
x <- factor(c("orange", "orange", "red", "green", "green", "red",
"yellow", "purple", "purple", "orange"))
txtbarchart(x)