How do I plot tadpoles vs altitude in R with code
Site | Rain | Temp | Altitude | Tadpoles | Breeding |
1 | 769.77 | 22.37 | Low | 97 | 61 |
2 | 664.85 | 19.46 | Low | 86 | 70 |
3 | 807.13 | 23.17 | Low | 104 | 61 |
4 | 620.05 | 17.85 | Low | 117 | 113 |
5 | 673.21 | 20.29 | Low | 98 | 92 |
6 | 734.18 | 20.58 | Low | 88 | 100 |
7 | 526.62 | 16.29 | Low | 95 | 102 |
8 | 647.86 | 18.51 | Low | 38 | 66 |
9 | 672.3 | 20.13 | Low | 64 | 64 |
10 | 666.67 | 18.91 | Low | 57 | 18 |
First of all, make a dataframe of your data in R. Then follow the following step in R-
1. Use code attach(data), where data is the name of your dataframe say.
2. Then simply use plot function to plot between tadpoles and altitude using code "plot(tadpoles,altitude)"
The R code is given below
1 dat=read.table("C:/Users/Vikas/Desktop/dat.txt",header = T) ##here i save data in txt format
OR
use code "dat=read.table(file.choose,header = T)" and give location of your dataset
##we save the data with name dat
2 attach(dat) ## for directly accessing a variable
from dataset "dat"
3 plot(Tadpoles,Altitude,type="l",col="red") ##for
plotting the two variables
Get Answers For Free
Most questions answered within 1 hours.