first time posting on here so I'm sorry if I've missed something. I'm currently using code from my old boss, who said I would simply have to put the new csv into the existing script and everything should run smoothly. This has not been the case. My goal is to have graphs produced for each fish species, comparing wet weight and total length to check for outliers. When I run the script, it doesn't flag any errors yet it is not producing the graphs. Any help would be greatly appreciated, and I am able to provide anymore details you guys might need.
fishid<- read.csv(file="2018_fishidcheck.csv", header=T, na.strings = "NA")
fish<- read.csv(file="fish_2019_qaqc.csv", header=T, na.strings = "NA")
fish$FishID<-as.numeric(fish$FishID)
#create subset of fish (by species) to sample for both aging structures, based on size class
data1<- subset(fish, select = c(Common,FishID,TLmm))
data2<-subset(data1, !is.na(data1$FishID))
data2 <- transform(data2, bin = cut(TLmm, 17.5))
write.csv(data2, file = "fish_id_TL.csv")
#check for outliers in length-weight -
SPClist <- unique(fish$Common)
#omit species that have only NA for WetWt
#SPClist<-SPClist[-(32)]
#Create a graph for each species by running through the species list
for(i in SPClist){
#Create a data subset for the species you'd like to create a boxplot for:
mydataSPC <- subset(fish, Common == i, select =
c(ProjectID,ProjName,ProjType,ProjectID1,Effst,SiteID,Area,SampDate,
NameAbbrev, Common, LifeStage, FishID,TLmm, WetWT))
#Create a WetvsTL linear graphs for the species:
plotSPC = plot(WetWT~TLmm,data=mydataSPC, xlab = "Length (mm)", ylab =
"Weight Wet (g)")
title((paste("Wetwt vs TL for species",i,"Individual Fish data")),
cex.main = 0.75)
text(mydataSPC$TLmm, mydataSPC$WetWT, mydataSPC$FishID, cex=0.6, pos=3,
offset=0.4, col="red")
#Export the plot as a .jpg:
dev.copy(jpeg, filename= (paste(i,".jpg")))
dev.off();
}
EDIT TO INCLUDE A BIT OF DATA
Common FishID TLmm bin
35 Common Shiner 30 116 (114,137]
36 Common Shiner 31 96 (89.8,114]
37 Common Shiner 32 112 (89.8,114]
38 Common Shiner 33 96 (89.8,114]
39 Yellow Perch 34 248 (232,256]
40 Yellow Perch 35 226 (209,232]
41 Yellow Perch 36 208 (185,209]
42 Yellow Perch 37 207 (185,209]
43 Yellow Perch 38 204 (185,209]
58 Yellow Perch 15 177 (161,185]
59 Yellow Perch 16 213 (209,232]
60 White Sucker 17 291 (280,304]
64 Yellow Perch 18 245 (232,256]
65 Yellow Perch 19 197 (185,209]
123 Yellow Perch 46 165 (161,185]
124 White Sucker 47 226 (209,232]
125 White Sucker 48 226 (209,232]
126 White Sucker 49 200 (185,209]
127 White Sucker 50 228 (209,232]
129 White Sucker 20 470 (446,470]