Re: [R] Regarding new version of R library

2014-12-02 Thread Jeff Newmiller
I suggest that you contact the maintainer of that package, who should be identified by using the maintainer function (see ?maintainer) or on the website where you obtained it. --- Jeff NewmillerThe

[R] Add group name in barchart

2014-12-02 Thread Silong Liao
Dear ALL, I have a dataset contains 2 variables: mate (mating groups) and ratio (ratio of number of mothers and fathers). And mate is an identifer which consists three components: year, flock (flk), and tag. I am using command "barchart" under package "lattice" to generate plots of ratio aga

Re: [R] Profiling a C/C++ library from R

2014-12-02 Thread Duncan Murdoch
On 02/12/2014, 4:43 PM, Charles Novaes de Santana wrote: > Dear all, > > I am running a c++ library (a .so file) from a R code. I am using the > function dyn.load("lib.so") to load the library. Do you know a way to > profile my C library from R? Or should I compile my C library as an > executable

Re: [R] Profiling a C/C++ library from R

2014-12-02 Thread Martin Morgan
On 12/02/2014 01:43 PM, Charles Novaes de Santana wrote: Dear all, I am running a c++ library (a .so file) from a R code. I am using the function dyn.load("lib.so") to load the library. Do you know a way to profile my C library from R? Or should I compile my C library as an executable and profil

Re: [R] if else for cumulative sum error

2014-12-02 Thread David L Carlson
Let's try a different approach. You don't need a loop for this. First we need a reproducible example: > set.seed(42) > dadosmax <- data.frame(above=runif(150) + .5) Now compute your sums using cumsum() and diff() and then compute enchday using ifelse(). See the manual pages for each of these fu

Re: [R] How to have NLME return when convergence not reached

2014-12-02 Thread Bert Gunter
Yes, Bill almost always has helpful ideas. Just a comment: If indeed the process is gobbling up too much memory, that might indicate a problem with your function or implementation. I defer to real experts on this, however. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-73

Re: [R] How to have NLME return when convergence not reached

2014-12-02 Thread Ramiro Barrantes
Thanks so much for your reply. I am using try but nlme never returns!! and I think the process is getting killed by the system as it is taking over all the memory. However, I do like William Dunlap's idea of using R.utils::withTimeout to limit the time. Thanks again for your help! __

Re: [R] How to have NLME return when convergence not reached

2014-12-02 Thread Ramiro Barrantes
Great suggestion!! Will give that a try. From: William Dunlap [wdun...@tibco.com] Sent: Tuesday, December 02, 2014 4:49 PM To: Ramiro Barrantes Cc: r-help@r-project.org Subject: Re: [R] How to have NLME return when convergence not reached You could try using R.uti

Re: [R] How to have NLME return when convergence not reached

2014-12-02 Thread William Dunlap
You could try using R.utils::withTimeout(expr, timeout=10) to cause an error when evaluating the expression expr takes longer than 10 seconds. Wrap that in tryCatch or try to catch the error and examine the outputs of lapply for ones of class "TimeoutException" to find the ones that took too long.

[R] Profiling a C/C++ library from R

2014-12-02 Thread Charles Novaes de Santana
Dear all, I am running a c++ library (a .so file) from a R code. I am using the function dyn.load("lib.so") to load the library. Do you know a way to profile my C library from R? Or should I compile my C library as an executable and profile it using the typical C-profilers? Thanks in advance for

Re: [R] How to have NLME return when convergence not reached

