[R] FW: New package apex 1.0.0 released on CRAN

2015-04-16 Thread Jombart, Thibaut

Dear all,

(apologies for multiple posting)

On behalf of the apex development team (E. Paradis, K. Schliep, Z. Kamvar, R. 
Harris and myself), I am happy to announce that apex has been released on CRAN:
http://cran.r-project.org/web/packages/apex/index.html

This package provides tools for reading, storing, handling and analysing 
genetic sequences from multiple genes, and is compatible with both ape and 
phangorn.

For more information on apex, questions, requests, or to join us, check our 
github project at:
https://github.com/thibautjombart/apex

Best regards
Thibaut

==
Dr Thibaut Jombart
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - School of Public Health
Norfolk Place, London W2 1PG, UK
Tel. : 0044 (0)20 7594 3658
http://sites.google.com/site/thibautjombart/
http://sites.google.com/site/therepiproject/
http://adegenet.r-forge.r-project.org/
Twitter: @thibautjombart


___
R-sig-genetics mailing list
r-sig-genet...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-genetics

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] FW: r-sig-genetics is alive!

2015-04-08 Thread Jombart, Thibaut

Dear all, 

a small heads up for R-sig-genetics, a mailing list devoted to population 
genetics in R. See below, and sorry about the double-posting.

All the best

Thibaut


--
From: Jombart, Thibaut
Sent: 08 April 2015 17:21
To: r-sig-genet...@r-project.org
Subject: r-sig-genetics is alive!

Dear all, 

after a rather quiet existence for the last few years, it may be good to send 
this reminder: r-sig-genetics is alive!

Many awesome people have subscribed lately, and I am looking forward to seeing 
exciting discussions here. Posting guidelines have been freshly updated:
https://stat.ethz.ch/mailman/listinfo/r-sig-genetics

Coming soon: exciting news regarding future releases of a bunch of population 
genetics packages.

All the best

Thibaut
   

