[R] External functions called by my functions

2015-09-30 Thread Frederico Mestre
Hello,

Is there any way to list all the functions called inside
​a given set of​
 functions?

Something like the function foodweb from mvbutils.
​ This function maps the relations between the functions of a package, but
what I need is something to show me the relations with external functions.

Thanks,


​
​Frederico Mestre – mestre.freder...@gmail.com
ResearchGate: https://www.researchgate.net/profile/Frederico_Mestre
Conservation Biology Unit (UBC)
Research Center in Biodiversity and Genetic Resources – Évora  (CIBIO-UE)
Research Group in Applied Ecology (ApplEcol)
University of Évora
Biology Department
Núcleo da Mitra
7002 – 554 – Évora
PORTUGAL​

[[alternative HTML version deleted]]

__
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] Error loading workspace

2014-12-04 Thread Frederico Mestre
Hello,

I'm trying to load a workspace and I'm getting this error:

value of 'SET_ATTRIB' must be a pairlist or NULL, not a 'double'

Is there anything I can do to correct this?

Cheers,
Frederico Mestre

[[alternative HTML version deleted]]

__
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] Generate quasi-random positive numbers

2014-08-05 Thread Frederico Mestre
Hello all:

Is it possible to generate quasi-random positive numbers, given a standard
deviation and mean? I need all positive values to have the same probability
of selection (uniform distribution). Something like:

runif(10, min = 0, max = 100)

This way I'm generating random positive numbers from a uniform
distribution. However, using runif I can't previously select SD and mean
(as in rnorm).

Alternatively, I'm able to generate a list of quasi-random numbers given a
SD and a mean.

b <- (sqrt(SD^2*12)+(MEAN*2))/2
a <- (MEAN*2) - b
x1 <- runif(N,a,b)

However, negative values might be included, since "a" can assume a negative
value.

Any help?

Thanks,
Frederico

[[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] filling list of data frames

2013-06-27 Thread Frederico Mestre
Hello:

 

I have a list of data frames, built like this: the second df is a result of
a function applied to the first, and so on.

 

So the ith df is always dependent on the (i-1)th df. I've been doing this
using for loops. However I think I have too many for loops which is making
my code run slowly.

 

Is there any workaround  this? How can I avoid the use of for loops?

 

As an example:

 

output.list <- as.list(rep("", 100))#creation of a list

 

output.list[[1]] <- df1#first position

 

 

for(I in 2:100){#following positions

 

df0 <- output.list[[i-1]]

 

df0_1 <- f1(df0)#function applied to the previous df

 

output.list[[i]] <- df0_1#new df

 

}

 

thanks,

 

Frederico 

 

 


[[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] RES: adding points to a point pattern

2012-09-03 Thread Frederico Mestre
Hello,

Yes, I'm using spatstat.

Sorry, I forgot to mention that.

Thanks,

Frederico 



-Mensagem original-
De: Rolf Turner [mailto:rolf.tur...@xtra.co.nz] 
Enviada em: terça-feira, 4 de Setembro de 2012 02:04
Para: Frederico Mestre
Cc: r-help@r-project.org; adrian.badde...@csiro.au
Assunto: Re: [R] adding points to a point pattern

On 04/09/12 11:58, Frederico Mestre wrote:
> Hello all:
>
>   
>
> Is there any way to add points to a point pattern, while keeping a 
> given minimum distance amongst this new points and the pre-existing
points?
>

Presumably this is a question about the "spatstat" package.

If so, the answer is "yes".  At least two ways:

(1) Using rmh() --- need to specify "beta" (the "chemical" activity
parameter).  E.g.

# Generate a "test pattern" to which to add points.
set.seed(42)
X <- rSSI(0.05,100)

# Add points.
M <- rmhmodel(cif="hardcore",par=list(beta=300,hc=0.05))
Y  <-
rmh(M,start=list(x.start=X),expand=1,control=list(x.cond=as.data.frame(X)))
plot(Y,main="Pattern with points added via rmh")
plot(X,add=TRUE,chars=20,cols="red")
print(min(nndist(Y)))

(2) Using rSSI() --- need to specify the *total number* of points desired.
E.g.

# Add points to the same "test pattern", in a different way.
Z <- rSSI(0.05,npoints(X)+42,x.init=X)
plot(Z,main="Pattern with points added via rSSI")
plot(X,add=TRUE,chars=20,cols="red")
print(min(nndist(Z)))

HTH

 cheers,

 Rolf Turner

__
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] RES: adding points to a point pattern

2012-09-03 Thread Frederico Mestre
Hello,

I'm trying to make a function in R in which I need to do this.

Frederico 


-Mensagem original-
De: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] 
Enviada em: terça-feira, 4 de Setembro de 2012 01:30
Para: Frederico Mestre; r-help@r-project.org
Assunto: Re: [R] adding points to a point pattern

Perhaps.

What does this have to do with R?
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
---
Sent from my phone. Please excuse my brevity.

