[Basta-users] how to add b and d dates to data frame?

Colchero, Fernando Colchero at demogr.mpg.de
Tue Nov 1 14:52:22 CET 2011


Hi Cliff,

   We are woking on adding up a function that takes all the data (individual history matrix, covariates, times of birth and death) and puts it together in the right format. At this point, the easiest way is to use the R function merge to 'collate' all the tables using the ID columns as the common columns. For example, let's say that the birth and death matrix is bd and the capture history matrix is Y, to merge them you could type into the R console:

  new.mat    <- merge(x = bd, y = Y, by.x = bd$ID, by.y = bd$ID)

   This "new.mat" can then be used as the basic data frame for the BaSTA analysis. One thing to keep in mind is that it will need the individual id's in the first column. 

   Best,

  Fernando

______________________________________________
 
Fernando Colchero

Max Planck Institute for Demographic Research
Konrad Zuse Str. 1, 18057, Rostock, Germany
Tel:  +49 (0) 381 2081 113
Fax: +49 (0) 381 2081 529
E-mail: Colchero at demogr.mpg.de
______________________________________________





On Nov 1, 2011, at 2:39 PM, Cliff Cunningham wrote:


	Dear Basta,
	
	Your manual tells us how to make data frames for the capture data with CensusToCaptHist.R, and for covariates, but its not clear how to add b and d dates to the capture data.

	This can be easily done in Excel by pasting in the output from the CensusToCaptHist.R program, but then I can't get Basta to accept this data as a data frame. Here is the format I am using:
	ID Birth Death 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 1 1990 d1 1 0 0 0 0 0 0 0 0 0 0 2 1992 d2 0 0 1 0 1 0 1 1 0 1 1 3 b1 d3 0 0 1 1 0 0 0 0 1 0 0 4 b2 d4 0 0 0 0 0 0 0 0 0 0 1 5 b3 d5 1 0 0 0 1 1 0 0 0 1 0 


	Thanks!

	    Cliff Cunningham


	        Professor
	Biology Department
	     Duke University
	        130 Science Drive
	Durham NC 27708
	
	Phone 919-660-7356
	

	http://www.biology.duke.edu/cunningham




	_______________________________________________
	Basta-users mailing list
	Basta-users at lists.r-forge.r-project.org
	https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/basta-users
	



----------
This mail has been sent through the MPI for Demographic Research.  Should you receive a mail that is apparently from a MPI user without this text displayed, then the address has most likely been faked. If you are uncertain about the validity of this message, please check the mail header or ask your system administrator for assistance.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/basta-users/attachments/20111101/238b8332/attachment-0001.htm>


More information about the Basta-users mailing list