Re: [R-es] Tiempo de vida

2015-12-08 Thread Jesús Para Fernández
Pero como har�a el data frame?? Porque las cuchillas son de la misma referencia. En realidad es para ver cada cuanto se gstan las cuchillas y ver que pedidos hay que hacer de las mismas. La tabla que tengo es: 25 enero-> 1 cuchilla gastada 30 enero -> 1 cuchilla gastada 3 de febrero -> 2

Re: [R] metafor package

2015-12-08 Thread Viechtbauer Wolfgang (STAT)
Hi John, Please keep r-help copied on the reply. What's the 'previous model'? How do you get estimates within subgroups that 'includes the overall effect'? I really cannot follow you here. Best, Wolfgang -- Wolfgang Viechtbauer, Ph.D., Statistician | Department of Psychiatry and

Re: [R] Importing data by targeting in filenames inside a nested list

2015-12-08 Thread Ivan Calandra
Hi Mario, It is at the limit of my skills so I'm not sure this will be a real solution. But it might help you anyway (and there will be more competent people anyway). What does not make sense to me is why you set the names of your files and then use them to list them with list.files() What

[R] Importing data by targeting in filenames inside a nested list

2015-12-08 Thread BARLAS Marios 247554
Hello everyone, So, rookie me is trying to write a smart code, so here's what I'm doing: I have a list of a couple of hundrend files, some of which refer to different experiments. The naming of the file refers to the experiment and the serial number to the topological reference on my sample.

Re: [R] metafor package

2015-12-08 Thread John Peterson
Hi Dr. Viechtbauer, The code provided in the metafor projects website for subgroup includes fitting a random effects model on the entire dataset and fitting a random effects model within subgroups. When I exactly follow this code, my estimates and confidence intervals for estimate within each

[R] Error while using e1071 package

2015-12-08 Thread Partha Sinha
I am using R 3.2.2 on win-7 while using predict function with e1071 (naive bayes classifier) I am getting the following error "Error in object$tables[[v]][, nd] : subscript out of bounds" pl help. regards Parth __ R-help@r-project.org mailing list --

Re: [R] metafor package

2015-12-08 Thread Viechtbauer Wolfgang (STAT)
The first and second argument of forest() (or more precisely, forest.default()) are for the estimates and the corresponding sampling variances, respectively. So, if you do forest(rr, se, ...), then the function will interpret the standard errors as if they are variances. So, you should do

[R] column means dropping column minimum

