Re: [R] average and median values for each of the class

2014-04-26 Thread David Winsemius
On Apr 26, 2014, at 5:37 PM, Nico Met wrote: > Dear all, > > > > I have a matrix (dimension, 16 x 12) where 2nd column represents class > (1,1,1,1,1,2,2,2, etc) information. I want to estimate average and median > values for each of the class and add this information as a row at end of > the

Re: [R] average and median values for each of the class

2014-04-26 Thread arun
Hi, Your dput() suggests dat as data.frame. ##Using the results you got, res2 <- do.call(rbind,lapply(unique(dat$class),function(i) {x1 <-rbind(dat[dat$class==i,], avg[avg$class==i,], med[med$class==i,]); rownames(x1)[!grepl("ara",rownames(x1))] <- paste0(c("Avg", "Med"), i); x1})) A.K. O

Re: [R] lattice plot formatting: pch, abbreviation and labels

2014-04-26 Thread Duncan Mackay
Hi Luigi You are typing things unnecessarily: do not use the attach command unless absolutely necessary - it has unfortunate consequences. It is better to use with or within. alpha is not available with some devices with bad consequences if used; its default is 1 anyway. Once you have stated a da

[R] average and median values for each of the class

2014-04-26 Thread Nico Met
Dear all, I have a matrix (dimension, 16 x 12) where 2nd column represents class (1,1,1,1,1,2,2,2, etc) information. I want to estimate average and median values for each of the class and add this information as a row at end of the each classes. for example: dput(dat) structure(list(class

[R] help using extrafont package | R graphics

2014-04-26 Thread Evan Cooch
Greetings -- Submitted this a little while ago -- for some reason, still being held up by the moderator. Trying again... For a host of reasons, I need to use/embed Garamond font with various R graphics for a particular publication. I've figured out how to more or less get there from here, usi

[R] For loop processing too slow - pre-format data.frame?

2014-04-26 Thread cembling
Hi, I am bootstrapping, but my loops are taking way too long & I need to make it faster. Looking on the R-help archive I suspect it may be due to not specifying the size of my data.frame, mainly because I don't know in advance how large it has to be. Can anyone help? My data looks like this (firs

Re: [R] Problem with new(er) R version's matrix package

2014-04-26 Thread Martin Maechler
> Arne Henningsen > on Sat, 26 Apr 2014 08:15:37 +0200 writes: > On 25 April 2014 20:15, David Winsemius > wrote: >> >> On Apr 25, 2014, at 9:17 AM, Werner W. wrote: >> >>> Dear Rs, >>> >>> I am re-executing some older code. It does work in the

Re: [R] writing a package with doParallel and compiled C

2014-04-26 Thread Jeff Newmiller
I am going to go out on a limb and suggest that you not do this at all. Packages are good places for algorithms, and parallel processing is an infrastructure optimization that a) is not always an efficiency win, and b) can be quite sensitive to the actual infrastructure that is available (best

[R] writing a package with doParallel and compiled C

2014-04-26 Thread Adam Clark
Hi all, Any tips on how to use doParallel as part of a function in a package that I am writing? The function calls compiled C code, and (as far as I know), doParallel requires you to load C functions for each core that you use (either with the .packages argument to foreach(), or by explicitly load

[R] GLM using truncated lognormal distribution

2014-04-26 Thread Marc Girondot
Dear honorable list-members, I know how to fit a truncated lognormal distribution (or Gaussian) (example here: http://max2.ese.u-psud.fr/epc/conservation/Girondot/Publications/Blog_r/Entrees/2012/5/24_Adjust_a_truncated_lognormal_distribution.html ) but I would like to use it in the context of

Re: [R] Faster way to transform vector [3 8 4 6 1 5] to [2 6 3 5 1 4]

2014-04-26 Thread arun
Hi, Perhaps, rank(bo) #[1] 2 6 3 5 1 4 A.K. On Saturday, April 26, 2014 11:00 AM, "xmliu1...@gmail.com" wrote: Hi, could anybody help me to find a fast way to fix the following question? Given a verctor of length N, for example bo = [3  8  4  6  1  5], I want to drive a vector whose element

[R] lattice plot formatting: pch, abbreviation and labels

2014-04-26 Thread Luigi Marongiu
Dear all, I am trying to use the lattice plot, but the syntax is quite difficult. Specifically I have eight variables (1 to 8) each of them further subdivided in two classes (negative=0 and positive=1). I am using the stripplot() to represent these values. I would like to represent the negative and

Re: [R] mapply echoes function call when browser() is called from within FUN

2014-04-26 Thread Duncan Murdoch
On 26/04/2014, 11:42 AM, Rguy wrote: When mapply is applied to a function that has a call to browser() within it, the result can be a disastrous amount of feedback. To clarify this situation please consider the following function, containing a call to browser within it: plus = function(a, b) {b

[R] mapply echoes function call when browser() is called from within FUN

2014-04-26 Thread Rguy
When mapply is applied to a function that has a call to browser() within it, the result can be a disastrous amount of feedback. To clarify this situation please consider the following function, containing a call to browser within it: plus = function(a, b) {browser(); a + b} A plain vanilla call

Re: [R] Faster way to transform vector [3 8 4 6 1 5] to [2 6 3 5 1 4]

2014-04-26 Thread Jorge I Velez
Hi Xueming, Try (1:length(bo))[rank(bo)] In a function the above would be f <- function(x){ N <- length(x) (1:N)[rank(x)] } f(bo) # [1] 2 6 3 5 1 4 HTH, Jorge.- On Sat, Apr 26, 2014 at 7:54 PM, xmliu1...@gmail.com wrote: > Hi, > > could anybody help me to find a fast way to fi

Re: [R] Faster way to transform vector [3 8 4 6 1 5] to [2 6 3 5 1 4]

2014-04-26 Thread William Dunlap
Look into the rank function. If there are duplicated values in the input vector its 'ties' argument says how to deal with them. If there are ties I think your algorithm puts the last one in the first position, e.g., it maps c(101,101,101,102,102) to c(3,2,1,5,4). rank does not include this option

Re: [R] Can't plot transparency images in R-3.1.0

2014-04-26 Thread Fong Chun Chan
It seems to have something to do with my other library dependencies that has broken the plotting. I tried to re-install R-3.0.2 again and I am getting the same error for that R version too. Been scouring the web for advice: http://stackoverflow.com/questions/10777008/how-to-set-cairo-as-default-b

[R] Update results not being written to existing data frame when using sqldf UPDATE

2014-04-26 Thread Christopher Lowenkamp
RStudio Version 0.98.501 R version 3.1.0 Mac OSX 10.9.2 Packages loaded: sqldf gsubfn proto RSQLite DBI RSQLite.extfuns tcltk Good morning: I am trying to run an sqldf update with two tables. Both tables contain a variable called ‘off_id’. I am trying to update a variable in tablea (v2) wi

[R] Food grade Peroxide for treatment life threatening chronic ailments.

2014-04-26 Thread kenya Secret Cures
Forget quil eggs. 35% food grade hydrogen peroxide has brought about relief to tens of thousands of patients suffering from disastrous diseases like CANCER, LEUKEMIA, HEPATITIS, KIDNEY FAIURE, HEART PROBEMS, LIVER DISORDERS. ASTHMA, ALLERGIES, CHRONIC ULCERS, HIGH BLOOD PRESSURE, CANDIDIASIS

[R] Faster way to transform vector [3 8 4 6 1 5] to [2 6 3 5 1 4]

2014-04-26 Thread xmliu1...@gmail.com
Hi, could anybody help me to find a fast way to fix the following question? Given a verctor of length N, for example bo = [3 8 4 6 1 5], I want to drive a vector whose elements are 1, 2, ..., N and the order of elements is the same as that in verctor bo. In this example, the result is suppo

Re: [R] [R-sig-DB] Update results not being written to existing data frame when using sqldf UPDATE

2014-04-26 Thread Gabor Grothendieck
On Sat, Apr 26, 2014 at 10:06 AM, Christopher Lowenkamp wrote: > RStudio Version 0.98.501 > R version 3.1.0 > Mac OSX 10.9.2 > > Packages loaded: > sqldf > gsubfn > proto > RSQLite > DBI > RSQLite.extfuns > tcltk > > Good morning: > > I am trying to run an sqldf update with two tables. Both table

Re: [R] Read.table mucks up headers

2014-04-26 Thread starter
Hello Uwe & Others Thanks for all your help, I figured out what the problem was. It wasn't working with old R version. Once I updated it to the latest version, it seemed to work. Thank you -- View this message in context: http://r.789695.n4.nabble.com/Read-table-mucks-up-headers-tp4688742p468

Re: [R] Cramer Rao upper/lower bounds- No Comments ?

2014-04-26 Thread Rui Barradas
Hello, Is this homework? There's a no homework policy here. Em 25-04-2014 12:40, Mohammed Ouassou escreveu: Dear R users; I have a question about Cramer Rao upper/lower bounds Cramer Rao _lower_ bound, not upper. Is it possible to compute Crammer Rao upper/lower bounds from residuals and

Re: [R] Metafor: How to integrate effectsizes?

2014-04-26 Thread Michael Dewey
At 20:34 25/04/2014, Viechtbauer Wolfgang (STAT) wrote: If you know the d-value and the corresponding group sizes for a study, then it's possible to add that study to the rest of the dataset. Also, if you only know the test statistic from an independent samples t-test (or only the p-value cor

Re: [R] purtest and missing values (plm-package)

2014-04-26 Thread Katharina Mersmann
Hey arun, I am thankful for your help and assistance! With the example it works! Have a nice day, Katie -Ursprüngliche Nachricht- Von: arun [mailto:smartpink...@yahoo.com] Gesendet: Freitag, 25. April 2014 18:01 An: r-help@r-project.org Cc: Katharina Mersmann Betreff: Re: [R] purtest an

Re: [R] about rect.hclust

2014-04-26 Thread Tal Galili
Thank you for mentioning the dendextendpackage Gregory. As I mention in the package, the dendextend package implements a similar function as in the dendroextra. The big difference between the two is that the dendextend package has an implementati

Re: [R] Simple Loop Counter

2014-04-26 Thread arun
HI, May be this helps: for(i in letters) {   n <- n+1   x[n,] <- c(i, n) cat("loop", n, "\n") } x #or for(i in seq_along(letters)) {   n <- n+1   x[n,] <- c(letters[i], n) cat("loop", i, "\n") } x A.K. #How can I add the loop counter in #2 to the loop in #1.? #*** #1. x <- matrix( ,

Re: [R] about rect.hclust

2014-04-26 Thread Gregory Jefferis
On 26 Apr 2014, at 06:41, Gregory Jefferis wrote: > # plot dendrogram coloured by cluster: > ## > library(dendroextras) > cluc=colour_clusters(clu, k=3, groupLabels =TRUE) > plot(cluc) There was a typo in an argument name for colour_clusters in my earlier response (thanks to Dennis Murphy for

Re: [R] Within ID variable delete all rows after reaching a specific value

2014-04-26 Thread arun
Hi, You may also try: set.seed(425) ##your code tmp <- data.frame( # tmp1 <- tmp str(tmp1) #'data.frame':    1000 obs. of  3 variables: # $ X1: Factor w/ 2 levels "0","1": 1 1 1 1 1 1 1 1 1 1 ... # $ X2: Factor w/ 127 levels "1","10","100",..: 1 1 1 1 1 1 1 1 2 2 ... # $ X3: Factor w/

Re: [R] Within ID variable delete all rows after reaching a specific value

2014-04-26 Thread Jeff Newmiller
Jennifer: a) Don't post in HTML... read the Posting Guide. b) Don't make data frames by first making matrices... you rarely create what you think you are creating. In your case, your code creates a bunch of factor columns... use the str() function to verify that your data are sensible before