[R] Plot creates a straigth line

Robert Baer rbaer at atsu.edu
Wed Oct 20 21:14:06 CEST 2010


> od<-c(10, 8, 6,4,2,1, 10.5,7.8,6.4,3.8,2.1,0.95)
>
> cyto_conc=2650 # Highest cytokine concentration user defined
>
> cyto_std_conc <-c(cyto_conc)
>
> for (i in 1:5)
>     {
> cyto_conc = cyto_conc /3
> cyto_std_conc <-c(cyto_std_conc ,cyto_conc)
>     }
> cyto_std_conc<-log2(rep(cyto_std_conc,2))
> cyto<-cbind(cyto_std_conc,od)
>
> plot(cyto_std_conc,od, type='b')

# Try finishing by plotting just the points and also the regression line 
(red):
plot(cyto_std_conc,od, type='p')
abline(lm(od ~ cyto_std_conc), col='red')



More information about the R-help mailing list