[R] Delete/insert rows in data matrix

ronggui ronggui.huang at gmail.com
Thu Jan 31 14:21:46 CET 2008


How about  this:

> DF<-data.frame(x=1:3,y=2:4)
> DF[4,]<-c(4,5)
> DF
  x y
1 1 2
2 2 3
3 3 4
4 4 5
> DF<-DF[,-4]
> DF
  x y
1 1 2
2 2 3
3 3 4
4 4 5


On 1/31/08, Eleni Christodoulou <elenichri at gmail.com> wrote:
> Hello all,
>
> I have the following problem. I want to insert blank rows in an data frame
> so as to make it comparable with another data frame with more rows. How can
> I insert these rows?
> If this is not solvable, then, alternatively, is it easy to delete rows from
> a data frame?
>
> Thanks for helping,
> Eleni
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
HUANG Ronggui

Bachelor of Social Work, Fudan University, China

Master of sociology, Fudan University, China

Ph.D. Student , CityU of HK,
http://www.cityu.edu.hk/sa/psa_web2006/students/rdegree/huangronggui.html



More information about the R-help mailing list