forked from jackyzha0/quartz
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Affected files: content/notes/university/cs3002-lab1.md content/notes/university/year-3.md content/notes/university/year3/cs3001/cs3001.md content/notes/university/year3/cs3002/cs3002-lab1.md content/notes/university/year3/cs3002/cs3002.md content/notes/university/year3/cs3003/cs3003.md content/notes/university/year3/cs3072/fyp-supervisor.md content/notes/university/year3/cs3609/cs3609.md content/templates/template-university.md
- Loading branch information
1 parent
db4c745
commit 3e16170
Showing
9 changed files
with
90 additions
and
39 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
--- | ||
title: "CS3002 - Introduction to R" | ||
tags: | ||
- university | ||
module: cs3002 | ||
lecturer: 'Allan Tucker' | ||
created: 2023-09-12 | ||
type: lab | ||
year: '3' | ||
--- | ||
--- | ||
The lab sheet can be found [here](assets/university/year3/R_IntroLab_v3.pdf). | ||
|
||
## Notes | ||
- R is **case-sensitive**, so `view` doesn't work but `View` does. | ||
- To create scatterplots: | ||
- Column name: | ||
- `plot(mydata$column1, mydata$column2)` | ||
- Column location: | ||
- `plot(mydata[,9], mydata[,11])` | ||
- Histogram: | ||
- `hist(mydata$temp)` | ||
- Line plot: | ||
- `plot(mydata$temp, type="l")` | ||
- Plot colours, for example X and Y according to temperature: | ||
- `plot(mydata$X, mydata$Y, col=mydata$temp)` | ||
- Statistics: | ||
- Mean, median, maximum and minimum: | ||
- `meantemp = mean(mydata$temp)` | ||
- Write to a file: | ||
- `write.csv(meantemp, file = "output.csv")` | ||
- Build a linear model: | ||
```r | ||
plot(mydata$temp, mydata$ISI) | ||
lmfire=line(mydata$ISI~mydata$temp) | ||
abline(coef(lmfire)) | ||
``` | ||
|
||
|
||
## R Cheatsheets | ||
- [Graph Parameters CheatSheet](assets/university/year3/R_Graph_Parameters_CheatSheet.pdf). | ||
- [Base R CheatSheet](assets/university/year3/Base_R_CheatSheet.pdf). | ||
- [Data Transformation CheatSheet](assets/university/year3/R_Data_Transformation_CheatSheet.pdf). | ||
|
||
## Commands | ||
```r | ||
mydata = read.csv('/Users/pietra/projects/university/year3/cs3002/lab1/forestfires.csv', sep=',') | ||
|
||
plot(mydata) | ||
View(mydata) | ||
|
||
plot(mydata$column1, mydata$column2) | ||
plot(mydata[,9], mydata[,11]) | ||
hist(mydata$temp) | ||
plot(mydata$temp, type="l") | ||
plot(mydata$X, mydata$Y, col=mydata$temp) | ||
meantemp = mean(mydata$temp) | ||
write.csv(meantemp, file = "output.csv") | ||
|
||
plot(mydata$temp, mydata$ISI) | ||
lmfire=line(mydata$ISI~mydata$temp) | ||
abline(coef(lmfire)) | ||
``` |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ module: | |
lecturer: | ||
<% tp.file.cursor(1) %> | ||
created: <% tp.date.now("YYYY-MM-DD") %> | ||
year: '3' | ||
type: | ||
--- | ||
--- |