2014-12-02 Thread Bert Gunter
?try Or ?tryCatch Bert Sent from my iPhone -- please excuse typos. > On Dec 2, 2014, at 12:57 PM, Ramiro Barrantes > wrote: > > Hello, > > I am trying to fit many hundreds of simulated datasets using NLME (it's all > in a big loop in R). Some don't seem to converge. I am working on > ad

[R] How to have NLME return when convergence not reached

2014-12-02 Thread Ramiro Barrantes
Hello, I am trying to fit many hundreds of simulated datasets using NLME (it's all in a big loop in R). Some don't seem to converge. I am working on addressing the issues by perhaps adjusting my simulation, or tweaking iteration steps in nlme, etc. However, when it doesn't converge, NLME jus

Re: [R] if else for cumulative sum error

2014-12-02 Thread David Winsemius
On Dec 2, 2014, at 12:26 PM, Jefferson Ferreira-Ferreira wrote: > Thank you for replies. > > David, > > I tried your modified form > > for (i in 1:seq_along(rownames(dadosmax))){ No. it is either 1: or seq_along(...). in this case perhaps 1:(nrow(dadosmax)-44 would be safer You do not

Re: [R] if else for cumulative sum error

2014-12-02 Thread Jefferson Ferreira-Ferreira
Thank you for replies. David, I tried your modified form for (i in 1:seq_along(rownames(dadosmax))){ dadosmax$enchday[i] <- if ( (sum(dadosmax$above[i:(i+44)])) >= 45) 1 else 0 } However, I'm receiving this warning: Warning message: In 1:seq_along(rownames(dadosmax)) : numerical expression

Re: [R] FW: R Statistics

2014-12-02 Thread William Dunlap
You can do this in 2 steps - have cut() make a factor with a different level for each time period then use levels<-() to merge some of the levels. > z <- cut(.5:3.5, breaks=c(0,1,2,3,4), labels=c("0-1", "1-2", "2-3", "3-4")) > levels(z) [1] "0-1" "1-2" "2-3" "3-4" > levels(z) <- c("betw

[R] FW: R Statistics

2014-12-02 Thread Dries David
> > Hey > > I have a question about making a new variable in R. I have put my dataset > > in attachment. I have to make a new variable "spits" where spits=morning > > when uurenminuut (also a variabel) is between 5.30 and 9.30, when > > uurenminuut is between 16.30 and 19.0 spits has to be equa

[R] Regarding new version of R library

2014-12-02 Thread Sonika Saxena
Respected Sir, i am using library(galgo).But it is old version .i want to installed new version for R 3.0 for windows 7.at the timing of installing this message show this version not installing foe R 3.0,please re-installed ,so please guide me how to installed this library.sir my project is paused

Re: [R] function to avoid <<-

2014-12-02 Thread Adams, Jean
Glad to see this query and the responses. You all just helped me to eliminate the use of global variables from my R package. I knew they were not recommended, but I didn't know how to get around using them. Thanks! Jean On Tue, Dec 2, 2014 at 10:59 AM, Karim Mezhoud wrote: > OK thanks as: >

Re: [R] move date-values from one line to several lines

2014-12-02 Thread Jeff Newmiller
On Tue, 2 Dec 2014, Marc Schwartz wrote: On Dec 2, 2014, at 9:29 AM, Matthias Weber wrote: Hello together, i have a data.frame with date-values. What I want is a data.frame with a several lines for each date. My current data.frame looks like this one: ID FROM TO

[R] How to fill rainbow colors under curves in R

2014-12-02 Thread Zilefac Elvis via R-help
Hi All, I have a tricky problem here. The short code below plots some percentiles from a simulation. The percentiles are indicated in different colors. Problem: - How can I fill the area under the curve using the same colors as for the percentiles-1? - Also, I would like the rainbow intensity t

Re: [R] if else for cumulative sum error

2014-12-02 Thread John McKown
On Tue, Dec 2, 2014 at 12:08 PM, Jefferson Ferreira-Ferreira < jeco...@gmail.com> wrote: > Hello everybody; > > I'm writing a code where part of it is as follows: > > for (i in nrow(dadosmax)){ > dadosmax$enchday[i] <- if (sum(dadosmax$above[i:(i+44)]) >= 45) 1 else 0 > } > ​Without some test d

Re: [R] if else for cumulative sum error

2014-12-02 Thread David Winsemius
On Dec 2, 2014, at 10:08 AM, Jefferson Ferreira-Ferreira wrote: > Hello everybody; > > I'm writing a code where part of it is as follows: > > for (i in nrow(dadosmax)){ > dadosmax$enchday[i] <- if (sum(dadosmax$above[i:(i+44)]) >= 45) 1 else 0 > } > > That is for each row of my data frame, su

[R] if else for cumulative sum error

2014-12-02 Thread Jefferson Ferreira-Ferreira
Hello everybody; I'm writing a code where part of it is as follows: for (i in nrow(dadosmax)){ dadosmax$enchday[i] <- if (sum(dadosmax$above[i:(i+44)]) >= 45) 1 else 0 } That is for each row of my data frame, sum an specific column (0 or 1) of that row plus 44 rows. If It is >=45 than enchday

Re: [R] specifying a structural equation model with sem

2014-12-02 Thread John Fox
Dear David, There's nothing wrong with what you did: You've fit the independence model and a one-factor CFA model as I believe you intended. It's unnecessary to fit the first model because sem() computes the chisquare for the independence model in any event, and (as the message printed by speci

[R] R installation

2014-12-02 Thread VG
Hi everyone, I was having trouble with R i installed some time ago on my local ubuntu machine. So i removed R completely from my system in order to re install it. I used these commands to install R sudo apt-get install r-base r-base-dev Then on the terminal I typed which R: it returns /usr/bin/R

[R] help

2014-12-02 Thread Alejandra Chovar Vera
Dear R I have a big problem in my estimation process, I try to estimate my likelihood function with the option "optim", but R give me this message "Error en optim(par = valores$par, nlogL, method = "BFGS", hessian = T, : valor inicial en 'vmmin' no es finito " I know this is because my initia

Re: [R] function to avoid <<-

2014-12-02 Thread Karim Mezhoud
OK thanks as: myenv <- new.env(parent = emptyenv()) fun <- function(){ fun1 <- function(){ myenv$X <- 5 } } fun() ls(myenv) #X X #5 Ô__ c/ /'_;kmezhoud (*) \(*) ⴽⴰⵔⵉⵎ ⵎⴻⵣⵀⵓⴷ http://bioinformatics.tn/ On Tue, Dec 2, 2014 at 5:47 PM, Greg Snow <538...@gmail.com> wrote: > By "At the t

Re: [R] function to avoid <<-

2014-12-02 Thread Greg Snow
By "At the top level" Hadley meant to put that code outside of the function definition. In you source file that line should be very near the top, before any function definitions. Then "myenv" will not be temporary (well it will go away when you end the R session). Further, when this code is comp

Re: [R] function to avoid <<-

2014-12-02 Thread Karim Mezhoud
Thanks Dr Hadley, but when I use a function the myenv remains temporary and I am to face the same problem. fun <- function(){ myenv <- new.env(parent = emptyenv()) fun1 <- function(){ myenv$X <- 5 } } ls(myEnv) #character(0) Ô__ c/ /'_;kmezhoud (*) \(*) ⴽⴰⵔⵉⵎ ⵎⴻⵣⵀⵓⴷ http://bioinfo

Re: [R] move date-values from one line to several lines

2014-12-02 Thread Marc Schwartz
> On Dec 2, 2014, at 9:29 AM, Matthias Weber > wrote: > > Hello together, > > i have a data.frame with date-values. What I want is a data.frame with a > several lines for each date. > > My current data.frame looks like this one: > > ID FROM TOREASON > 1 2015

[R] move date-values from one line to several lines

2014-12-02 Thread Matthias Weber
Hello together, i have a data.frame with date-values. What I want is a data.frame with a several lines for each date. My current data.frame looks like this one: ID FROM TOREASON 1 2015-02-27 2015-02-28Holiday 1 2015-03-15 2015-03-20Illness 2

[R] Passing data to t.test in loop

2014-12-02 Thread Paul Johnston
Dear All First post so sorry for any breaches of etiquette. I have a csv containing the results for a series of experiments which record the time taken for various sizes of iterations. "run_id","size","time" 1,100,1.00 2,200,2.100 3,100,1.100 4,200,2.100 5,200,1.900 6,300,4.00 7,200,2.5 ... I r

Re: [R] function to avoid <<-

2014-12-02 Thread Hadley Wickham
At the top level do: myenv <- new.env(parent = emptyenv()) Then in your functions do myenv$x <- 50 myenv$x etc You also should not be using data() in that way. Perhaps you want R/sysdata.rda. See http://r-pkgs.had.co.nz/data.html for more details. Hadley On Tue, Dec 2, 2014 at 2:28 AM, Karim

[R] Two wireframe plots (lattice) aside (grid.arrange) without outer box

2014-12-02 Thread Johannes Radinger
Hi, I'd like to arrange two wireframe plots (library "lattice") next to each other using the grid.arrange function of the library "gridExtra". However the two wireframe plots should be closer to each other and the outer 2D box should be removed (to save space). To remove the outer box for a single

Re: [R] Sorting method used by order()

2014-12-02 Thread Prof Brian Ripley
On 02/12/2014 12:28, Pierrick Bruneau wrote: I'll try to be more specific: - ?order points to a common man page for both order() and sort.list() - sort.list() has a "method" argument, i.e. a sorting algorithm. As far as I can read, I'll rather say the default is "shell" Not quite: the page says

Re: [R] Sorting method used by order()

2014-12-02 Thread Duncan Murdoch
On 02/12/2014, 7:28 AM, Pierrick Bruneau wrote: > I'll try to be more specific: > - ?order points to a common man page for both order() and sort.list() > - sort.list() has a "method" argument, i.e. a sorting algorithm. As far as > I can read, I'll rather say the default is "shell" > - order() seems

Re: [R] Sorting method used by order()

2014-12-02 Thread Pierrick Bruneau
I'll try to be more specific: - ?order points to a common man page for both order() and sort.list() - sort.list() has a "method" argument, i.e. a sorting algorithm. As far as I can read, I'll rather say the default is "shell" - order() seems not to support this argument. My questions were thus 1) w

Re: [R] Sorting method used by order()

2014-12-02 Thread PIKAL Petr
Hi Can you be more specific? How do you want parametrize order? There is no sort.list argument in order. For sort list, the default method is "radix", AFAIK. Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of > Pierrick Bruneau > Sent: Tu

[R] Sorting method used by order()

2014-12-02 Thread Pierrick Bruneau
Hi all, In ?order, the sorting method used appears as the "method" argument to sort.list(), but I cannot make out which is used by default when calling order(), and how to parametrize it. Does someone have a clue there? Thanks by advance, Pierrick [[alternative HTML version deleted]] _

[R] specifying a structural equation model with sem

2014-12-02 Thread David Villegas Ríos
Hi all, I'm new to sem package and sem analyses, so this is probably very basic, although I was not able to solve it myself reading some other similar posts. I was trying to specify a structural equation model using a correlation matrix of three variables. The correlation matrix comes from a mixed

Re: [R] multivariate normal distribution

2014-12-02 Thread Rolf Turner
On 02/12/14 19:55, Patty Haaem wrote: Dear every one I want to generate 10 vector of multivariate normal distribution(means are zero and the size of the vectors is 40). correlation among these variables is |0.5| ^(i-j) , i,j=1,...,10. How can I generate these vectors? Sure sounds like homework

[R] SPI script

2014-12-02 Thread John Wasige
Hello R community, Could somebody kindly help with SPI script for dailly or monthly raster time-series data of rainfall? Thanks for your help Best Rgds John [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUB

[R] multivariate normal distribution

2014-12-02 Thread Patty Haaem
Dear every one I want to generate 10 vector of multivariate normal distribution(means are zero and the size of the vectors is 40). correlation among these variables is     |0.5| ^(i-j)   , i,j=1,...,10. How can I generate these vectors?Thanks in advanceElham [[alternative HTML version de

[R] function to avoid <<-

2014-12-02 Thread Karim Mezhoud
Dear All, I am writing a GUIpackage that needs global variables. I had many warning message when I checked the code as for example: geteSet: no visible binding for global variable ‘curselectCases’ I would like to write a function that creates a global place for Objects to be loaded as: Fun <- fu