diff --git a/Intro_Biocomp_ND_317_Tutorial7.Rproj b/Intro_Biocomp_ND_317_Tutorial7.Rproj new file mode 100644 index 0000000..8e3c2eb --- /dev/null +++ b/Intro_Biocomp_ND_317_Tutorial7.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/crimeData.csv b/crimeData.csv new file mode 100644 index 0000000..bfe0d82 --- /dev/null +++ b/crimeData.csv @@ -0,0 +1,249 @@ +6.703716568,"$31,686 " +5.523336095,"$52,319 " +6.186618322,"$39,328 " +11.43984221,"$44,321 " +6.310958118,"$49,597 " +12.32665639,"$44,078 " +11.41736348,"$38,437 " +3.957649765,"$51,260 " +6.93481276,"$42,925 " +14.66923692,"$41,827 " +10.34435655,"$32,723 " +3.869541183,"$42,081 " +3.194013506,"$28,423 " +2.364595556,"$41,574 " +3.254901981,"$42,702 " +5.54343875,"$48,239 " +12.34567901,"$57,151 " +4.08026382,"$40,711 " +6.071378856,"$37,066 " +3.499734344,"$44,867 " +1.511367811,"$34,964 " +3.717878622,"$42,337 " +5.980066445,"$42,123 " +0.414937759,"$36,756 " +4.09014144,"$33,917 " +6.586483391,"$41,880 " +5.125046741,"$44,219 " +4.219929915,"$30,925 " +4.886960493,"$38,618 " +5.532197389,"$37,919 " +3.219189115,"$26,826 " +11.03926825,"$39,031 " +6.701289998,"$45,244 " +12.60185399,"$34,149 " +9.143155695,"$63,583 " +18.47515632,"$49,647 " +8.92476039,"$32,274 " +1.551918736,"$27,471 " +13.12741313,"$42,079 " +34.87978327,"$41,223 " +4.632489191,"$34,766 " +0.428824441,"$59,532 " +5.584756899,"$36,558 " +7.666506948,"$47,370 " +5.749798525,"$53,710 " +5.733432614,"$36,797 " +0,"$53,355 " +1.5496073,"$32,334 " +0,"$50,074 " +2.971473851,"$39,581 " +13.74663073,"$44,453 " +1.003848084,"$32,805 " +0,"$41,138 " +0.56171886,"$69,427 " +0.114357999,"$53,186 " +2.736686391,"$34,562 " +4.485014774,"$48,426 " +6.325474411,"$37,050 " +0.669987138,"$50,112 " +11.20353897,"$54,074 " +4.986400725,"$31,260 " +24.86338798,"$48,203 " +16.00457274,"$41,903 " +13.52300667,"$38,675 " +4.897914259,"$50,345 " +13.32823202,"$45,806 " +11.0876452,"$39,920 " +1.085456676,"$32,614 " +2.560623839,"$39,747 " +2.504741987,"$33,144 " +6.066970015,"$31,999 " +4.481643071,"$35,449 " +6.133014735,"$51,176 " +20.12019859,"$49,777 " +7.456363328,"$45,346 " +5.911292902,"$56,086 " +10.98488405,"$37,137 " +6.602000914,"$33,956 " +4.469749375,"$36,612 " +5.835120443,"$40,365 " +3.246178912,"$47,991 " +11.22369447,"$36,549 " +2.888726264,"$54,441 " +7.604562738,"$78,529 " +13.54401806,"$45,825 " +5.492635979,"$48,960 " +3.877638949,"$47,024 " +4.200307651,"$39,181 " +4.560544042,"$46,664 " +8.868857226,"$36,985 " +3.642999293,"$41,103 " +3.114086147,"$31,367 " +2.230720204,"$34,959 " +4.16717735,"$54,640 " +3.386809269,"$86,619 " +9.375,"$37,689 " +5.387988902,"$42,096 " +10.07045351,"$55,088 " +3.415935037,"$40,540 " +3.229452608,"$71,581 " +4.1833711,"$35,145 " +17.82363977,"$88,255 " +12.00578289,"$36,711 " +5.365046349,"$24,579 " +9.353033998,"$37,533 " +4.310160884,"$41,096 " +7.505909099,"$47,088 " +3.395632609,"$37,009 " +6.188281764,"$36,913 " +6.128043864,"$34,624 " +7.694584197,"$28,621 " +7.379457727,"$34,511 " +5.705346462,"$41,275 " +18.66151866,"$69,555 " +6.420364947,"$42,319 " +5.804535637,"$41,364 " +10.13913141,"$37,547 " +4.174397032,"$37,546 " +1.55323466,"$42,505 " +1.153846154,"$27,961 " +6.935382533,"$42,359 " +4.500281268,"$38,533 " +3.75563345,"$29,819 " +8.347245409,"$48,742 " +6.138285814,"$38,106 " +4.209587956,"$75,638 " +9.828009828,"$67,830 " +19.63350785,"$46,857 " +6.456677461,"$45,770 " +4.329990884,"$41,792 " +14.18439716,"$78,216 " +2.535925613,"$31,117 " +2.699563675,"$36,689 " +5.440414508,"$36,733 " +3.931332722,"$49,861 " +5.218446602,"$37,578 " +6.425102727,"$39,396 " +5.877210025,"$47,478 " +4.335551522,"$49,897 " +5.444431294,"$45,849 " +14.74891724,"$41,575 " +8.951214001,"$35,081 " +9.905660377,"$33,287 " +6.44438218,"$51,316 " +11.03933273,"$44,968 " +8.638108709,"$45,404 " +62.5,"$32,321 " +2.768381015,"$38,557 " +5.066387142,"$35,607 " +9.100604337,"$33,263 " +15.94488189,"$33,292 " +13.47278851,"$51,211 " +7.44047619,"$42,897 " +8.02284471,"$39,493 " +6.914358992,"$26,982 " +0.83922791,"$37,733 " +1.925339173,"$37,260 " +54.87804878,"$107,627 " +6.815787843,"$36,697 " +2.772643253,"$34,867 " +4.550618648,"$106,588 " +4.161057398,"$36,817 " +8.163265306,"$37,726 " +2.205801257,"$31,319 " +4.30900218,"$47,071 " +10.5197755,"$60,490 " +1.932150079,"$38,581 " +5.992329818,"$41,251 " +14.80836237,"$36,071 " +5.086500975,"$34,258 " +8.691513358,"$35,792 " +3.861003861,"$30,625 " +4.30264116,"$37,222 " +0.592135441,"$42,859 " +4.652461152,"$72,785 " +10.14983084,"$54,690 " +6.218846428,"$41,679 " +3.226384657,"$38,171 " +12.45476731,"$40,543 " +6.593040415,"$50,257 " +3.077238691,"$58,088 " +5.492809973,"$33,042 " +12.09231031,"$36,341 " +1.543488613,"$41,690 " +2.326934264,"$34,618 " +8.422184392,"$32,293 " +1.757900959,"$45,223 " +28.74472574,"$55,073 " +10.58361052,"$32,344 " +8.590927338,"$36,628 " +7.398859625,"$30,692 " +5.213335163,"$45,644 " +15.28384279,"$49,713 " +7.983672489,"$40,181 " +1.067564742,"$53,285 " +2.274665908,"$37,155 " +10.77821745,"$36,484 " +11.86342593,"$35,859 " +16.99923394,"$32,115 " +4.676574075,"$41,386 " +5.592272496,"$35,057 " +9.965742759,"$41,659 " +4.200965087,"$50,489 " +8.656716418,"$132,989 " +9.015038186,"$40,721 " +5.208333333,"$81,876 " +8.657193096,"$50,224 " +8.696647214,"$43,880 " +5.235520025,"$24,540 " +6.355932203,"$49,928 " +0.73964497,"$59,442 " +2.836879433,"$55,528 " +0,"$54,573 " +5.973715651,"$47,284 " +0.465069826,"$48,727 " +1.433286047,"$43,861 " +11.9474313,"$70,192 " +5.337938614,"$35,729 " +3.799873338,"$51,480 " +3.923612175,"$32,760 " +2.827992041,"$43,737 " +2.659452403,"$58,362 " +5.207610054,"$33,789 " +10.6806577,"$31,120 " +10.49183558,"$35,588 " +2.465078061,"$56,860 " +4.220957974,"$39,013 " +2.592471626,"$34,100 " +6.480288345,"$35,086 " +5.098395791,"$47,101 " +4.370641735,"$26,061 " +5.795790858,"$38,380 " +17.74592612,"$44,886 " +4.084567812,"$51,080 " +0.804535057,"$29,778 " +8.581208118,"$41,460 " +9.368923458,"$50,711 " +0.949090771,"$41,947 " +2.072618408,"$37,869 " +9.222480939,"$28,078 " +2.428645032,"$43,498 " +5.303030303,"$42,537 " +2.248594628,"$39,174 " +4.638381014,"$42,837 " +9.479656795,"$35,745 " +5.265621343,"$42,964 " +3.174603175,"$49,954 " +13.42702101,"$27,625 " +8.25500613,"$26,855 " diff --git a/tut7RScript.R b/tut7RScript.R new file mode 100644 index 0000000..8e61985 --- /dev/null +++ b/tut7RScript.R @@ -0,0 +1,55 @@ +#Tutorial Exercise 7 +#Shane Davitt (No partner as I was the odd one out in our tutorial section) +# +#Question 1 +# +#{Plotting by Sequence Lengths} +# +#Putting Lecture11.fasta into an R object +fastaData=read.table("Lecture11.fasta", sep="\t") +# +#Removing seq labels +conFasta = fastaData[seq(2, nrow(fastaData),2),] +# +#Converting data to a dataframe +data.frame(conFasta) +# +#Counting number of charecters in each sequence +countFasta=apply(conFasta,1,nchar) +# +#Plotting the result as a histogram +seqLenPlot=hist(countFasta, xlab="Sequence Length") +# +#{Plotting by GC Content (proportion of sequence which is GC)} +# +#Counting Gs in each sequence +gCount=str_count(conFasta[,1], pattern="G") +# +#Counting Cs in each sequence +cCount=str_count(conFasta[,1], pattern="C") +# +#Total GC count in each seq +GCCount=gCount+cCount +# +#Getting proportion of seq which is GC +GCfreq=GCCount/countFasta +# +#Plotting GC proportion as histogram +GCfreqPlot=hist(GCfreq, xlab="GC Proportion") +# +#I love it when manipulating matrices is as simple as a plus +#and a minus sign ! :) +# +#{Ouestion 2} +# +#Reading my data +crimeData=read.csv("crimeData.csv") +# +#Turning into R object +crimeTable=data.frame(crimeData) +# +#Plotting Data +plot(crimeTable[,2],crimeTable[,1], type="p", xlab="Median Household Income", ylab="Property Crime Rate", main="Examining Affluence and Crime", sub="(TX Counties, 2015)") +# +#Plotting trendline +abline(lm(crimeTable[,1]~crimeTable[,2],crimeTable)) \ No newline at end of file