==
Dr Thibaut Jombart
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - School of Public Health
Norfolk Place, London W2 1PG, UK
Tel. : 0044 (0)20 7594 3658
http://sites.google.com/site/thibautjombart/
http://sites.google.com/site/therepiproject/
http://adegenet.r-forge.r-project.org/
Twitter: @thibautjombart

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Geneland error on unix: Error in MCMC(........ :, unused argument(s) (ploidy = 2, genotypes = geno)

2010-05-20 Thread Jombart, Thibaut
Hello,

you may want to contact directly the maintainer of Geneland for that kind of 
issue. In any case, this post would be best suited for R-sig-genetics:
https://stat.ethz.ch/mailman/listinfo/r-sig-genetics

Best regards,

Thibaut

--
##
Dr Thibaut JOMBART
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - Faculty of Medicine
St Mary’s Campus
Norfolk Place
London W2 1PG
United Kingdom
Tel. : 0044 (0)20 7594 3658
t.jomb...@imperial.ac.uk
http://sites.google.com/site/thibautjombart/
http://adegenet.r-forge.r-project.org/


From: Nevil Amos [nevil.a...@gmail.com]
Sent: 20 May 2010 10:34
To: r-help@r-project.org; Jombart, Thibaut
Subject: Geneland error on unix:  Error in MCMC( :,  unused argument(s) 
(ploidy = 2, genotypes = geno)

I am receiving the above error ( full r session output below)  the
script runs OK in windows.  and genotypes and ploidy are both
correct arguments

any suggestions would be most welcome

Nevil Amos
MERG/ACB
Monash University School of Biological Sciences







  library(Geneland)
Loading required package: RandomFields
Loading required package: fields
Loading required package: spam
Package 'spam' is loaded. Spam version 0.21-0 (2010-03-13).
Type demo( spam) for some demos, help( Spam) for an overview
of this package.
Help for individual functions is optained by adding the
suffix '.spam' to the function name, e.g. 'help(chol.spam)'.

Attaching package: 'spam'

The following object(s) are masked from 'package:base':

 backsolve, forwardsolve, norm

  Try help(fields) for an overview of this library
fields web: http://www.image.ucar.edu/Software/Fields
Loading required package: mapproj
Loading required package: maps
Loading required package: snow
Loading required package: tcltk
Loading Tcl/Tk interface ... done
ooo
oGeneland is loaded   o
o o
o* Please *   o
o o
oRegister on  o
ohttp://www2.imm.dtu.dk/~gigu/Geneland/register.php   o
o o
oSee manual ono
ohttp://www2.imm.dtu.dk/~gigu/Geneland/#Manualo
o o
oType citation(Geneland) for a quick citation guide o
o o
oSee http://www2.imm.dtu.dk/~gigu/Geneland/#  o
ofor additional referenceso
o o
oThis is Geneland-3.2.1   o
o o
ooo
Warning message:
In fun(...) : no DISPLAY variable so Tk is not available
  DIRLIST-c(Adult_ALL
NO_ANW/)#,Adult_Or_ANW/,Adult_Females/,Adult_Males/)
  for(d in DIRLIST){
+ theWd- paste(/nfs/monash/home/namos/Rwork/,d,sep=)
+ setwd(theWd)
+ SPP.CODES -EYR#c(BT,EYR,FH,SPP,STP)
+ for (sp in  SPP.CODES){
+ path.sp- paste(theWd,sp,/,sep=)
+ dir.create(path.sp)
+ GENO.TABLE-paste(theWd,sp,geno,sep=)
+ XY.TABLE-paste(theWd,sp,xy,sep=)
+ MINPOP=1
+ MAXPOP=25
+ INITPOP=1
+ NITS=50
+ THIN=NITS/1000
+ nrun - 10
+ burnin - 200
+ geno-noquote(read.table(GENO.TABLE))
+ coord-read.table(XY.TABLE)
+
+ ## Loop for multiple runs
+
+ for(irun in 1:nrun)
+ {
+ ## define path to MCMC directory
+
+ path.mcmc - paste(path.sp,irun,/,sep=)
+ dir.create(path.mcmc)
+ MCMC(coordinates=coord, ploidy=2, genotypes=geno, varnpop=T,
npopmax=MAXPOP, npopinit=MINPOP, spatial=T, freq.model=Correlated,
nit=NITS, thinning=500, rate.max=nrow(geno), delta.coord=100,
path.mcmc=path.mcmc)
+ ## MCMC postprocessing
+ PostProcessChain(coordinates=coord,path.mcmc=path.mcmc,genotypes=geno,
nxdom=50,nydom=50,burnin=burnin)
+ }
+ ## Computing average posterior probability
+
+ lpd - rep(NA,nrun)
+ for(irun in 1:nrun)
+ {
+ path.lpd - paste(path.mcmc,log.posterior.density.txt,sep=)
+ lpd[irun] - mean(scan(path.lpd)[-(1:burnin)])
+ }
+ ## Runs sorted by decreasing average posterior probability:
+ order(lpd,decreasing=TRUE)
+
+ #pdf(Number of pops.pdf,((210-10)/25.4),((297-10)/25.4))
+ #theWd-getwd()
+ ##setwd(theWd)
+ #par(mfrow = c(5, 2),cex=0.25)
+ #for(irun in 1:nrun)
+ #
+ #{
+ #
+ ###Below is code form the Geneland Plotnpop function
+ #fileparam - paste(path.mcmc, parameters.txt, sep = )
+ #param - as.matrix(read.table(fileparam))
+ #thinning - as.numeric(param[param[, 1] == thinning, 3

[R] Sweave in PNG: driver online

2010-02-18 Thread Jombart, Thibaut
Dear R addicts, 

Back in 2006, I posted the proposition for a tweak of the Sweave driver so that 
PNG figures can be produced instead of eps/pdf :
https://stat.ethz.ch/pipermail/r-help/2006-March/102122.html

The amount of code modified is tiny (it was designed to induce minimal changes 
to the official code), but so far the driver seems to have been useful to a 
number of users. From 2006 on, successive versions of the code were supposed to 
incorporate the official driver. My current understanding is that this tweak 
won't incorporate the official release, although an alternative approach is 
still supposed to take place eventually. 

Meanwhile, a fairly recent update of the alternative driver can be found online 
from my website:
http://sites.google.com/site/thibautjombart/r-packages

A vignette describes briefly the new features and how the driver can be used.

Best regards,

Thibaut.

-- 
##
Dr Thibaut JOMBART
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - Faculty of Medicine
St Mary’s Campus
Norfolk Place
London W2 1PG
United Kingdom
Tel. : 0044 (0)20 7594 3658
t.jomb...@imperial.ac.uk
http://sites.google.com/site/thibautjombart/
http://adegenet.r-forge.r-project.org/

__
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.


Re: [R] Doubt about CCA and PCA

2009-11-23 Thread Jombart, Thibaut
Dear Francisco, 

CCA and PCA are quite different methods. CCA regresses your 'response' data 
onto a set of explanatory variables. This needs to invert the matrix of 
covariances of the predictors, which is only possible if np, where n is the 
number of observations and p the number of explanatory variables.

PCA is defined in any case. The ratio between n and p is then relevant only if 
you intend to infer principal axes / component of the population (as opposed to 
using the PA/PC as mere descriptors of the sample). I would recommend reading :
Joliffe, I. T. Principal Component Analysis Springer, 2004
which tackles the latter point very clearly.

Best regards,

Thibaut.
--
##
Dr Thibaut JOMBART
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - Faculty of Medicine
St Mary’s Campus
Norfolk Place
London W2 1PG
United Kingdom
Tel. : 0044 (0)20 7594 3658
t.jomb...@imperial.ac.uk
http://www1.imperial.ac.uk/medicine/people/t.jombart/
http://adegenet.r-forge.r-project.org/

From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of 
Francisco Javier Santos Alamillos [fsan...@ujaen.es]
Sent: 23 November 2009 21:43
To: r-help@r-project.org
Subject: [R] Doubt about CCA and PCA

Dear R community,

I'm working with PCA and CCA methods, and I have a theoretical question.

Why is it necesary to have more temporal values than variables when the CCA
O PCA are going to be used?

Could you advise to me some any paper about it?

Thanks in advance,

[[alternative HTML version deleted]]

__
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.

__
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.


Re: [R] problem whit Geneland

2009-01-13 Thread Jombart, Thibaut J X
David Winsemius wrote:
 help.search did not offer any clues. Using Baron's search page, I got 
 reference to r-help entries from 2004,  but looking at the current 
 documentation , I see no such function. I am wondering if the name of the 
 function was changed in later versions of the package and you are mixing old 
 documentation or examples with a newer installation of that package?

 Here is a 2005 version of the package documentation and it does have that 
 function:
 http://phase.hpcc.jp/mirrors/stat/R/CRAN/doc/packages/Geneland.pdf

 Perhaps you want the MCMC function?

 Description
 Markov Chain Monte-Carlo inference under various models

 Usage
 MCMC( coordinates=NULL, genotypes,## ploidy=2, dominance=Codominant,
 allele.numbers,
 path.mcmc, # path to output directory
 # hyper-prior parameters
 rate.max,delta.coord=0,shape1=2,shape2=20, npopmin=1,npopinit,npopmax,
 # dimensions
 nb.nuclei.max,
 # options in mcmc computations
 nit,thinning=1,freq.model=Uncorrelated, varnpop=TRUE, spatial=TRUE, 
 jcf=TRUE, filter.null.alleles=TRUE, prop.update.cell=0.1, 
 write.rate.Poisson.process=FALSE, write.number.nuclei=TRUE, 
 write.number.pop=TRUE, write.coord.nuclei=TRUE, write.color.nuclei=TRUE, 
 write.freq=TRUE, write.ancestral.freq=TRUE, write.drifts=TRUE, 
 write.logposterior=TRUE, write.loglikelihood=TRUE, write.true.coord=TRUE, 
 write.size.pop=FALSE, miss.loc)

Hello,

You might reach a broader range of Geneland users by sending your post to 
R-sig-genetics:
https://stat.ethz.ch/mailman/listinfo/r-sig-genetics

Cheers,

Thibaut.

-- 
##
Dr Thibaut JOMBART
MRC Centre for Outbreak Analysis and Modelling
Department of Infectious Disease Epidemiology
Imperial College - Faculty of Medicine
St Mary’s Campus
Norfolk Place
London W2 1PG
United Kingdom
Tel. : 0044 (0)20 7594 3658
jomb...@biomserv.univ-lyon1.fr
http://biomserv.univ-lyon1.fr/%7Ejombart/
http://adegenet.r-forge.r-project.org/

[[alternative HTML version deleted]]

__
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.


Re: [R] How can i do an automatic upgrade of R 2.5.1 to R 2.7.1

2008-07-07 Thread Thibaut Jombart

Dear Jason,

I don't know if this interests you, but one thing you might want to do 
while 'upgrading' (in fact it is just a new installation) is re-install 
all the packages that were installed on your previous R version.


I made a small script to do so:
###
reinst.pack - function(pathToOldR){

instDir - paste(pathToOldR,/library/,sep=)
pack - dir(instDir)
basePack - sub(/base,, system.file())
basePack - dir(basePack)

pack - setdiff(pack,basePack)
pack

install.packages(pkg=pack)

}
###

You just have to launch the script from your new R version, giving it 
the path to the old version of R.

For instance I had to do:
###
 reinst.pack(/usr/local/lib64/R-2.6.0/)
also installing the dependency ‘spam’

essai de l'URL 
'http://cran.univ-lyon1.fr/src/contrib/spam_0.13-1.tar.gz' 
http://cran.univ-lyon1.fr/src/contrib/spam_0.13-1.tar.gz%27

Content type 'application/x-tar' length 212961 bytes (207 Kb)
URL ouverte
==
downloaded 207 Kb

[...]

###

It should work if you packages where installed at the default place.

Cheers,

Thibaut.





Jason Lee schreef:

Hi,

I am aware this is somehow FAQ question but I ve been searching from 
R-cran
archive about the related matter and could not find anything closer 
to this.


I want to upgrade my R version from 2.5.1. to 2.7.1. What is the best 
way to

load the latest one apart from installing the packages (tar.gz) from
http://cran.ms.unimelb.edu.au/?


Please help.

Thanks..

[[alternative HTML version deleted]]

__
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.



__
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.





--
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://biomserv.univ-lyon1.fr/%7Ejombart/
http://adegenet.r-forge.r-project.org/

__
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.


[R] new mailing list: R-sig-genetics

2008-05-22 Thread Thibaut Jombart

Dear list,

A new mailing list *R-sig-genetics* has just been created (thanks to 
Martin Maechler).


This list is dedicated to discussions about the *analysis of genetic 
markers* using the R software. The covered topics, along with various 
information about the list, are available from the R-sig-genetics homepage:

https://stat.ethz.ch/mailman/listinfo/r-sig-genetics

Best regards,

Thibaut Jombart.

--
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://biomserv.univ-lyon1.fr/%7Ejombart/
http://adegenet.r-forge.r-project.org/

__
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.


Re: [R] Research Notes

2008-04-22 Thread Thibaut Jombart
Barry Rowlingson wrote:
   I use a thing called 'Plain Text File'...

   Basically I keep a file called 'NOTES.txt' in each project directory I 
 work in and keep it updated as I work. I keep note of where data comes 
 from, what I do to it, what various functions do and so on. Then I can 
 use Unix command-line tools such as 'grep' and 'find' to search them.

   I wouldn't dream of using a proprietary tool with a proprietary and 
 closed format for this kind of thing EVER. If you want something more 
 sophisticated than my Plain Text File solution then keep a 'NOTES.tex' 
 file then you can include equations and graphics. Plus it's then trivial 
 to cut things out of it into your final reports and papers.
   
And for a small amount of additional pain, one can use Sweave. It is 
much more powerful than tex alone and this assures a perfect match 
between commands and outputs.

Best,

Thibaut.


-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://biomserv.univ-lyon1.fr/%7Ejombart/
http://adegenet.r-forge.r-project.org/

__
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.


Re: [R] representing binary data for Genetic Algorithm in R

2008-04-20 Thread Thibaut Jombart
Dear Esmail,

you really have to have a look at some introduction to R (e.g. 
http://cran.r-project.org/doc/manuals/R-intro.pdf), but see the Manual 
section in R website (http://www.r-project.org/). That would answer many 
of your questions.

Hello all,

I am trying to implement a simple Genetic Algorithm. I am doing this
in R since I want access to the statistical functions (eg lm) it
provides.

I'm not new to programming, or GAs, but I am totally new to R (the
package and the language), and I am hoping someone could help with
these questions:

1. I am going to use a binary representation, it seems that vectors of
   Factors would be what I should use? I would specify values of
   TRUE/FALSE instead? Or is there a better choice for manipulating
   binary strings? Does this seem like a legitimate way to create a
   random one: sample(0:1, vec_size, replace=T)
  

Factors are nice to manipulate binary strings (they use integers as 
internal representation).

2. Am I correct in assuming that R is interpreted (and hence is going to
   be noticeably slower than compiled languages)?

  

Yep. But you can have R call C and Fortran code as well.

3. Is there some sort of debugging facility?

?debug

 
4. Does anyone know how to do an effective search for R in google (or
   other search engines). The fact that this is a single letters seems
   to have most applications ignore this input. This might help me in
   finding answers to some other basic questions I have (such as is
   there an equivalent function to printf in R? cat and print
   are not quite working right for me -- but I need to dig deeper into
   the documentation)
  

Functions: ?, help.search, apropos, RSiteSearch. See also 
http://www.rseek.org/.

I am not sure if this belongs into the help or development group, so
I'm giving this a try. If this is the wrong group to post in, please
let me know and I'll repost.
  

Instructions and posting guide are there:
http://www.r-project.org/mail.html

There will probably be more elementary questions (I am reading the
various manuals too .. but if anyone has some other favorite sites
they want to recommend please do so)

Thanks,
Esmail

ps: I there a USENET group dedicated to R?

pps: I am also exploring ways of calling R functions from Java, if
 anyone has any comments regarding that please share.
  

See the rJava package.

Regards,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://adegenet.r-forge.r-project.org/

__
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.


Re: [R] CRAN packages hosting policy

2008-04-17 Thread Thibaut Jombart
Julien Barnier wrote:

Hi to all,

I recently created a small package which contains some simple R
functions in order to help students in my research unit to use R. The
package is pure R, it passes R CMD check, but it is really designed
for internal use and, moreover, it is entirely documented in french.

Is it possible to upload and to host this kind of package to CRAN ? Or
is it better, as it is quite a private tool and not really designed
for widespread adoption, to set up my own repository ?

Thanks in advance,
  

Hi Julien,

I would not pretend that I know anything about the hosting policy on 
CRAN. However, another place where you could try and host your package 
is R-Forge (though you might have to ask them the same question):
https://r-forge.r-project.org/
Among other things, you can manage your sources via svn, and install the 
package directly from their server. And do many other terrific things, 
like bug-tracking, mailing-lists, forums, etc.

Hope this will help.

Best regards,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://adegenet.r-forge.r-project.org/

__
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.


Re: [R] Fwd: time series regression

2008-03-20 Thread Thibaut Jombart
bereket weldeslassie wrote:
  Hi Everyone,
 One more information to my question. I am trying to do a time series
 regression using the lm function. *My intention is to investigate the
 relationship between a dependent time series variable and several
 independent time series variables.* According to the durbin watson test the
 errors are autocorrelated. And then I tried to use the gls function to
 accomodate for the autocorrelated errors. My question is how do I know what
 ARMA process (order) to use in the gls function? Or is there any other way
 to do the time series regression in R? I highly appreciate your help.
 Thanks,
 Bereket

   [[alternative HTML version deleted]]

 __
 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.


   
Hi,

Temporal autocorrelation seems to be a contagious process... even for 
emails. I received yours three times in 5 minutes.

Concerning your question, I am no expert in time series, but you may 
also try ordinary least squares after 'removing' autocorrelation. This 
can be achieved by regression onto a lagged variable (see lag.listw in 
spdep, which can also be applied to temporal context), or onto 
eigenvectors of a temporal proximity matrix.

Cheers,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://adegenet.r-forge.r-project.org/

__
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.


Re: [R] Spatially Lagged Predictor Variable Models

2008-03-13 Thread Thibaut Jombart
ArunPrasad wrote:
 Hi Everyone,
  I am doing a project based on Spatially Lagged Predictor
 Variable Models, I would like to know which package in R would execute this
 model. Also, I am new to this field of spatial statistics. Any suggestions
 for a good book on spatial regression analysis would be appreciated. Thanks
 Again.

 Cheers
 Arun

   
Hi,

you may have a look at lag.listw in the package 'spdep' by R Bivand, 
which computes a lag vector given a variable and a list of spatial 
weights. There is a nice review of spatial methods in ecology, already 
mentioned on this list I think:

Carsten F. Dormann, Jana M. McPherson, Miguel B. Araújo, Roger Bivand, 
Janine Bolliger, Gudrun Carl, Richard G. Davies, Alexandre Hirzel, 
Walter Jetz, W. Daniel Kissling, Ingolf Kühn, Ralf Ohlemüller, Pedro R. 
Peres-Neto, Björn Reineking, Boris Schröder, Frank M. Schurr and Robert 
Wilson,. (2007) Methods to account for spatial autocorrelation in the 
analysis of species distributional data: a review. /Ecography/ 30:5, 609–628

This may be a good starting point.

Cheers,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://adegenet.r-forge.r-project.org/

__
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.


Re: [R] Plot Principal component analysis

2008-02-27 Thread Thibaut Jombart
Jim Lemon wrote:

SNN wrote:
  

Hi,

I have matrix of 300,000*115 (snps*individual). I ran the PCA on the
covariance matrix which has a dimention oof 115*115. I have the first 100
individuals from group A and the rest of 15 individuals from group B. I need
to plot the data in two and 3 dimentions with respect to PC1 and PC2 and (in
3D with respect to PC1, PC2 and PC3). I do not know how to have the plot
ploting the first 100 points corresponding to group A in red (for example)
and the rest of the 15 points in Blue? i.e I want the each group in a
diffrent color in the same plot. I appreciate if someone can help.



Hi Nancy,
(if indeed you are a Nancy and that is not a webnym)
Say that your groups really are coded A and B, the group coding 
variable is called group. You can define a color vector like this:

colorvector-ifelse(group==A,red,blue)

Jim

__
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.


  

Hi Nancy,
in your case you may also use inertia ellipses to represent your groups, 
in addition to different colors.
Here is an example using a microsatellite dataset from adegenet (but 
valid for SNPs of course):
#
library(ade4)
library(adegenet)
data(microbov) # dataset

# replace missing values
obj=na.replace(microbov,method=mean)

# perform your pca, keep 3 axes
pca1=dudi.pca(obj$tab,scannf=FALSE,nf=3,scale=FALSE)

# plot the result
s.class(pca1$li,obj$pop)
s.class(pca1$li,obj$pop,col=sample(colors(),15)) # here, replace col 
by the appropriate vector of colors.

#
The resulting graphic represents each genotype by a point, and adds 
ellipses of different color for each group; each ellipse represents 95 % 
of the inertia of the corresponding group. The more ellipses overlap, 
the less your groups are differentiated on the factorial plane.

Cheers,

Thibaut.
-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] How to include the documentation of a function in a Sweave document?

2008-02-26 Thread Thibaut Jombart
Jean lobry wrote:
 Dear R-help,

 I would like to include the documentation of an R function in an
 *.rnw document processed by Sweave. Because I'm sharing my *.rnw
 files with colleagues under Linux and Windows (I'm on Mac OS X),
 I would like a pure R solution.

 The naive approach doesn't work, because Sweaving this *.rnw
 file:

  tmp.rnw 
 \documentclass{article}
 \begin{document}
 =
 ?plot
 @
 \end{document}
  tmp.rnw 

 yields the following LaTeX file on my platform (session info at the end):

  tmp.tex 
 \documentclass{article}
 \usepackage{/Library/Frameworks/R.framework/Resources/share/texmf/Sweave}
 \begin{document}
 \begin{Schunk}
 \begin{Sinput}

   
  `?`(plot)
 
 \end{Sinput}
 \end{Schunk}
 \end{document}
  tmp.tex ---
 -

 in which no Soutput has been generated. Is it possible to redirect the
 help output, in a platform-independent way, so that it is included in
 the Soutput environment of the LaTeX file?

 Best,

 Jean

   
  sessionInfo()
 
 R version 2.6.2 (2008-02-08)
 i386-apple-darwin8.10.1

 locale:
 C

 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods   base

 loaded via a namespace (and not attached):
 [1] rcompgen_0.1-17

   
Maybe a clue: we can use
cat(readLines(as.character(?plot)),sep=\n)

to display the help (here, of plot) directly to the screen. So we could
use something like:

echo=TRUE,print=FALSE,eval=FALSE=
?plot
@


echo=FALSE,print=TRUE,eval=TRUE=
cat(readLines(as.character(?plot)),sep=\n)
@

But this doesn't work (latex compilation error) as weird characters 
appear in the produced tex, at some places (tabulations?), like:

_T_h_e _D_e_f_a_

(not sure what it will look like in this email, but emacs reads things
like _^HT_^HH_^He...).

Maybe an encoding problem? I tried specifying different encoding to 
readLines, with no luck (latin1, UTF-8). Otherwise, the help appears in 
the .tex.

Cheers,

Thibaut.



  sessionInfo()
R version 2.6.2 (2008-02-08)
i686-pc-linux-gnu

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] datasets  utils stats graphics  grDevices methods   base

other attached packages:
[1] phylobase_0.3  nlme_3.1-87ape_2.1-1  adegenet_1.1-0 
pixmap_0.4-7
[6] ade4_1.4-5 MASS_7.2-41

loaded via a namespace (and not attached):
[1] grid_2.6.2  lattice_0.17-6  rcompgen_0.1-17 tcltk_2.6.2
[5] tools_2.6.2


-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://adegenet.r-forge.r-project.org/

__
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.


Re: [R] How to include the documentation of a function in a Sweave document?

2008-02-26 Thread Thibaut Jombart
Duncan Murdoch wrote:
   
 Maybe a clue: we can use
 cat(readLines(as.character(?plot)),sep=\n)

 to display the help (here, of plot) directly to the screen. So we could
 use something like:

 echo=TRUE,print=FALSE,eval=FALSE=
 ?plot
 @


 echo=FALSE,print=TRUE,eval=TRUE=
 cat(readLines(as.character(?plot)),sep=\n)
 @

 But this doesn't work (latex compilation error) as weird characters 
 appear in the produced tex, at some places (tabulations?), like:

 _T_h_e _D_e_f_a_

 (not sure what it will look like in this email, but emacs reads things
 like _^HT_^HH_^He...).

 Maybe an encoding problem? I tried specifying different encoding to 
 readLines, with no luck (latin1, UTF-8). Otherwise, the help appears 
 in the .tex.

 Those are backspaces:  it's trying to underline the title.  You'd get 
 a better display if you read the latex version instead.  I think you 
 need to construct the path to it yourself (using system.file() etc.)

 Duncan Murdoch



Thanks for the hint !
So, the code below roughly works:

###
\documentclass{article}
\usepackage{verbatim}
\begin{document}
echo=TRUE,print=FALSE,eval=FALSE=
?plot
@


echo=FALSE,print=FALSE,results=tex=
path - sub(help,latex,as.character(?plot))
path - paste(path,'tex',sep=.)
cat(readLines(path),sep=\n)
@

\end{document}
###

The document compiles with pdflatex but still complains about a bunch of 
unknown latex instructions (like \HeaderA, used at the begining of the 
included (plot.tex) tex file. The resulting pdf indeed looks a bit nasty.

What command shall we include in the header to have it work?

Best,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://adegenet.r-forge.r-project.org/

__
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.


Re: [R] Standard method for S4 object

2008-02-24 Thread Thibaut Jombart
Martin Morgan wrote:

 Christophe Genolini wrote:

 Personnally I would find stuff like names,  $, $-, or [ 
 useful as these are usual operation with S3 objects.

 Is it possible in S4 to define $- ? If there is a slot name 'a' in 


 Possible yes, see below. Usual? It implies to the user that this is a 
 list- or data.frame-like object (where $ is used most commonly). Maybe 
 your object is not like that? It also seems like a short step from 
 direct slot access (although it doesn't have to be), which might be 
 breaking the abstraction layer that object orientation provides. And 
 it shifts the responsibility for confirming that 'name' is a slot, and 
 dispatching on different values of 'name' (e.g. for some slots perhaps 
 one doesn't want to allow access, and then the code inside the '$' 
 method has to check that), back to the developer (instead of allowing 
 the method definition and dispatch to do its work). Generally these 
 seem like backward steps to me.

Yes, to me too. But it is nonetheless useful when you convert an 'old' 
S3 class to S4 and want to re-use your old code as much as possible (or 
want users to be able to do so). I don't know if this is the case here. 
Plus, as $ and $- are just wrappers for @ and @-, the procedure 
checking the validity of a value assigned to a slot is still called when 
using $-. Another, maybe interesting option is to use accessors to 
change the values of the slots. This might be more object-oriented, and 
would allow for more control on the content of the object.

Cheers,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] Standard method for S4 object

2008-02-23 Thread Thibaut Jombart
Christophe Genolini wrote:

Hi the list,

I am defining a new class MyClass. Shortly, I will submit a package with 
it. Before, I would like to know if there is a kind of non official 
list of what method a new S4 object have.
More precisely, personnaly, I use 'print', 'summary' and 'plot' a lot. 
So for my new class, I define these 3 methods. Is there some other 
method that a R user can raisonnably expect ? Some minimum basic tools...

Thanks

Christophe
  

Hi,

/I think your question should be more relevant on Rdev./
I am not sure that 'print' is called when printing an S4 object. I think 
'show' is used instead.
You might find which methods are usual: 
http://wiki.r-project.org/rwiki/doku.php?id=tips:classes-s4
may help.
Personnally I would find stuff like names,  $, $-, or [ useful 
as these are usual operation with S3 objects.

Regards,

Thibaut.
-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] Accessing the elements of a list

2008-02-01 Thread Thibaut Jombart
Shubha Vishwanath Karanth wrote:
 Hi R,

  

 I wanted to know how do we access the elements of a list. In particular,

  

 v=list(c(1,2,3,4,5),c(1,2,33,4,5),c(1,2,333,4,5),c(1,2,,4,5))

  

 I want to access all the thirds items of the elements of the list. i.e.,
 I want to access the elements, 3,33,333,. This can be done through
 sapply as:

  

 sapply(v,function(x) x[3])

  

 But I need to access this without using 'sapply'. Like in a data frame,
 we do df[2,3] etc Any ideas?

   
Hi,

not the most elegant, but this works:

cmd  unlist(as.data.frame(v)[3,])
   c.1..2..3..4..5.   c.1..2..33..4..5.  c.1..2..333..4..5. 
c.1..2....4..5.
  3  33 
333

Cheers,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] Which Linux OS on Athlon amd64, to comfortably run R?

2007-12-05 Thread Thibaut Jombart
8rino-Luca Pantani wrote:

Dear R-users.
I eventually bought myself a new computer with the following 
characteristics:

Processor AMD ATHLON 64 DUAL CORE 4000+ (socket AM2)
Mother board ASR SK-AM2 2
Ram Corsair Value 1 GB DDR2 800 Mhz
Hard Disk WESTERN DIGITAL 160 GB SATA2 8MB

I'm a newcomer to the Linux world.
I started using it (Ubuntu 7.10 at work and FC4 on laptop) on a regular 
basis on May.
I must say I'm quite comfortable with it, even if I have to re-learn a 
lot of things.  But this is not a problem, I will improve my knowledge 
with time.

My main problem now, is that I installed Ubuntu 7.10 Gutsy Gibbon on the 
new one amd64.

To install R on it i followed the directions found here
http://help.nceas.ucsb.edu/index.php/Installing_R_on_Ubuntu

but unfortunately it did not work.

After reading some posts on the R-SIG-debian list, such as

https://stat.ethz.ch/pipermail/r-sig-debian/2007-October/000253.html

I immediately realize that an amd64 is not the right processor to make 
life easy.

Therefore I would like to know from you, how can I solve this problem:
Should I install the i386 version of R ?
Should I install another flavour of Linux ?
Which one ?
Fedora Core 7 ?
Debian ?

Thanks a lot, for any suggestion

  

Hi,

I've got an Athlon 64bits 3000+ processor and Ubuntu LTS (dapper) 
installed (64 bits version) on my laptop. I do not have any problem to 
install R from the sources, as long as the correct 
libraries/compilers/etc. are installed. But it is no pain if you just 
follow what the configure script tells you (and use apt-get to install 
missing packages). I guess a common mistake is to forget to install 
-dev versions of packages, which sometimes contain required headers. 
However, you should not have troubles installing R on different R 
distributions, 64bits or not.

Hope this help.

Thibaut, 64bit-linux-Ruser and still alive.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] How can I use Adehabitat to obtain an .asc object with the predicted values of a niche model?

2007-12-04 Thread Thibaut Jombart
Núria Roura wrote:

Dear all,
I'm using the package adehabitat in R to import several .asc files(=matrix), 
and also create a kasc object (=dataframe) with all of them.
The main idea is to use this kasc object to map the predicted values 
ofclimate-matching model for an overall area. However, I don't know how 
toproceed: Do I have to project the model (already stored in R) onto the 
kascobject directly, or convert the kasc object to a data frame where each 
rowrefers to a pixel?
On the other hand, I would also like to know how to obtain the XYcoordinates 
for each row of the kasc object. 
Thank you very much. Cheers,
Núria Roura
-- View this message in context: 
http://www.nabble.com/How-can-I-use-Adehabitat-to-obtain-an-.asc-object-with-the-predicted-values-of-a-niche-model--tf4944431.html#a14155047Sent
 from the R help mailing list archive at Nabble.com.
[EMAIL PROTECTED] mailing 
listhttps://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting 
guide http://www.R-project.org/posting-guide.htmland provide commented, 
minimal, self-contained, reproducible code.


  

Dear Nuria,

The mailing list devoted to adehabitat may be a better place for your 
post. See:

http://www.faunalia.com/cgi-bin/mailman/listinfo/animov

Regards,

Thibaut.
-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] PCA with NA

2007-11-23 Thread Thibaut Jombart
Birgit Lemcke wrote:

Dear all,
(Mac OS X 10.4.11, R 2.6.0)
I have a quantitative dataset with a lot of Na´s in it. So many, that  
it is not possible to delete all rows with NA´s and also not  
possible, to delete all variables with NA´s.
Is there a function for a principal component analysis, that can deal  
with so many NA´s.

Thanks in advance

Birgit


Birgit Lemcke
Institut für Systematische Botanik
Zollikerstrasse 107
CH-8008 Zürich
Switzerland
Ph: +41 (0)44 634 8351
[EMAIL PROTECTED]

__
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.



  

Hi,

in centred PCA, missing data should be replaced by the mean of available 
data.
Let X be your analyzed matrix (variables in columns).

##
X = matrix(runif(300),ncol=10)
idx = sample(1:nrow(X),5)
X[idx,] = NA
sum(is.na(X))
[1] 95

library(ade4)
dudi.pca(X,center=TRUE,scale=FALSE)
Erreur dans dudi.pca(X, center = TRUE, scale = FALSE) : na entries in table
##

Now we replace missing values :

##
 f1 - function(vec) {
m - mean(vec, na.rm = TRUE)
vec[is.na(vec)] - m
return(vec)
}

Y = apply(X,2,f1)

pcaY = dudi.pca(Y,center=TRUE,scale=FALSE,nf=2,scannf=FALSE)

s.label(pcaY$li)
sunflowerplot(pcaY$li[idx,1:2], add=TRUE)
##

All missing values are placed at the non-informative point, i.e. at the 
origin.

Regards,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] problem with nb2listw

2007-11-21 Thread Thibaut Jombart
[EMAIL PROTECTED] wrote:

Hi,
I am a new student to R and I was hoping someone could help me with  
the error message I keep getting when I try to use the nb2listw()  
function.

I have 45 sites and I want to get an autocorrelation value for sites  
within 1000m of each other.

coords-cbind(EAST,NORTH)
coords-as.matrix(coords)
nb1000-dnearneigh(coords,0,1000,longlat=TRUE)

then when I try to run the nb2listw(nb1000, style=W)
I get an error message of Empty neighbour sets found. Can someone  
tell me what this means and how to possible fix it.

Thanks
Lynnette

~
Lynnette Dagenais
M.Sc. Candidate
Department of Renewable Resources
University of Alberta
Edmonton, AB

__
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.


  

Hi,
this means that at least on site has no neighbours. Set zero.policy=TRUE 
(you may read ?nb2listw) to avoid getting an error. chooseCN (pack. 
adegenet) could help you choose your connection network interactively.
Cheers,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] shrink a dataframe for plotting

2007-11-21 Thread Thibaut Jombart
Alexy Khrabrov wrote:

I get tables with millions of rows.  For plotting to a screen-size  
jpg, obviously just about 1000 points are enough.  Instead of feeding  
plot() the original millions of rows, I'd rather shrink the original  
dataframe, using some kind of the following interpolation:

-- split dataframe into chunks of N rows each, e.g. 1000 rows each
-- compute average for each column
-- issue one new row of those averages into the shrunk result

Is there any existing package to do that in R?  Otherwise, which R  
idioms are most effective to achieve that?

Cheers,
Alexy


  

Hi,

if you want to extract relevant information from such a table, splitting 
rows in arbitrary chuncks may not solve your problem. Ordinations in 
reduced space are designed for that kind of task, but hierachical 
clustering may also help. See Legendre  Legendre (1998, Numerical 
Ecology, Elsevier) for examples of such methods in Ecology, and the R 
packages ade4, vegan and hclust.

Regards,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] adding an image to a plot

