row <- c("a","b","c","d","e","f","g") #rows from larger data frame

row.1 <- c("a","b","c","g") #rows of smaller data frame because d, e, and f don't contain any of the species, but the zeros are important

x <- data.frame(sp1=rnorm(4), sp2=rnorm(4), sp3=rnorm(4), sp4=rnorm(4))

rownames(x) <- row.1

#I would like to make z as if I had y, but I only have the rownames of y

y <- data.frame(sp1=c(0,0,0), sp2=c(0,0,0), sp3=c(0,0,0), sp4=c(0,0,0))

rownames(y) <- c("d", "e", "f")

z <- rbind(x,y)

z <- z[order(row.names(z)),]

#I know I am missing something
#many thanks,

--
Stephen Sefick
**************************************************
Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849
**************************************************
sas0...@auburn.edu
http://www.auburn.edu/~sas0025
**************************************************

Let's not spend our time and resources thinking about things that are so little 
or so large that all they really do for us is puff us up and make us feel like 
gods.  We are mammals, and have not exhausted the annoying little problems of 
being mammals.

                                -K. Mullis

"A big computer, a complex algorithm and a long time does not equal science."

                              -Robert Gentleman

______________________________________________
R-help@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.

Reply via email to