Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

TKS AI Workshop May 2018

Views: 65
Kernel: R (R-Project)

Workshop Code

#this notebook will demonstrate how to run the analysis on this dataset #install.packages("corrplot") library("corrplot") #read the dataset data <- read.delim("./data 2.csv", #the file you are trying to read header=T, #does the file include a header row? sep=',' #what is the delimiter? ) #remove the NA column data <- subset(data, #the dataset you are trying to subset select=-X #what you are trying to subset. By placing a a negative infront of the variable name, the variable will be excluded ) #change the label to factor data$diagnosis <- as.factor(data$diagnosis) #assess correlation options(repr.plot.width = 8, repr.plot.height = 6) corrplot <- cor(data[,3:ncol(data)]) corrplot(corrplot, # add comment order = "hclust", # add comment tl.cex = 1, #add comment addrect = 8 #add comment )
Image in a Jupyter notebook
# plotting the tree library("party") x <- ctree(data$diagnosis ~ ., data=data ) #change the size of the plot options(repr.plot.width = 10, repr.plot.height = 8) plot(x, labels=FALSE, terminal_panel=node_barplot(x, beside=FALSE, col="black", fill=c("coral4", "chartreuse4"), id=FALSE ) )
Loading required package: grid Loading required package: mvtnorm Loading required package: modeltools Loading required package: stats4 Loading required package: strucchange Loading required package: zoo Attaching package: ‘zoo’ The following objects are masked from ‘package:base’: as.Date, as.Date.numeric Loading required package: sandwich
Image in a Jupyter notebook
#modelling