2007-11-20 Thread jombart
Selon Rajarshi Guha [EMAIL PROTECTED]:

 Hi, I'm writing code to generate a plot, in which I draw a series of
 rectangles. So my code is of the form

 plot.new()
 plot.window( ... )

 draw rectangle
 draw rectangle
 ...

 Is there a way for me to insert a PNG or PDF graphic at a specific
 position in the plot (ideally in  plot coordinates)? I realize that
 this might probably be better done in a separate image editor, but if
 it could be done programmatically that would be very handy

 Thanks,

Hi,

you can insert pixmaps at specified coordinates using s.logo in the ade4
package.

Regards,

Thibaut.

__
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.


Re: [R] Romoving elements from a vector. Looking for the opposite of c(), New user

2007-11-15 Thread Thibaut Jombart
Thomas Frööjd wrote:

Not sure i explained it good enough. Ill try with an example

say

x=[3,3,4,4,4,4,5,5,6,8]
z=[3,4,4,5,5]

what i want to get after removing z from x is something like
x=[3,4,4,6,8]


On Nov 15, 2007 3:29 PM, Charilaos Skiadas [EMAIL PROTECTED] wrote:
  

On Nov 15, 2007, at 9:15 AM, Thomas Frööjd wrote:



Hi

I have three vectors say x, y, z. One of them, x contains observations
on a variable. To x I want to append all observations from y and
remove all from z. For appending c() is easily used

