<jupyter_start><jupyter_text>Intro Welcomereference: Grammar of Graphics (Wilkinson, 2005)ggplot works in a layered fashionother reference- Introductory Statistics with R- Data Manipulation with R Other resources- [official website](http://had.co.nz/ggplot2)- [documentation](https://ggplot2.tidyverse.org/reference/)- [ggplot2: Elegant Graphics for Data Analysis](https://ggplot2-book.org/)- [cookbook](https://r-graphics.org/) Grammar of Graphics- data- mappings- geometric objects- statistical transformation- scales- coordinate system- faceting/conditioning/latticing/trellsing systempackage GGobi, for interactive graphs ggplot2`install.package("ggplot2")`, or use conda from Anaconda1. set up a new environment with R ticked (tick Python if you want)2. search package ggplot2, tick in the front box3. click "Apply" to apply the change4. Yes and then it's done  Quick startfrom Mitchell from [datasciencecentral blog](https://www.datasciencecentral.com/profiles/blogs/r-tutorial-for-beginners-a-quick-start-up-kit), bug fixed<jupyter_code># use fileEncoding = 'UTF-8-BOM' to skip the BOM start of your text file (windows users 😂)
# MS Excel will also help
read.csv("./assets/mydata.csv", fileEncoding = 'UTF-8-BOM')
data <- read.csv("./assets/mydata.csv", fileEncoding = 'UTF-8-BOM')
oz <- data$Ozone ## pulled out Ozone column of our data into a vector
oz
badoz <- is.na(oz) ## pulled na's from column
badoz
oz[!badoz] ## found index where by all that's not NA
## NAs are kicked out
mean(oz[!badoz])
summary(oz[!badoz])
myY <- subset(data, (Ozone > 31 & Temp > 90))
myY
mM <- subset(data, Month==5) ##find subset month of May
mM
getdata <- function(id, directory, summarize=FALSE, FileEncoding='UTF-8-BOM') {
    filelist <- dir(directory);
    file <- paste(directory,filelist,sep='/')
    data <- read.csv(file, fileEncoding = FileEncoding)
    if(summarize == "TRUE") {
        mySum <- summary(data)
        print(mySum)
    }
    return(data)
}

getdata("mydata.csv", "assets", TRUE)
summary(data)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13150147203140333, 'fraction_numerical': 0.011776251226692836, 'mean_word_length': 4.727528089887641, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '329049', 'license': 'MIT', 'n_tokens_mistral': 691, 'n_tokens_neox': 645, 'n_words': 198, 'path': 'Probability and Statistics/Statistics/R/Elegant Graphics for Data Analysis/Chap01_Introduction.ipynb', 'repo_name': 'XavierOwen/Notes', 'size': '2038'}