Anurag,

One can do this using geomorph and the base-R function 'which'.  Below is an 
example, using the plethodon dataset from geomorph, where one extracts a subset 
of specimens that are designated Allo in another vector (in this case a vector 
designating locality type): 

library(geomorph)
data(plethodon)
which(plethodon$site=="Allo")  #shows which specimens are designated 'Allo'
newdat<-plethodon$land[,,which(plethodon$site=="Allo")]  #creates new data set
writeland.tps(newdat,'newdat.tps') #writes tps file

Hope this helps.

Dean

Dr. Dean C. Adams
Professor
Department of Ecology, Evolution, and Organismal Biology
       Department of Statistics
Iowa State University
www.public.iastate.edu/~dcadams/
phone: 515-294-3834


-----Original Message-----
From: Anurag Mishra [mailto:anuragmishra1...@gmail.com] 
Sent: Thursday, June 16, 2016 9:03 AM
To: MORPHMET <morphmet@morphometrics.org>
Subject: [MORPHMET] Split tps file in R using a factor

I wish to create separate tps localities for specimens collected from a 
particular locality. I have all the specimens (with landmarks) in one .tps 
file. Can I use a grouping factor (from a separate file) to split the original 
file? In a manner somewhat similar to extracting a subset from a dataframe in R 
- This might be a very basic function, but I am unable to figure this out.

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org
--- 
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.

-- 
MORPHMET may be accessed via its webpage at http://www.morphometrics.org
--- 
You received this message because you are subscribed to the Google Groups 
"MORPHMET" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to morphmet+unsubscr...@morphometrics.org.

Reply via email to