x - c(x,y)

But how do I remove all observations in z from x? You can say I am
looking for the opposite of c().
  

If you are looking for the opposite of c, provided you want to remove
the first part of things, then perhaps this would work:

z-c(x,y)
z[-(1:length(x))]

However, if you wanted to remove all appearances of elements of x
from c(x,y), regardless of whether those elements appear in the x
part of in the y part, I think you would want:

z[!z %in% x]

Probably there are other ways.

Welcome to R!



Best regards
  

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College

__
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.




__
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.



  

Hi,

you may try this :

x=[3,3,4,4,4,4,5,5,6,8]
z=c(3,4,4,5,5)

 f1 - function(vec,toremove){
+
+   for(elem in toremove){
+ temp - grep(elem,vec)[1]
+ if(!is.na(temp)) vec - vec[-temp]
+   }
+
+   return(vec)
+ }

  f1(x,z)
[1] 3 4 4 6 8

Regards,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] factors levels ?

2007-11-13 Thread jombart
Hi,
see ?cut

?pretty can also help to define boundaries.

Regards,

Thibaut.

 Hi,

 It's just some example code.. The application is uninteresting. I am
 searching for some functionality.

 X - rnorm(100) //my data

 Y - seq(-3,3,by=0.1) // bin boundaries.

 Now I would like to generate a - list of factors,  length as X...
 i.e.: all values in the range [-3,-2.9) have the same factor... [-3,-2.9)
 etc.

 I would assume R has such a function but I cant recall which one it is.


 --
 W. Eryk Wolski

 __
 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.