2015-12-08 Thread Evan Cooch
Suppose I have something like the following dataframe: samp1 <- c(60,50,20,90) samp2 <- c(60,60,90,58) samp3 <- c(25,65,65,90) test <- data.frame(samp1,samp2,samp3) I want to calculate column means. Easy enough, if I want to use all the data within each column: print(colMeans(test),na.rm =

Re: [R] column means dropping column minimum

2015-12-08 Thread phgrosjean
There is a bug in your code: it is not > for (i in 1:ncol(test)) { test2[which.min(test[,i]),i]==NA} but for (i in 1:ncos(test)) { test2[which.min(test[, i]), i] <- NA } Otherwise, a solution would be to create your own function to compute the mean of a vector without the smallest value:

Re: [R] column means dropping column minimum

2015-12-08 Thread Giorgio Garziano
First, your code has flaws in the assignment of NA and in passing na.rm=TRUE to colMeans(). It should be: test2 <- test for (i in 1:ncol(test)) { test2[which.min(test[,i]),i]=NA} print(test2) samp1 samp2 samp3 16060NA 2506065 3NA9065 490NA90

Re: [R] column means dropping column minimum

2015-12-08 Thread David L Carlson
The which.min() only gets the first minimum value. If two or more values are tied for the minimum, it will delete only the first one. This would get them all: > apply(test, 2, function(x) mean(x[-which(x == min(x))])) samp1samp2samp3 66.7 70.0 73.3

[R] Error in loading the drc package

2015-12-08 Thread li li
Hi all, When trying to load the drc package. I got the following error. Any suggestions? Thanks. Hanna > install.packages("drc", dependencies=TRUE) --- Please select a CRAN mirror for use in this session --- trying URL 'https://cran.fhcrc.org/bin/windows/contrib/3.1/drc_2.5-12.zip'

Re: [R] [FORGED] Error in loading the drc package

2015-12-08 Thread Rolf Turner
On 09/12/15 08:32, li li wrote: Hi all, When trying to load the drc package. I got the following error. Any suggestions? Yes. Read the error message cheers, Rolf Turner Thanks. Hanna install.packages("drc", dependencies=TRUE) --- Please select a CRAN mirror for use in this

Re: [R] [FORGED] Error in loading the drc package

2015-12-08 Thread li li
Thanks. 2015-12-08 15:20 GMT-05:00 Rolf Turner : > > Please keep communications on-list. Others may have relevant comments and > suggestions to make. > > > On 09/12/15 09:00, li li wrote: > >> Thanks for the reply. So a newer version of R can solve the problem? But >> I

Re: [R] [FORGED] Error in loading the drc package

2015-12-08 Thread Rolf Turner
Please keep communications on-list. Others may have relevant comments and suggestions to make. On 09/12/15 09:00, li li wrote: Thanks for the reply. So a newer version of R can solve the problem? But I was able to successfully load the package yesterday. Thanks. I have no access to your

Re: [R] Why mean is not working in by?

2015-12-08 Thread Bert Gunter
Sarah: Note that (as I read them) aggregate() and by() work differently on data frames. aggregate() computes FUN column by column while by() feeds the whole (subset) data frame to FUN. If I am wrong about this, I would greatly appreciate being corrected. Cheers, Bert Bert Gunter "Data is

Re: [R] Why mean is not working in by?

2015-12-08 Thread William Dunlap
by() calls FUN with a data.frame as the argument. summary(), sum(), etc. have methods that work on data.frames but sd() and mean() do not. aggregate() calls its FUN with each column of a data.frame as the argument. Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Dec 8, 2015 at 3:08 PM,

[R] [tcltk][tktable] How to make an efficient data transfer from R to Tcl?

2015-12-08 Thread Cleber N.Borges
hello all, I intend transfer a big data.frame, more than 1e4 rows, more than 100 columns... I found solutions (in internet and help pages) for small data.frame like the showed bellow. Big data.frames is very expensive in computation time in my approach I would like to optimize this transfer

Re: [R] [tcltk][tktable] How to make an efficient data transfer from R to Tcl?

2015-12-08 Thread phgrosjean
Are you sure this is the right way to go for your use case? Even if you got a quick solution to display an 1e4 x 100 table in TkTable, what is the purpose of it? Will the user browse the whole dataset that way? Even if the answer is yes, you would probably need to implement sorting and

Re: [R] Why mean is not working in by?

2015-12-08 Thread Dimitri Liakhovitski
Got it - thank you, everybody! by splits it into data frames. Lesson: use aggregate. On Tue, Dec 8, 2015 at 6:17 PM, William Dunlap wrote: > by() calls FUN with a data.frame as the argument. summary(), sum(), etc. > have methods that work on data.frames but sd() and mean() do

Re: [R] [tcltk][tktable] How to make an efficient data transfer from R to Tcl?

2015-12-08 Thread Jim Lemon
Hi Cleber, have you tried: edit(mtcars) Jim On Wed, Dec 9, 2015 at 1:04 PM, Cleber N.Borges wrote: > my objective is to show data in screen inside a tktable... > for that, the data must be in a TCL variable and not only in a R variable > like that: > > library( tcltk )

[R] Why mean is not working in by?

2015-12-08 Thread Dimitri Liakhovitski
Hello! Could you please explain why the first 5 lines work but the last 2 lines don't? Thank you! by(data = iris[myvars], INDICES = iris["Species"], FUN = summary) by(data = iris[myvars], INDICES = iris["Species"], FUN = sum) by(data = iris[myvars], INDICES = iris["Species"], FUN = var) by(data =

Re: [R] [tcltk][tktable] How to make an efficient data transfer from R to Tcl?

2015-12-08 Thread Bert Gunter
Define: "transfer" ( save/load should be efficient and fast within R, but you appear to have something else in mind. What?) Apologies if it's obvious and I just don't get it. Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not

Re: [R] Why mean is not working in by?

2015-12-08 Thread Sarah Goslee
Hi Dimitri, I changed this into a reproducible example (we don't know what myvars is). Assuming length(myvars) > 1, I'm not convinced that your first five lines "work" either: what do you expect? I get: > by(data = iris[, -5], INDICES = iris["Species"], FUN = min) Species: setosa [1] 0.1

Re: [R] Why mean is not working in by?

2015-12-08 Thread Dimitri Liakhovitski
Sorry, I omitted the first line: myvars <- c("Sepal.Length", "Sepal.Width") by(data = iris[myvars], INDICES = iris["Species"], FUN = summary) by(data = iris[myvars], INDICES = iris["Species"], FUN = sum) by(data = iris[myvars], INDICES = iris["Species"], FUN = var) by(data = iris[myvars], INDICES

Re: [R] [tcltk][tktable] How to make an efficient data transfer from R to Tcl?

2015-12-08 Thread Cleber N.Borges
my objective is to show data in screen inside a tktable... for that, the data must be in a TCL variable and not only in a R variable like that: library( tcltk ) mtcars_in_TCL <- tclArray() for( i in 1:5 ) for( j in 1:5 ) mtcars_in_TCL[[ i,j ]] <- as.matrix(mtcars)[ i,j ] i thank by attention

Re: [R] tmap colour scale

2015-12-08 Thread Jim Lemon
Hi Freddy, Have you tried rev() on the palette? Jim On Wed, Dec 9, 2015 at 7:32 AM, Freddy Eggleton wrote: > Hi, > > I am trying to plot Conservative Vote % per borough for London using tmap > however the legend colours boroughs with a high Conservative % as light

Re: [R] Why mean is not working in by?

2015-12-08 Thread Bert Gunter
Because you are using by() incorrectly. "A data frame is split by row into **data frames** subsetted by the values of one or more factors, and function FUN is applied to each subset in turn." So your FUN is applied to a subset of the data frame (which is also a list). Note that sum, min, and

[R] change the x axis tickmarks when using plot function in drc package

2015-12-08 Thread li li
Hi all, When plotting the dose response curve using plot function as in the example codes below, the scale of the axis should really be on the log scale of the dose given the shape of the graph. But as you can see, the tickmarks of the returned graph represent the original scale. How can I

Re: [R] change the x axis tickmarks when using plot function in drc package

2015-12-08 Thread li li
Thanks for the reply but that does not seem to work. With that the plot is on log scale for both the response and the dose levels, but the tickmarks are still on the original scale. 2015-12-08 22:22 GMT-05:00 Jim Lemon : > Hi Hannah, > Try this: > > plot(mod,

Re: [R] change the x axis tickmarks when using plot function in drc package

2015-12-08 Thread Jim Lemon
Hi Hannah, Try this: plot(mod, type="all",log="xy") Jim On Wed, Dec 9, 2015 at 1:57 PM, li li wrote: > Hi all, > When plotting the dose response curve using plot function as in the > example codes below, the scale of the axis should really be on the log > scale of the

Re: [R] Error while using e1071 package

2015-12-08 Thread Jim Lemon
Hi Partha, Probably the first thing to be done is to see what: object$tables really is. The error message tells you that either "v" has become larger than the number of elements in the list/data frame "tables" or that "nd" has become larger than the number of columns in the element "v" (or

[R] tmap colour scale

2015-12-08 Thread Freddy Eggleton
Hi, I am trying to plot Conservative Vote % per borough for London using tmap however the legend colours boroughs with a high Conservative % as light blue and boroughs with a low % of conservative votes as dark blue. How do i reverse this scale so that areas with the most Conservative votes