[R] Plot from function

rmje robinmjelle at gmail.com
Mon Aug 15 13:55:34 CEST 2011


*I have the following function:*

/plot_mi_time = function(mdata, miname) {
   mdata2 = mdata[row.names(hakat) == miname, ]
   print(mdata2)
   xcoords <- c(1,1,2,2,3,3,4,4,5,5,6,6)
   plot(c(xcoords), mdata2, xaxt="n", ylab="Expression", xlab="Time(h)", ,
main=miname)
	   axis(1, at=xcoords,
labels=c("a","a","b","b","c","c","d","d","e","e","f","f"))
}/


*The function is supposed plot a row from the following input-table:*


/                     X1h    X4h    X9h   X15h   X18h   X21h
hsa-miR-99b*         173     64     66     56     65     65
hsa-miR-99b          549    697   1070   1051   1777   2201
hsa-miR-99a*           3      1      3      0      3      2
hsa-miR-99a            5      4     14     16     33     37
hsa-miR-98          3475   4177   4075   4513   4631   5940
hsa-miR-96            21     99    101    135     87    103
hsa-miR-95             3      7      6      4      3      5
hsa-miR-944          275    209    253    311    313    320/


*When running the function I get the following errro messag*e:

> plot_mi_time(hakat, hsa-miR-98)
Error in `[.data.frame`(mdata, row.names(hakat) == miname, ) : 
  object 'hsa' not found


*Anyone know how to use the function correct?*


--
View this message in context: http://r.789695.n4.nabble.com/Plot-from-function-tp3744428p3744428.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list