Lab 03 Correlation - Student Name
Lab 03 Correlation - Student Name
Bell Mills
3/8/2025
## [1] 0.76539
library(ggplot2)
# plot it
ggplot(my_df, aes(x=x,y=y))+
geom_point()+
geom_text(aes(label = round(cor(x,y), digits=2), y=12, x=2 ))
x<-rnorm(40,0,1)
y<-rnorm(40,0,1)
conditions<-rep(c("A","B","C","D"), each=10)
ggplot(all_df, aes(x=x,y=y))+
geom_point()+
facet_wrap(~conditions)
x<-rnorm(10*20,0,1)
y<-rnorm(10*20,0,1)
conditions<-rep(1:20, each=10)
ggplot(all_df, aes(x=x,y=y))+
geom_point()+
geom_smooth(method=lm, se=FALSE)+
facet_wrap(~conditions)+
theme_classic()
library(data.table)
whr_data <- fread("https://raw.githubusercontent.com/CrumpLab/statisticsLab/master/data/WHR2018.csv")
library(summarytools)
view(dfSummary(whr_data))
## [1] NA
library(dplyr)
## [1] 0.4080963
# calcualte correlation
## [1] 0.4080963
# calcualte correlation
cor(smaller_df$`Positive affect`,
smaller_df$`Negative affect`)
## [1] -0.3841123
## [1] 0.008574957
min(saved_value)
## [1] -0.685088
max(saved_value)
## [1] 0.7341346
## [1] 0.001495143
min(saved_value)
## [1] -0.2945057
max(saved_value)
## [1] 0.241343