Difference between revisions of "R: data"

From OnnoWiki
Jump to navigation Jump to search
(Created page with " data() # Loading data(mtcars) # Print the first 6 rows head(mtcars, 6) # 1. Loading data("mtcars") # 2. Print head(mtcars) summary(mtcars) # Number of rows (obs...")
 
 
(7 intermediate revisions by the same user not shown)
Line 14: Line 14:
 
  # Number of rows (observations)
 
  # Number of rows (observations)
 
  nrow(mtcars)
 
  nrow(mtcars)
 
 
  # Number of columns (variables)
 
  # Number of columns (variables)
 
  ncol(mtcars)
 
  ncol(mtcars)
 +
 +
 +
data("iris")
 +
head(iris)
 +
 +
data("ToothGrowth")
 +
head(ToothGrowth)
 +
 +
data("PlantGrowth")
 +
head(PlantGrowth)
 +
 +
data("USArrests")
 +
head(USArrests)
 +
 +
 +
==Basic R Functions==
 +
 +
data(mtcars)
 +
summary(mtcars)
 +
quantile(mtcars$cyl,seq(0,1,.1)) # here seq gives
 +
fivenum(mtcars$cyl)
 +
sd(mtcars$cyl)
 +
var(mtcars$cyl)
 +
range(mtcars$cyl)
 +
 +
mad(mtcars$cyl)
 +
IQR(mtcars$cyl)
 +
 +
# skewcoeff(mtcars$cyl)
 +
# skewcoeff(mtcars$cyl)
 +
 +
 +
==Pranala Menarik==
 +
 +
* [[R]]

Latest revision as of 10:28, 28 November 2019

data()
# Loading
data(mtcars)
# Print the first 6 rows
head(mtcars, 6)
# 1. Loading 
data("mtcars")
# 2. Print
head(mtcars)
summary(mtcars)
# Number of rows (observations)
nrow(mtcars)
# Number of columns (variables)
ncol(mtcars)


data("iris")
head(iris)
data("ToothGrowth")
head(ToothGrowth)
data("PlantGrowth")
head(PlantGrowth)
data("USArrests")
head(USArrests)


Basic R Functions

data(mtcars)
summary(mtcars)
quantile(mtcars$cyl,seq(0,1,.1)) # here seq gives
fivenum(mtcars$cyl)
sd(mtcars$cyl)
var(mtcars$cyl)
range(mtcars$cyl)
mad(mtcars$cyl)
IQR(mtcars$cyl)
# skewcoeff(mtcars$cyl)
# skewcoeff(mtcars$cyl)


Pranala Menarik