__
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.


Re: [R] vectorize a list

2007-11-07 Thread Thibaut Jombart
Frank Schmid wrote:

Dear R user

Suppose I have the following list:

  f - rnorm(2)
  s - rnorm(3)
  l - list(f,s)
  l
[[1]]
[1] 0.31784399 0.08575421

[[2]]
[1] -0.6191679  0.7615479 -1.0087659


Can I stack the entries of this list in 1 vector with the first list 
entry followed by the second? The reference manual says that I can use 
the command /stack/, which can take as arguments either a list or a data 
frame. But taking simply /stack(l)/ does not work, although it is a list.

Many thanks for your hint

Frank Schmid

__
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.


  

Hi,
no need to use stack here:

  l=list(a=1:4,b=5:8)
  l
$a
[1] 1 2 3 4

$b
[1] 5 6 7 8

  unlist(l)
a1 a2 a3 a4 b1 b2 b3 b4
 1  2  3  4  5  6  7  8

Regards,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] Sweave, and long lasting scripts

2007-11-02 Thread Thibaut Jombart
John Lande wrote:

Dear R user,

I am using Sweave to write my reports with R code. Unlucly my code take a
lot of time to run, and I don't want to run it multiple time, if possible,
as I am still developping the tools.

It seems that a sweave run does not save the enviroment at the end of the
process, is there a way to avoid to lunch multiple time the same commands?
maybe it could be possible to store chunck of code results, and only call
them in the next runs.

