Re: [R-sig-phylo] Calculating branch lengths on a multiphylo object

2016-01-01 Thread Michael Pauers
Dear Klaus,

You were correct.  This fixed the problem.

Many thanks,

Mike

On Fri, Jan 1, 2016 at 5:41 PM, Klaus Schliep 
wrote:

> Happy New Year,
> it seems you have not properly installed the packages and you may want
> also update R.
> Cheers, Klaus
>
> On Fri, Jan 1, 2016 at 12:34 AM, Michael Pauers 
> wrote:
>
>> Dear list,
>>
>> First, Happy New Year!
>>
>> Second, I will apologize in advance, as I am nothing more than a duffer
>> with R, so I may ask several follow-up questions to this one.
>>
>> I have a set of 1000 trees that lack branch lengths.  I have used
>> previously used ape to calculate branch lengths on a single tree, but
>> never
>> on a multiphylo object.  I did find and have tried the approach documented
>> at this link:
>>
>> http://blog.phytools.org/2015/04/phylogenetic-regression-when-branch.html
>>
>> but I received a few error messages, including:
>>
>> > library(phytools)
>> Error in gzfile(file, "rb") : cannot open the connection
>> In addition: Warning messages:
>> 1: package ‘phytools’ was built under R version 3.0.3
>> 2: In read.dcf(file.path(p, "DESCRIPTION"), c("Package", "Version")) :
>>   cannot open compressed file 'C:/Program
>> Files/R/R-3.0.2/library/ape/DESCRIPTION', probable reason 'No such file or
>> directory'
>> 3: In gzfile(file, "rb") :
>>   cannot open compressed file '', probable reason 'No such file or
>> directory'
>> > library(phangorn)
>> Error in gzfile(file, "rb") : cannot open the connection
>> In addition: Warning messages:
>> 1: package ‘phangorn’ was built under R version 3.0.3
>> 2: In read.dcf(file.path(p, "DESCRIPTION"), c("Package", "Version")) :
>>   cannot open compressed file 'C:/Program
>> Files/R/R-3.0.2/library/ape/DESCRIPTION', probable reason 'No such file or
>> directory'
>> 3: In gzfile(file, "rb") :
>>   cannot open compressed file '', probable reason 'No such file or
>> directory'
>>
>> and:
>>
>> > library(ape)
>> > ## simulate 200 pure-birth trees:
>> > trees<-ttrees<-pbtree(n=50,scale=1,nsim=200)
>> Error: could not find function "pbtree"
>> > ## ttrees contains the trees with their original branch lengths
>> > ## we'll perform manipulations on trees
>> > foo<-function(tree){
>> + obj<-fastBM(tree,nsim=2)
>> + colnames(obj)<-c("x","y")
>> + as.data.frame(obj)
>> + }
>> > xy<-lapply(ttrees,foo)
>> Error in lapply(ttrees, foo) : object 'ttrees' not found
>> > library(nlme)
>> > fit.model<-function(tree,data){
>> + data$v<-diag(vcv.phylo(tree))
>> + fit<-gls(y~x,data=data,correlation=corBrownian(1,tree),
>> + weights=varFixed(~v))
>> + setNames(c(coefficients(fit)[2],anova(fit)$"p-value"[2]),
>> + c("beta","p-value"))
>> + }
>> > fit.true<-t(mapply(fit.model,trees,xy))
>> Error in mapply(fit.model, trees, xy) : object 'xy' not found
>> > mean(fit.true[,1]) ## should be zero
>> Error in mean(fit.true[, 1]) : object 'fit.true' not found
>> > noogtree<-lapply(noogtree,compute.brlen)
>> > class(noogtree)<-"multiPhylo"
>> > fit.grafen<-t(mapply(fit.model,noogtree,xy))
>> Error in mapply(fit.model, noogtree, xy) : object 'xy' not found
>> > utils:::menuInstallPkgs()
>> Error in install.packages(NULL, .libPaths()[1L], dependencies = NA, type =
>> type) :
>>   no packages were specified
>> > fit.grafen<-t(mapply(fit.model,noogtree))
>> Error in data$v <- diag(vcv.phylo(tree)) :
>>   argument "data" is missing, with no default
>> > fit.grafen<-t(mapply(fit.model,noogtree,xy))
>> Error in mapply(fit.model, noogtree, xy) : object 'xy' not found
>> > mean(fit.grafen[,1])
>> Error in mean(fit.grafen[, 1]) : object 'fit.grafen' not found
>> > foo<-function(tree){
>> + tree$edge.length<-rep(1,nrow(tree$edge))
>> + tree
>> + }
>> > trees<-lapply(ttrees,foo)
>> Error in lapply(ttrees, foo) : object 'ttrees' not found
>> > class(trees)<-"multiPhylo"
>> > fit.equal<-t(mapply(fit.model,trees,xy))
>> Error in mapply(fit.model, trees, xy) : object 'xy' not found
>> > mean(fit.equal[,1]) ## should be zero
>> Error in mean(fit.equal[, 1]) : object 'fit.equal' not found
>>
>> Does anyone have any advice?  Please let me know if I should provide more
>> information.
>>
>> Thanks in advance,
>>
>> Mike Pauers
>>
>> [[alternative HTML version deleted]]
>>
>> ___
>> R-sig-phylo mailing list - R-sig-phylo@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
>> Searchable archive at
>> http://www.mail-archive.com/r-sig-phylo@r-project.org/
>
>
>
>
> --
> Klaus Schliep
> Postdoctoral Fellow
> Revell Lab, University of Massachusetts Boston
>
>

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

