Re: [R] multicore and mclapply problem in calculation server

2013-12-20 Thread Juan Antonio Balbuena
Hi Patrick, Thanks for posting. The wrapper function works as it should. If you do not specify return the function returns the last object declared, and this is exactly what I intended. Doing some research on my own I found out that the problem was here: x <- c(1: length(linH))

[R] ftable and data.frame

2013-12-20 Thread silvano
Hi, I used this command to produce a table: (tab1 = ftable(SEX, ESTCIV, Q1)) Q1 B L M N SEXOESTCIV F A 11 13 4 2 E 1 0 0 0 M A 5 0 3 1 E

Re: [R] Fitting particle size analysis data

2013-12-20 Thread PIKAL Petr
Hi I made a simple spredsheet for PSD using Rosin Rammler equation and I am lazy to transform it to R. However for single purpose you can use nls. Reverse your cumulative values PSD$cum<-cumsum(PSD$ret) plot(PSD$size, PSD$cum) fit<-nls(cum~ exp(-((size/r)^gama))*100, data=PSD, start=c(r=80, g

[R] Estimating and predicting using "segmented" Package

2013-12-20 Thread Melwin
I don't know if this is still relevant for you, but probably for someone else. I ran into the same problem an found two dirty workarounds that can help in many cases (but not all). Both can also be combined: 1. repeat the call to "segmented" with different seeds and different initial estima

[R] (no subject)

2013-12-20 Thread Mahboobe Akhlaghi
hi, excuse me where did I mistake in these procedures? (I want to fit these models to my data)     install.packages('drc',rep='http://cran.um.ac.ir') install.packages('car',rep='http://cran.um.ac.ir') install.packages('abind',rep='http://cran.um.ac.ir') library(car) library(abind) library(alr3) lib

[R] Execute Excel-Macro using R

2013-12-20 Thread R_Antony
Hi, How to execute ms-Excel Macro(*.xlsm) using R function ? I tried but not get. There are method to call from R function from Excel macro, but i need Excel macro to execute from R. Is it possible ? I am using Excel-2010 macro. Thanks in advance, Antony. -- View this message in context: h

[R] Classification of polynomial regression: simple or multiple (conceptual doubt)

2013-12-20 Thread Jose Claudio Faria
Dear list, I'm posting in the R-help list due to: - Not knowing a better place for it; - I would like to know the opinion of more specialized people. What is the best place to classify polynomial regressions (Y = bo + b1X + b2X^2 + ... + bnX^n): single or multiple linear regression? Regards, --

Re: [R] ftable and data.frame

2013-12-20 Thread John Kane
What does your original data look like? I seems to me that it would be better to give us that information since you may not want to use ftable() at all. Ideally you should give us the original data or a sample of it. If it's confidential just replace the actual values with fake data. The struct

Re: [R] ftable and data.frame

2013-12-20 Thread arun
Hi, Try: library(reshape2) dcast(as.data.frame(tab1), SEX+ESTCIV~Q1,value.var="Freq") ##not tested. A.K. On Friday, December 20, 2013 8:03 AM, "silv...@uel.br" wrote: Hi, I used this command to produce a table: (tab1 = ftable(SEX, ESTCIV, Q1))                               Q1  B  L  M  N

Re: [R] Classification of polynomial regression: simple or multiple (conceptual doubt)

2013-12-20 Thread Gilson Carvalho
Dear Dr. José Faria, I think that the best category to put polynomial regressions is single regressions. Although, in polynomial regressions there are more then one term as in multiple regressions this is an adjustment consequence, not a design consequence. So, to me this is sufficient to justify

Re: [R] Using cbind to merge different variables

2013-12-20 Thread arun
HI, May be this helps: set.seed(45)  dat1 <- as.data.frame(matrix(sample(0:1,100*5,replace=TRUE),ncol=5)) dat1$Newvar <- 1*(!!rowSums(dat1)) A.K. Hello. I have a problem combining a number of variables. I have five columns with binary variables with the values 0 and 1. I would like to comb

Re: [R] Using assign with mapply

2013-12-20 Thread Greg Snow
Trying to understand environments is not for the faint of heart. If lists do what you want then I would stick with a list and not worry about the environments. Most of the time that you deal with environments everything happens automatically behind the scenes and you don't need to worry about the

Re: [R] hist() : is there a way to change the border width?

2013-12-20 Thread capricy gao
Thanks a lot. It works! On Thursday, December 19, 2013 10:53 PM, Jim Lemon wrote: On 12/20/2013 08:19 AM, capricy gao wrote: > I have played around with it and found that the only color could be changed. > But I really would like to change the width... > Hi Capricy, Try this on the first e

Re: [R] A function which is a sum of other functions...

2013-12-20 Thread Greg Snow
My first thought was to use Reduce, but I think for this case that is a bit of overkill. You can have a vector or list of functions and just use sapply/lapply on the list of functions then sum the result. A quick example: > funs <- c(sin,cos,tan) > sapply( funs, function(f) f(pi/6) ) [1] 0.50

Re: [R] Inconsistent computation of an integral

2013-12-20 Thread Aurélien Philippot
Thanks William. I was convinced by pmax, until I played with the following example today. I tried to reproduce a computation from a paper. Here is the code: P<- function(x) { ab<-100*exp((0.0435-0.0269-0.5*0.3315^2)*4.3122+x*sqrt(4.3122)*0.3315) return(ab) } integrand<- function(x){ cd<- -1

Re: [R] Inconsistent computation of an integral

2013-12-20 Thread William Dunlap
You should try to match up values of integrand() instead of the value of its integral on a single integral if you want to see if the function is being computed correctly. integrate(f) calls f(x) where x is a vector of values (typically 21 values). It expects that f() is vectorized: that f(x[i])

Re: [R] A function which is a sum of other functions...

2013-12-20 Thread Onur Uncu
Makes sense. Simple and works. Thank you Greg. Sent from my iPhone > On 20 Dec 2013, at 16:15, Greg Snow <538...@gmail.com> wrote: > > My first thought was to use Reduce, but I think for this case that is > a bit of overkill. You can have a vector or list of functions and > just use sapply/lapp

[R] by class...

2013-12-20 Thread Onur Uncu
I used the by() function on a data.frame to get sums of the data grouped by 2 factors. The function worked however the output is in a class called 'by'. Not familiar with this class. How can I turn the output into a nice table where columns represent values of factor1, row represent values of fa

Re: [R] ftable and data.frame

2013-12-20 Thread David Winsemius
On Dec 20, 2013, at 5:01 AM, wrote: > Hi, > > I used this command to produce a table: It's not actually a 'table'. > > (tab1 = ftable(SEX, ESTCIV, Q1)) is.table(tab1) # will return FALSE > > Q1 B L M N > SEXOESTCIV >F A 11 13

Re: [R] by class...

2013-12-20 Thread David Winsemius
On Dec 20, 2013, at 9:38 AM, Onur Uncu wrote: > I used the by() function on a data.frame to get sums of the data grouped by 2 > factors. The function worked however the output is in a class called 'by'. > Not familiar with this class. How can I turn the output into a nice table > where columns

[R] The difference between SAS and R

2013-12-20 Thread Kevin Wright
SAS uses words. R uses symbols. See this: http://xkcd.com/1306/ (Yes, I know IML uses plenty of symbols. It's just supposed to be funny. And somewhat true.) -- Kevin Wright [[alternative HTML version deleted]] __ R-help@r-project.org maili

Re: [R] by class...

2013-12-20 Thread arun
Hi, Try: as.table(by(warpbreaks[,1],warpbreaks[,-1],sum)) #or to convert to data.frame as.data.frame(as.table(by(warpbreaks[,1],warpbreaks[,-1],mean))) A.K. On Friday, December 20, 2013 12:39 PM, Onur Uncu wrote: I used the by() function on a data.frame to get sums of the data grouped by 2

Re: [R] by class...

2013-12-20 Thread arun
Hi, You can also try: library(reshape2) dcast(as.data.frame(as.table(by(warpbreaks[,1],warpbreaks[,-1],sum))),wool~tension, value.var="Freq") A.K. On , arun wrote: Hi, Try: as.table(by(warpbreaks[,1],warpbreaks[,-1],sum)) #or to convert to data.frame as.data.frame(as.table(by(warpbreaks[,1

Re: [R] by class...

2013-12-20 Thread David Winsemius
On Dec 20, 2013, at 9:45 AM, David Winsemius wrote: > > On Dec 20, 2013, at 9:38 AM, Onur Uncu wrote: > >> I used the by() function on a data.frame to get sums of the data grouped by >> 2 factors. The function worked however the output is in a class called 'by'. >> Not familiar with this clas

[R] t test for multiple classes

2013-12-20 Thread Luigi Marongiu
dear all, I have a dataset composed by different classes: I have two main classes, "active (Act.)" and "latent (Lat.)", furher subdivided in the gene subclasses "IP10" and "MIG" and then into 7 stimulus sub-subclasses "ESAT6" to "PHA". Would it be possible to test in a direct way the statistical di

Re: [R] by class...

2013-12-20 Thread Jeff Newmiller
You seem to be falling prey to a common misconception that "R" is some monolithic tool, when in fact it is a herd of cats. The "by" function, from the "base" package, returns a list of results returned by your function. One approach to making a data frame out of that is to use the simplify2arra

Re: [R] Strange subvector output --> x[n] != x[1:n][n]

2013-12-20 Thread Patrick Burns
You've found an interesting corner of Circle 1 of 'The R Inferno'. http://www.burns-stat.com/documents/books/the-r-inferno/ The issue is that your 'n' in the final case is slightly less than 11. So: > n [1] 11 > as.integer(n) [1] 10 > 1:n [1] 1 2 3 4 5 6 7 8 9 10 11 The mystery to m

[R] Grab multinomial coefficients

2013-12-20 Thread Dimitri Liakhovitski
Hello! I am using function multinom: library(nnet) library(MASS) mnl<-multinom(myDV~. ,data=mydata,na.action="na.omit", MaxNWts = 2000, maxit = 1000) I can see the resulting coefficients: print(mnl) But how could I grab them? I am not finding them when I do: str(mnl) Thank you! -- Dimitri

Re: [R] Grab multinomial coefficients

2013-12-20 Thread Rui Barradas
Hello, Try coef(mnl) Hope this helps, Rui Barradas Em 20-12-2013 20:21, Dimitri Liakhovitski escreveu: Hello! I am using function multinom: library(nnet) library(MASS) mnl<-multinom(myDV~. ,data=mydata,na.action="na.omit", MaxNWts = 2000, maxit = 1000) I can see the resulting coefficien

Re: [R] Grab multinomial coefficients

2013-12-20 Thread Dimitri Liakhovitski
That's it! Thanks a lot! On Fri, Dec 20, 2013 at 4:18 PM, Rui Barradas wrote: > Hello, > > Try > > coef(mnl) > > Hope this helps, > > Rui Barradas > > Em 20-12-2013 20:21, Dimitri Liakhovitski escreveu: > > Hello! >> >> I am using function multinom: >> >> library(nnet) >> library(MASS) >> >> m