thank you

   [[alternative HTML version deleted]]

__
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.


  

Hi,

the package 'cacheSweave' seems to fulfil your needs.

Regards,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] Can I create pdfs with dataframes instead of images?

2007-10-29 Thread Thibaut Jombart
Tom.O wrote:

Hi

I am doing some correlation analysis where I graphically display the results
by using image() and then exporting the results in a PDF. I also use the
par(mfrow=c(2,2)) to fit 4 images on the same sheet. But I wonder if it
possible to use the some methodology to export the 4 matrixes on a PDF with
the raw data an getting them in a nice 2*2 pattern with col  row names.

Thanks

Regards Tom

  

Hi,

plotting text is a documented topic. See for instance:

http://tolstoy.newcastle.edu.au/R/e2/help/07/10/27432.html

Regards,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] PDF output

2007-10-29 Thread Thibaut Jombart
Pedro de Barros wrote:

Dear All,

I am trying to save a plot made with ggplot as pdf.

I just created the plot, then printed it to the default graphics 
device (screen). I then tried to create a pdf file choosing (from the 
menus) File-Save As-PDF file. However, I get an error  as
Error: Invalid font type
In addition: Warning messages:
1: font family not found in PostScript font database
2: font family not found in PostScript font database

I am using R2.6.0 on Windows.
I would appreciate any help about how to solve this