[R-sig-phylo] Error in .jinit() : Cannot create Java virtual machine (-6) using dismo

2016-01-01 Thread Agus Camacho
Dear list,

Im confronting this error in a script i have long used before without
problems. I've been searching through the internet and despite several
reports of similar errors, could not find an appropriate solution.

Some times, i get this additional error:

Error in .getMeVersion() : file missing:
C:/Users/Agus/Documents/R/win-library/3.2/dismo/java/maxent.jar.
Please download it here: http://www.cs.princeton.edu/~schapire/maxent/

I have already reset Rstudio several times after reinstalling dismo and
rJava, and downloading and installing these files.

Im using windows10 but is upgraded to work as win 7.

My session info is:

R version 3.2.1 (2015-06-18)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C

[5] LC_TIME=English_United States.1252

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

other attached packages:
 [1] foreign_0.8-63 plyr_1.8.3 maptools_0.8-36
 geosphere_1.4-3rgdal_1.0-7
 [6] rJava_0.9-7outliers_0.14  XML_3.98-1.3
PBSmapping_2.69.76 rgeos_0.3-12
[11] reshape_0.8.5  dismo_1.0-12   raster_2.4-15  sp_1.1-1


loaded via a namespace (and not attached):
[1] Rcpp_0.12.0 lattice_0.20-31 grid_3.2.1  tools_3.2.1

Thanks in advance
-- 
Agustín Camacho Guerrero.
Doutor em Zoologia.
Laboratório de Herpetologia, Departamento de Zoologia, Instituto de
Biociências, USP.
Rua do Matão, trav. 14, nº 321, Cidade Universitária,
São Paulo - SP, CEP: 05508-090, Brasil.

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

Re: [R-sig-phylo] Calculating branch lengths on a multiphylo object

2016-01-01 Thread Klaus Schliep
Happy New Year,
it seems you have not properly installed the packages and you may want also
update R.
Cheers, Klaus

On Fri, Jan 1, 2016 at 12:34 AM, Michael Pauers  wrote:

