diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5b6a065 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.Rproj.user +.Rhistory +.RData +.Ruserdata diff --git a/Class 4 - Swirl.Rproj b/Class 4 - Swirl.Rproj new file mode 100644 index 0000000..8e3c2eb --- /dev/null +++ b/Class 4 - Swirl.Rproj @@ -0,0 +1,13 @@ +Version: 1.0 + +RestoreWorkspace: Default +SaveWorkspace: Default +AlwaysSaveHistory: Default + +EnableCodeIndexing: Yes +UseSpacesForTab: Yes +NumSpacesForTab: 2 +Encoding: UTF-8 + +RnwWeave: Sweave +LaTeX: pdfLaTeX diff --git a/addPatt.R b/addPatt.R new file mode 100644 index 0000000..dcca0ae --- /dev/null +++ b/addPatt.R @@ -0,0 +1,9 @@ +set.seed(678910) +for(i in 1:40){ + # flip a coin + coinFlip <- rbinom(1,size=1,prob=0.5) + # if coin is heads add a common pattern to that row + if(coinFlip){ + dataMatrix[i,] <- dataMatrix[i,] + rep(c(0,3),each=5) + } +} \ No newline at end of file diff --git a/lesson1.csv b/lesson1.csv new file mode 100644 index 0000000..20ec91a --- /dev/null +++ b/lesson1.csv @@ -0,0 +1,101 @@ +"time","answer","id" +"1474557687574","install.packages(swirl)","Linh Doan" +"1474557711359","library (swirl)","Linh Doan" +"1474557759960","swirl()","Linh Doan" +"1474558147506","swirl()","Linh Doan" +"1474558225892","data.matrix()","Linh Doan" +"1474558251139","View(dataMatrix)","Linh Doan" +"1474558268641","head(dataMatrix)","Linh Doan" +"1474558350845","heatmap()","Linh Doan" +"1474558387616","heatmap(dataMatrix)","Linh Doan" +"1474558439617","myedit addPatt.R","Linh Doan" +"1474558456224","myedit (addPatt.R)","Linh Doan" +"1474558473610","addPatt.R","Linh Doan" +"1474558512036","info()","Linh Doan" +"1474558542075","bye()","Linh Doan" +"1474558548301","swirl()","Linh Doan" +"1474558584844","menu()","Linh Doan" +"1474558589221","info()","Linh Doan" +"1474558591644","main()","Linh Doan" +"1474558597554","main()","Linh Doan" +"1474558602775","next()","Linh Doan" +"1474558606606","bye()","Linh Doan" +"1474558634698","swirl()","Linh Doan" +"1474558673034","bye()","Linh Doan" +"1474558677487","swirl()","Linh Doan" +"1474558836086","?Devices","Linh Doan" +"1474558914812","faithful eruptions waiting","Linh Doan" +"1474558941363","faithful eruptions","Linh Doan" +"1474558991643","head(faithful)","Linh Doan" +"1474559018465","plot(faithful,eruptions)","Linh Doan" +"1474559068855","with(faithful, plot(eruptions, waiting))","Linh Doan" +"1474559095265","nxt()","Linh Doan" +"1474559142429","title(main= Old Faith Ful Geyser data)","Linh Doan" +"1474559148408","title(main= Old Faith Ful Geyser data"") +1474559167164:tile +1474559194643:bye() +1474559200210:bye +1474559216172:end +1474559242207:title(main= Old Faith Ful Geyser data) +1474559262294:title(main= Old Faith Ful Geyser data) +1474559279561:title(main = Old Faithful Geyser data) +1474559288119:dev.cur() +1474559317965:pdf(file=myplot.pdf) +1474559367839:pdf(file=myplot.pdf) +1474559412760:with(faithful,plot(eruptions,waiting)) +1474559446620:title(main = Old Faithful) +1474559458830:title(main = Old Faith Ful Geyser data) +1474559473048:title(main = Old Faithful Geyser data) +1474559517781:dev.cur() +1474559525453:dev.off() +1474559536600:dev.cur() +1474559574322:with(faithful, plot(eruptions,waiting)) +1474559606366:title(main = Old Faithfil Geyser data) +1474559618470:title(main = Old Faithful Geyser data) +1474559677804:dev.copy(png, geyserplot.png) +1474559689674:dev.copy(png, file = geyserplot.png) +1474559710435:dev.off() +1474559858117:bye() +1474559923749:H <-read.table(~/.rstudio-desktop/history_database, sep=","Linh Doan" +", fill=T, stringsAsFactors=F) +1474559923761:names(H) <- c(time, answer) +1474559923762:H$id <- Linh Doan +1474559923763:write.csv(H, file = lesson1.csv, row.names = FALSE) +1474560152708:library(swirl) +1474560185231:swirl() +1474560247228:install_course(R Programming) +1474560258447:swirl() +1474560326813:TRUE == TRUE +1474560355618:(FALSE == TRUE) == FALSE +1474560396924:(6==7)=FALSE +1474560411030:6 == 7 +1474560424087:6 < 7 +1474560436598:10<=10 +1474560478137:5 != 7 +1474560548036:(5 != 7) == !FALSE +1474560566962:! 5 == 7 +1474560670480:FALSE & FALSE +1474560699438:TRUE & c(TRUE,FALSE, FALSE). +1474560718655:TRUE & c(TRUE,FALSE,FALSE) +1474560747198:TRUE && c(TRUE, FALSE, FALSE) +1474560872332:TRUE | c(TRUE,FALSE,FALSE) +1474560903189:TRUE || c(TRUE, FALSE, FALSE) +1474560953044:5 > 8 || 6 != 8 && 4 > 3.9 +1474561227615:isTRUE(6>4) +1474561373842:identical('twins', 'twins') +1474561525790:xor(5 == 6, !FALSE) +1474561644348:ints<- sample(10) +1474561659275:display(ints) +1474561677796:display() +1474561696601:display (ints) +1474561705361:ints +1474561743262:ints > 5 +1474562208491:which (ints > 7) +1474562247007:bye() +1474562292836:H <-read.table(~/.rstudio-desktop/history_database, sep=",", fill=T, stringsAsFactors=F) +1474562292849:names(H) <- c(time, answer) +1474562292849:H$id <- Linh Doan +1474562292850:write.csv(H, file = lesson1.csv, row.names = FALSE) +1474562855700:H <-read.table(~/.rstudio-desktop/history_database, sep=","Linh Doan" +", fill=T, stringsAsFactors=F) +","","Linh Doan" diff --git a/myplot.pdf b/myplot.pdf new file mode 100644 index 0000000..bb02961 Binary files /dev/null and b/myplot.pdf differ