[adegenet-forum] R code problem
Jombart, Thibaut
t.jombart at imperial.ac.uk
Thu Nov 3 11:49:04 CET 2011
Hello Avik,
The main problem here is that "," is used to separate alleles AND columns as well. If data are stored in a csv file, then another separator than "," should be used to separate alleles.
Can't you get these data using tab-separated columns in the first place? We could find a - more or less complicated - workaround in R, but really it is better storing the data in a format that makes sense in the first place.
The quickest solution is to open your file with a text editor, and replace all ",," by spaces or tabulations; then read.table and df2genind should work normally.
Cheers
Thibaut
________________________________________
From: adegenet-forum-bounces at r-forge.wu-wien.ac.at [adegenet-forum-bounces at r-forge.wu-wien.ac.at] on behalf of AVIK RAY [avik.ray.kol at gmail.com]
Sent: 03 November 2011 10:27
To: adegenet-forum at r-forge.wu-wien.ac.at
Subject: [adegenet-forum] R code problem
Hi all
trying to do DAPC and
trying to get this .csv file read in R
the code goes like this
> obj<-read.table('allindiv50.csv')
> obj
.....
> dat<-data.frame(obj, sep=",", ploidy=4)
> dat
..
..
> dat<-data.frame(obj)
> dat
....
> x=df2genind(dat, sep=",", ploidy=4)
> x
it is 6 loci, tetraploid data but not read as that rather R is reading
it single locus, with array of alleles, I can get from script it can not
recognize the locus separator etc. but can not figure out how to do it
Thanks for any help
best
AVIK
--
AVIK RAY
Visiting Fellow
National Center for Biological Sciences
Tata Institute of Fundamental Research
GKVK Campus
Bellary Road
Bangalore-560065
India
Ph 91-80-23666340
Fax 91-80-2363 6662
More information about the adegenet-forum
mailing list