Thanks,
Pedro
  

Hi,

may you provide a code sample (commands producing the figure) to try and 
reproduce this error ?

Thibaut.
-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] how to split data.frame by row?

2007-10-29 Thread Thibaut Jombart
Henrique Dallazuanna wrote:

If I understand your question:

df - data.frame(x=rnorm(20), y=rnorm(20), z=rnorm(20))
df - as.matrix(df)
dim(df)
dim(df) - c(10,6)
dim(df) - c(5,12)

On 29/10/2007, Weiwei Shi [EMAIL PROTECTED] wrote:
  

hi,

if I have 20 x 3 data.frame, how to split it into
10 x 6 (moving the lower part of 10x3 to column)

or

5 x 12

thanks



Hi,

I am not sure that the produced result is what is looked for; however 
the question is not clear to me either.

The indicated code gives:

df=data.frame(x=1:4,y=5:8)
df=as.matrix(df)
df
newdf=df
dim(newdf) = c(2,4)
newdf

while I would have thought that :

newdf=cbind(df[1:2,], df[3:4,])
newdf

was what was looked for.

But there may be a quicker way.

Regards,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] Help needed on calculation of Moran's I

2007-10-26 Thread Thibaut Jombart
Geertje Van der Heijden wrote:

Hi,

I am trying to calculate Moran's I test for the residuals for a
regression equation, but I have trouble converting my  coordinates into
nb format.