Frederico Mestre  wrote:

>Hello all:
>
> 
>
>Is there any way to add points to a point pattern, while keeping a 
>given minimum distance amongst this new points and the pre-existing 
>points?
>
> 
>
>Thanks,
>
> 
>
>Frederico
>
> 
>
>
>   [[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.


[R] adding points to a point pattern

2012-09-03 Thread Frederico Mestre
Hello all:

 

Is there any way to add points to a point pattern, while keeping a given
minimum distance amongst this new points and the pre-existing points?

 

Thanks,

 

Frederico 

 


[[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] cluster of points

2012-07-30 Thread Frederico Mestre
Hello:

 

What I want to do is quite simple, but I can't find a way.

 

I have a data frame with several points (x and y coords). I want to add
another column with cluster membership. For example aggregate all the points
that stand within a distance of 40 from each other. 

 

I've tried using "nncluster" from the package nnclust, but the results are
not correct, for some reason (probably my mistake).

 

This is what I did:

 

x <- nncluster(as.matrix(dframe[,1:2]), threshold=35, fill = 1, maxclust =
NULL, give.up = 500,verbose=FALSE,start=NULL)#avaliar as clusters 

 

Thanks,

 

Frederico

 


[[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] C++ and R

2012-06-29 Thread Frederico Mestre
Hello:

 

I have some C++ code and I want to know if it is ok to load it into R using
.Call.

 

Also, what's the difference between using Rdefines.h or Rinternals.h
headers? It is just in the used macros?

 

I've been reading "Writing R Extensions" but I'm a bit confused.

 

Thanks,

 

Frederico

 


[[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] RES: Compile C files

2012-06-26 Thread Frederico Mestre
Hello:

I just reinstalled R and Rtools. 

It works perfectly now.

Thanks,

Frederico 



-Mensagem original-
De: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] 
Enviada em: quarta-feira, 27 de Junho de 2012 01:06
Para: Frederico Mestre
Cc: r-help@r-project.org
Assunto: Re: [R] Compile C files

On 12-06-26 2:48 PM, Frederico Mestre wrote:
> Hello:
>
>
>
> Sorry, this might look like a beginner question, but I'm just starting 
> to work on the C and R interface.
>
>
>
> I'm trying to compile a C file (with a function) to load it to an R 
> function but, in the command line I keep getting a lot of errors, like:

You'll need to tell us what you did before  you can expect us to interpret
the error messages.

Duncan Murdoch

>
>
>
> "C:/Program~1/R/R-215~1.0/include/Rinternals.h:1066:1: error: expected 
> declaration specifiers before 'SEXP'"
>
>
>
> I've been able to compile this file before, so I
>
>
>
> I'm using Windows 7 in a 64 bits computer.
>
>
>
> Best regards,
>
>
>
> Frederico
>
>
>
>
>   [[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.


[R] Compile C files

2012-06-26 Thread Frederico Mestre
Hello:

 

Sorry, this might look like a beginner question, but I'm just starting to
work on the C and R interface.

 

I'm trying to compile a C file (with a function) to load it to an R function
but, in the command line I keep getting a lot of errors, like:

 

"C:/Program~1/R/R-215~1.0/include/Rinternals.h:1066:1: error: expected
declaration specifiers before 'SEXP'"

 

I've been able to compile this file before, so I 

 

I'm using Windows 7 in a 64 bits computer.

 

Best regards,

 

Frederico 

 


[[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] Error: cannot allocate vector of size...

2012-04-10 Thread Frederico Mestre
Hello:

 

While running R doing the analysis of my data I (using packages such as
BIOMOD or e1071) get the following error as a result of several of my
analysis:

 

Error: cannot allocate vector of size 998.5 Mb

In addition: Warning messages:

1: In array(c(rep.int(c(1, numeric(n)), n - 1L), 1), d, dn) :

  Reached total allocation of 4095Mb: see help(memory.size)

2: In array(c(rep.int(c(1, numeric(n)), n - 1L), 1), d, dn) :

  Reached total allocation of 4095Mb: see help(memory.size)

3: In array(c(rep.int(c(1, numeric(n)), n - 1L), 1), d, dn) :

  Reached total allocation of 4095Mb: see help(memory.size)

4: In array(c(rep.int(c(1, numeric(n)), n - 1L), 1), d, dn) :

  Reached total allocation of 4095Mb: see help(memory.size)

 

My question is: I've done the analysis of this same data in the same
computer and everything worked out fine. Now I get this error as a result of
several analysis. What changed?

 

I'm running R in a 64 bits, Windows 7 , 4 GB of RAM computer.

 

Thanks,

Frederico Mestre

 


[[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] delete all columns with all values equal to zero

2011-12-22 Thread Frederico Mestre
Hello all:

 

I'm sure this is quite simple, but I tried several options and I still can't
get I right.

 

I've got a data.frame and I want to delete all columns of which the sum is
zero.

 

Any ideas? Thanks,

 

Frederico Mestre

 


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