Assignment : babu<- c(3,5,7,9)
Accessing variables:
babu[1] [1] 3 > babu[0] numeric(0)
Data types: list, double,character,integer
String example : b <- c("hello","there")
Logiical: a = TRUE
Converting character to integer = factor
Getting the current directory: getwd()
tree <- read.csv(file="trees91.csv",header=TRUE,sep=",");
names(tree); summary(tree); tree[1]; tree$C
Listing all variables: ls()
Type of variables: typeof(babu),typeof(list)
Arithmetic functions: mean(babu)
Converting array into table: table()
While importing you can define: NA
na.strings = c("NA", "#DIV/0!", ""))
input<- read.csv("pml-training.csv", na.strings = c("NA", "#DIV/0!", ""))
Standardization is done by :
standardhousing <-(housing$Home.Value- mean(housing$Home.Value))/(sd(housing$Home.Value))
boxplot(tree$STBM
ggplot(tree,aes(x=LFBM, y=STBM)) +geom_point()
ggplot(tree,aes(x=LFBM, y=STBM)) +geom_point(aes(color=LFBM))
ggplot(tree,aes(x=LFBM, y=STBM)) +geom_point(aes(color=LFBM)) +geom_smooth()
housing <- read.csv(“landdata-states.csv”)
fancyline<- ggplot(housing, aes(x = Date, y = Home.Value))
fancyline + geom_line(aes(color=State))
The same can be achieved by : qplot(Date,Home.Value,color=State,data=housing)
fancyline<-fancyline +geom_line()+ facet_wrap(~State,ncol=10)
dtree_fit <- train(V7 ~., data = training, method = "rpart"
## Confusion Matrix and Statistics
##
## Reference
## Prediction 0 1
## 0 506 88
## 1 43 254
##
## Accuracy : 0.853
## 95% CI : (0.828, 0.8756)
## No Information Rate : 0.6162
## P-Value [Acc > NIR] : < 2.2e-16
##
## Kappa : 0.6813
## Mcnemar's Test P-Value : 0.0001209
##
## Sensitivity : 0.9217
## Specificity : 0.7427
## Pos Pred Value : 0.8519
## Neg Pred Value : 0.8552
## Prevalence : 0.6162
## Detection Rate : 0.5679
## Detection Prevalence : 0.6667
## Balanced Accuracy : 0.8322
##
## 'Positive' Class : 0