Re: [R] Offset - usersplits function package RPART

2017-05-17 Thread David Winsemius
> On May 17, 2017, at 6:43 AM, ลห พงพง wrote: > > I have written a user written splitting function recently, but I do not know > how to use my splitting criteria to predict the test data. If I use the > function ‘predict’, there will return an error message, please give

Re: [R] violin plot help

2017-05-17 Thread Jim Lemon
Hi Omar, You may want to try subsetting your data and then passing each morsel to be plotted as a violin plot, either as separate calls to ggplot or directly to a violin plotting routine. vioplot (vioplot) violin_plot (plotrix) Jim On Thu, May 18, 2017 at 5:59 AM, Abdelrahman, Omar (RER)

Re: [R] violin plot help

2017-05-17 Thread Abdelrahman, Omar (RER)
Thank you, curly quotes got me! I was able to subset the data and produce the violin plot. Now, is there a way to generate multiple plots separately (no facets)? With so many levels of each variable, I am trying to avoid doing it iteratively. Neither ggplot2 books nor web searches have yielded

Re: [R] violin plot help

2017-05-17 Thread Abdelrahman, Omar (RER)
Thanks again RE: "so all the more reason to give us an example that we can run to trigger the same error." Are you asking for an example of the data? Below is a "small" example, but with so many levels of the different variables I am not sure it can be useful. STATION Geo Wshed DATE

[R] Offset - usersplits function package RPART

2017-05-17 Thread 潘 晶晶
I have written a user written splitting function recently, but I do not know how to use my splitting criteria to predict the test data. If I use the function ‘predict’, there will return an error message, please give me some helpful advice. __

[R] Help on reducing multiple loops

2017-05-17 Thread Sumanta Basak
Hi All, I've a data-set on product sub-product matrix on which I'm doing multiple calculation, but unfortunately using nested loops, the programme is taking long time to execute. Can anyone help me how to get rid of the following jungle? Any direction would be helpful. GA <- "India" verticle <-

Re: [R] RCommander issue

2017-05-17 Thread Jim Lemon
Hi Thambu, You must have an internet connection, otherwise you couldn't access CRAN. Have you tried using "install.packages" (see the help page) from within R? Your message isn't clear whether you have used that function or tried to download the package from a Web browser and then install it from

Re: [R] converting each column of a data frame into a matrix with n rows