I have used the dnearneigh() funtion now with an arbitrarily high upper
distance to make it include all plots. However, when I do the
lm.morantest() I get a Moran's I value which is the same as the expected
value and a P-value of 1.

I have used the following code:
  

attach(lowland)
coords - as.matrix(cbind(long, $lat))
coord.nb - dnearneigh(coords, 0, 1 longlat=TRUE)
coord.list - nb2listw(coord.nb, style=W)
lianasp.lm - lm(lianasprich ~ log(averdist) + dsl + lianadens +


wooddens)
  

lm.morantest(lianasp.lm, coord.list, alternative=two.sided)



And get the following result

Global Moran's I for regression residuals

data:  
model: lm(formula = lianasprich ~ log(averdist) + dsl + lianadens +
wooddens)
weights: coord.list
 
Moran I statistic standard deviate = 0, p-value = 1
alternative hypothesis: two.sided 
sample estimates:
Observed Moran's IExpectation   Variance 
 -1.754386e-02  -1.754386e-02   2.125706e-16 

Can anyone tell me where I went wrong or if there is another way to
generate a nb list? 

Many thanks,
Geertje
  

Hi,

did you have a look at the graph you produced (using plot.nb)? Maybe the 
maximum distance between any two neighbours is too high. What does 
max(dist(coords)) say ?
Anyway, there are many different connection networks available in 
several R packages, some being more appropriate than others to model 
paticular spatial distributions.

The package adegenet proposes a small tool to choose among several 
graphs interactively:

library(adegenet)
xy = matrix(runif(100),ncol=2)
yourcn = chooseCN(xy)

Regards,

Thibaut.

-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibaut-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.


Re: [R] Spatial autocorrelation

2007-10-22 Thread Thibaut Jombart
Geertje Van der Heijden wrote:

Hi,

I have collected data on trees from 5 forest plots located within the
same landscape. Data within the plots are spatially autocorrelated
(calculated using Moran's I). I would like to do a ANCOVA type of
analysis combining these five plots, but the assumption that there is no
autocorrelation in the residuals is obviously violated. Does anyone have
any ideas how to incorporate these spatial effects in my analysis? I
have been reading up on autoregressive techniques, but I am not sure if
it works with more than one plot.

All help is greatly appreciated!

Many thanks,
Geertje van der Heijden

  

Hi,

one way to remove spatial autocorrelation is to use Moran's Eigenvectors
as predictors in multiple regression. But as there are always n-1
vectors for n points, you will have to choose the predictors to be
retained (using standard model selection procedures).

Here is an example of how to get the eigenvectors using the ade4 and
spdep packages.

library(ade4)
library(spdep)
library(adegenet)

xy = matrix(rnorm(100),ncol=2)
plot(xy)

# get a connection network (here, Delaunay triangulation)
cn = chooseCN(xy,ask=FALSE,res=listw)$cn

# get Moran's Eigenvectors
U = orthobasis.listw(cn)

# visualize the first 9 vectors
par(mfrow=c(3,3))
for(i in 1:9) s.value(xy,U[,i],addaxes=FALSE, include.ori=FALSE)

And then you can use the columns of U as spatial predictors in your
model. A few vectors should be able to remove the autocorrelation among
residuals.

Regards,

Thibaut.
-- 
##
Thibaut JOMBART
CNRS UMR 5558 - Laboratoire de Biométrie et Biologie Evolutive
Universite Lyon 1
43 bd du 11 novembre 1918
69622 Villeurbanne Cedex
Tél. : 04.72.43.29.35
Fax : 04.72.43.13.88
[EMAIL PROTECTED]
http://lbbe.univ-lyon1.fr/-Jombart-Thibault-.html?lang=en
http://pbil.univ-lyon1.fr/software/adegenet/

__
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.