> Dear list,
>
> First, Happy New Year!
>
> Second, I will apologize in advance, as I am nothing more than a duffer
> with R, so I may ask several follow-up questions to this one.
>
> I have a set of 1000 trees that lack branch lengths.  I have used
> previously used ape to calculate branch lengths on a single tree, but never
> on a multiphylo object.  I did find and have tried the approach documented
> at this link:
>
> http://blog.phytools.org/2015/04/phylogenetic-regression-when-branch.html
>
> but I received a few error messages, including:
>
> > library(phytools)
> Error in gzfile(file, "rb") : cannot open the connection
> In addition: Warning messages:
> 1: package ‘phytools’ was built under R version 3.0.3
> 2: In read.dcf(file.path(p, "DESCRIPTION"), c("Package", "Version")) :
>   cannot open compressed file 'C:/Program
> Files/R/R-3.0.2/library/ape/DESCRIPTION', probable reason 'No such file or
> directory'
> 3: In gzfile(file, "rb") :
>   cannot open compressed file '', probable reason 'No such file or
> directory'
> > library(phangorn)
> Error in gzfile(file, "rb") : cannot open the connection
> In addition: Warning messages:
> 1: package ‘phangorn’ was built under R version 3.0.3
> 2: In read.dcf(file.path(p, "DESCRIPTION"), c("Package", "Version")) :
>   cannot open compressed file 'C:/Program
> Files/R/R-3.0.2/library/ape/DESCRIPTION', probable reason 'No such file or
> directory'
> 3: In gzfile(file, "rb") :
>   cannot open compressed file '', probable reason 'No such file or
> directory'
>
> and:
>
> > library(ape)
> > ## simulate 200 pure-birth trees:
> > trees<-ttrees<-pbtree(n=50,scale=1,nsim=200)
> Error: could not find function "pbtree"
> > ## ttrees contains the trees with their original branch lengths
> > ## we'll perform manipulations on trees
> > foo<-function(tree){
> + obj<-fastBM(tree,nsim=2)
> + colnames(obj)<-c("x","y")
> + as.data.frame(obj)
> + }
> > xy<-lapply(ttrees,foo)
> Error in lapply(ttrees, foo) : object 'ttrees' not found
> > library(nlme)
> > fit.model<-function(tree,data){
> + data$v<-diag(vcv.phylo(tree))
> + fit<-gls(y~x,data=data,correlation=corBrownian(1,tree),
> + weights=varFixed(~v))
> + setNames(c(coefficients(fit)[2],anova(fit)$"p-value"[2]),
> + c("beta","p-value"))
> + }
> > fit.true<-t(mapply(fit.model,trees,xy))
> Error in mapply(fit.model, trees, xy) : object 'xy' not found
> > mean(fit.true[,1]) ## should be zero
> Error in mean(fit.true[, 1]) : object 'fit.true' not found
> > noogtree<-lapply(noogtree,compute.brlen)
> > class(noogtree)<-"multiPhylo"
> > fit.grafen<-t(mapply(fit.model,noogtree,xy))
> Error in mapply(fit.model, noogtree, xy) : object 'xy' not found
> > utils:::menuInstallPkgs()
> Error in install.packages(NULL, .libPaths()[1L], dependencies = NA, type =
> type) :
>   no packages were specified
> > fit.grafen<-t(mapply(fit.model,noogtree))
> Error in data$v <- diag(vcv.phylo(tree)) :
>   argument "data" is missing, with no default
> > fit.grafen<-t(mapply(fit.model,noogtree,xy))
> Error in mapply(fit.model, noogtree, xy) : object 'xy' not found
> > mean(fit.grafen[,1])
> Error in mean(fit.grafen[, 1]) : object 'fit.grafen' not found
> > foo<-function(tree){
> + tree$edge.length<-rep(1,nrow(tree$edge))
> + tree
> + }
> > trees<-lapply(ttrees,foo)
> Error in lapply(ttrees, foo) : object 'ttrees' not found
> > class(trees)<-"multiPhylo"
> > fit.equal<-t(mapply(fit.model,trees,xy))
> Error in mapply(fit.model, trees, xy) : object 'xy' not found
> > mean(fit.equal[,1]) ## should be zero
> Error in mean(fit.equal[, 1]) : object 'fit.equal' not found
>
> Does anyone have any advice?  Please let me know if I should provide more
> information.
>
> Thanks in advance,
>
> Mike Pauers
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> Searchable archive at
> http://www.mail-archive.com/r-sig-phylo@r-project.org/




-- 
Klaus Schliep
Postdoctoral Fellow
Revell Lab, University of Massachusetts Boston

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/