This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library("googlesheets") | |
| suppressPackageStartupMessages(library("dplyr")) | |
| gs_auth() #authorizes through browser | |
| #register the spreadsheet and the show it to be sure it worked | |
| urlForWt <- "<<add url for google sheet>>" | |
| test <- gs_url(urlForWt) | |
| test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| iris <- read.csv(url("http://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data"), header = FALSE) | |
| View(iris) | |
| names(iris) <- c("Sepal.Length", "Sepal.Width", "Petal.Length", "Petal.Width", "Species") | |
| library(ggvis) | |
| iris %>% ggvis(~Sepal.Length, ~Sepal.Width, fill = ~Species) %>% layer_points() | |
| iris %>% ggvis(~Petal.Length, ~Petal.Width, fill = ~Species) %>% layer_points() | |
| prop.table(table(iris$Species)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setwd("~/R/harjottelut/prostate cancer") | |
| library(class) | |
| library(gmodels) | |
| prc <- read.csv("Prostate_Cancer.csv", stringsAsFactors = FALSE) | |
| #str(prc) | |
| prc <- prc[-1] | |
| #View(prc) | |
| #table(prc$diagnosis_result) | |
| prc$diagnosis_result <- factor(prc$diagnosis_result, levels = c("B", "M"), labels = c("Benign", "Malignant")) |