2017-05-17 Thread David Winsemius
> On May 17, 2017, at 1:01 PM, Davide Piffer wrote: > > Thanks! This gets closer to the solution but a small problem remains. > I get 2 rows and only one column, whereas I need a 2x2 matrix (like a > contingency table for Fisher's exact test).Also another issue is it >

Re: [R] converting each column of a data frame into a matrix with n rows

2017-05-17 Thread Davide Piffer
Thanks! This gets closer to the solution but a small problem remains. I get 2 rows and only one column, whereas I need a 2x2 matrix (like a contingency table for Fisher's exact test).Also another issue is it repeats the first number of the column, instead of using all 4. For example, first vector

Re: [R] converting each column of a data frame into a matrix with n rows

2017-05-17 Thread David L Carlson
Not really enough info here since you don't specify much about the data frame or how the results should be provided, but maybe something like this: y <- data.frame(matrix(1:100, 10, 10)) y.mat <- lapply(y, matrix, nrow=2) str(y.mat) List of 10 $ X1 : int [1:2, 1:5] 1 2 3 4 5 6 7 8 9 10 $ X2 :

Re: [R] converting each column of a data frame into a matrix with n rows

2017-05-17 Thread David Winsemius
> On May 17, 2017, at 12:18 PM, Davide Piffer wrote: > > I need to convert each vector of a dataframe into a matrix with 2 rows > and 2 columns (i.e. contingency table). > Note I don't want to convert the entire df into a matrix! I want to > apply a function that

[R] converting each column of a data frame into a matrix with n rows

2017-05-17 Thread Davide Piffer
I need to convert each vector of a dataframe into a matrix with 2 rows and 2 columns (i.e. contingency table). Note I don't want to convert the entire df into a matrix! I want to apply a function that converts each 4 elements vector of a df into a 2 x 2 matrix. I wrote something like this, but it

Re: [R] optimx and follow.on=TRUE... does not follow

2017-05-17 Thread J C Nash
"follow-on" is one of the main reasons I stopped work on optimx and refactored to optimr/optimrx, where I separated this functionality into the polyopt() function. optimr has just a few solvers, while optimrx is used to add them as I get round to doing it, but it's on R-forge. Mainly a matter

[R] optimx and follow.on=TRUE... does not follow

2017-05-17 Thread Marc Girondot via R-help
Hi, I would like to know if some of you have a solution for this problem: I use optimx (from package optimx) to fit the parameters of a model (complex model based on several imbricated exponential functions). I use the two methods : method = c("Nelder-Mead", "BFGS") with the options:

Re: [R] adding predictor to linear model without changing existing coefficients

2017-05-17 Thread Bert Gunter
You should consult a linear models text, but, assuming I have correctly understood your post, the procedure is this (the translation to R code is trivial, and I leave it to you): Let y be the response variable, P1 be the first set of predictors and z be your new predictor to be added. 1. regress

Re: [R] violin plot help

2017-05-17 Thread Jeff Newmiller
Here is an example that works... a reproducible example always includes code AND enough sample data to exercise the code: dta <- read.table( text= "STATIONGeo Wshed DATEPARAMETER RESULT BB36Bay C-100 1/10/2013

[R] CREATE DICTIONARY WITH TM PACKAGE

2017-05-17 Thread Patrick Casimir
Dear Members & Experts, Since the Dictionary () function is no longer available with the tm package. How do I use other functions to do the same as below? I want to capture a list of specific terms from a corpus. By example, if my corpus has 102 files. I want to see a list with occurrences of

Re: [R] R-3.4.0 fails test

2017-05-17 Thread Peter Dalgaard
> On 17 May 2017, at 12:31 , Henric Winell wrote: > > On 2017-05-17 09:42, Patrick Connolly wrote: > >> After installing R-3.4.0 I ran 'make check' which halted here: >> $ > tail reg-tests-1d.Rout.fail -n 16 > > This problem was brought up on the R-devel list early

Re: [R] R-3.4.0 fails test

2017-05-17 Thread Henric Winell
On 2017-05-17 09:42, Patrick Connolly wrote: After installing R-3.4.0 I ran 'make check' which halted here: $ > tail reg-tests-1d.Rout.fail -n 16 This problem was brought up on the R-devel list early this morning. See https://stat.ethz.ch/pipermail/r-devel/2017-May/074275.html Henric

Re: [R] adding predictor to linear model without changingexistingcoefficients

2017-05-17 Thread Gerrit Eichner
Hello, Urs, you may have seen Wolfgang Viechtbauer's answer already which offers an R-technical solution, but this may leave the mathematical grounds of linear models. See inline below for my concern and a hint. Am 17.05.2017 um 09:12 schrieb Urs Kleinholdermann: Dear list members, I want to

[R-es] Ordenar atómicos

2017-05-17 Thread Manuel Máquez
Estimable Francisco: Muchas gracias por tomarte un tiempo para darme una solución. Sí me parece que debe funcionar; lo voy a probar con una matriz más grande, e insisto creo funcionará. *MANOLO MÁRQUEZ P.* [[alternative HTML version deleted]]

[R] R-3.4.0 fails test

2017-05-17 Thread Patrick Connolly
After installing R-3.4.0 I ran 'make check' which halted here: $ > tail reg-tests-1d.Rout.fail -n 16 > ## format()ing invalid hand-constructed POSIXlt objects > d <- as.POSIXlt("2016-12-06"); d$zone <- 1 > tools::assertError(format(d)) > d$zone <- NULL >

Re: [R] adding predictor to linear model without changing existing coefficients

2017-05-17 Thread Viechtbauer Wolfgang (SP)
You could use an offset term. An example: n <- 100 x1 <- rnorm(n) x2 <- rnorm(n) x3 <- rnorm(n) y <- 0 + .2 * x1 - .5 * x2 + .3 * x3 + rnorm(n) res1 <- lm(y ~ x1 + x2) summary(res1) res2 <- lm(y ~ 1 + offset(coef(res1)[2] * x1 + coef(res1)[3] * x2)) summary(res2) ### identical intercept as in

[R] adding predictor to linear model without changing existing coefficients

2017-05-17 Thread Urs Kleinholdermann
Dear list members, I want to add a predictor to a linear model without changing the coefficients of the existing model. How is that done with R? So if I have a response y and predictors x1, x2, x3 I want to make a model lm1 like lm1 = lm(y~x1+x2) After this model is computed I want to add x3