[R] Hlep in analysis in RWinBugs
Hi R User, I was trying to use R for WINBUGS using following model and data (example), but I am new with WINBUGS and don't know how we perform the analysis. I wonder whether I can run the following the example data and Winbugs Model in R. Your help will be highly appreciated. Sincerely, SN PANDIT === library(R2WinBUGS) #Model model{ #likelihood for(i in 1:N){ a1[i] ~ dnorm(a11[i],tau) 2[i] ~ dnorm(a21[i],tau1) a3[i] ~ dnorm(a31[i],tau2) a11[i]<-sm[i]*S1*m1 a21[i]<-sm[i]*S1*(1-m1)*S2*m2 a31[i]<-sm[i]*S1*(1-m1)*S2*(1-m2)*S3 sum[i]<-a11[i]+a21[i]+a31[i] } #priors #priors are dbeta(0.5,0.5), uniform is dbeta(1,1) S1~dbeta(1,1)#I(0,0.2) # S2~dbeta(1,1)#I(0.15,0.5) # S3~dbeta(1,1)#I(0.3,1) m1~dbeta(1,1)#I(0.01,1) m2~dbeta(1,1)#I(0,1) sd ~ dunif(0,100) sd1 ~ dunif(0,100) sd2 ~ dunif(0,100) tau <- 1/(sd*sd) tau1 <- 1/(sd1*sd1) tau2 <- 1/(sd2*sd2) } model.file <- Model file.show(model.file) #The Data list(N = 4, sm=c(9309,3253,5292,1361), a1=c(16,3,4,2), a2=c(96,31,42,3), a3=c(47,5,18,1)) inits <- function(){ list(sd = 1000, sd1 = 1000, sd2 = 1000, S1 = 0.10, S2 = 0.25, S3 = 0.5, m1 = 0.25, m2 = 75) } [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Accessing Havers data from R?
Hi R, Do we have R package to extract data from Havers data provider? For example, just like we have RBloomberg package to extract data from Bloomberg. If not are there any other mechanisms to extract the data from Havers? Thanks and Regards, Shubha. This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Dates when transferred from RExcel to R.
Hi R, The dates when exported from Excel to R by "Put R Var", gives one less day. For example, 1.Let 1/1/2011 be the cell A1 in date format. 2.Right click and select "Put R Var" and give a name to it say, "StartDate" (R in foreground process) 3.In the R console see the value stored in "StartDate" 4.The output is: > StartDate [1] "2010-12-31 23:30:00 IST" Please note that this output is 30 minutes less than the actual date. Why is this? Thanks and Regards, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how do remove those predictor which have p value greater than 0.05 in GLM?
Thanks for the response, Frank. I am not saying that I want to delete a variables because of p>0.5. But my concern was: I am using backward stepwise logistic regression, it keeps the variables in the final model if the variable significantly contributing in the model. Otherwise, it should not be in the final model. Using other software, they give correct results. But R, did not. I want those variables if p<0.05, otherwise exclude from the model. If you include that variables, it will affect the Log likelihood ratio and AIC. I want to change a P-value criterion <=0.05 in the model. Any suggestions. thanks -- View this message in context: http://r.789695.n4.nabble.com/how-do-remove-those-predictor-which-have-p-value-greater-than-0-05-in-GLM-tp3053921p3054540.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how do remove those predictor which have p value greater than 0.05 in GLM?
Hi R user, I am a kind of an intermediate user of R. Now I am using GLM model (library MASS, VEGUS). I used a backward stepwise logistic regression, but i got a problem in removing those predictors which are above 0.05. I don't want to include those variables which were above 0.05 in final backward stepwise logetsic regression model. for example: first I run the model, "name<-glm(dep~env1+env2..., family= binomial, data=new)" after that, I did stepwise for name name.step<-step(name, direction="backward") here, I still got those variables which were not significant, for example: secchi was not significant (see below example), but still it was in the model. how can I remove those variables which are not significant in forward/backward stepwise?. another question, when I wrote direction="backward", I got the results same as in the process of "forward". It is really strange. why is it same results for backward and forward. I checked in other two statistical software (Statistica and SYSTAT), they provided a correct results, I think. But, I need to use R for further analysis, therefore I need to fix the problem. I am spending so much time to figure it out, but I could not. could you please give your suggestions. It would be really a great help. please see the example of retaining predictors which have p value is greater that 0.05 after stepwise logistic regression. Thank Shubha Pandit, PhD University of Windsor Windsor, ON, Canada > summary(step.glm.int.ag1) Call: glm(formula = ag1less ~ GEARTEMP + DOGEAR + GEARDEPTH + SECCHI + GEARTEMP:SECCHI + DOGEAR:SECCHI + GEARTEMP:DOGEAR + GEARTEMP:GEARDEPTH + DOGEAR:GEARDEPTH, family = binomial, data = training) Deviance Residuals: Min 1Q Median 3Q Max -2.1983 -0.8272 -0.4677 0.8014 2.6502 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 3.231623 1.846593 1.750 0.080110 . GEARTEMP -0.004408 0.085254 -0.052 0.958761 DOGEAR -0.732805 0.182285 -4.020 5.82e-05 *** GEARDEPTH -0.249237 0.060825 -4.098 4.17e-05 *** SECCHI 0.311875 0.297594 1.048 0.294645 GEARTEMP:SECCHI-0.080664 0.010079 -8.003 1.21e-15 *** DOGEAR:SECCHI 0.066555 0.022181 3.000 0.002695 ** GEARTEMP:DOGEAR 0.030988 0.008907 3.479 0.000503 *** GEARTEMP:GEARDEPTH 0.008856 0.002122 4.173 3.01e-05 *** DOGEAR:GEARDEPTH0.006680 0.004483 1.490 0.136151 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 3389.5 on 2751 degrees of freedom Residual devia\ n\ ce: 2720.4 on 2742 degrees of freedom AIC: 2740.4uh Number of Fisher Scoring iterations: 6 == > glm.int.ag1<-glm(ag1less~GEARTEMP+DOGEAR+GEARDEPTH+SECCHI+SECCHI*GEARTEMP+SECCHI*DOGEAR+SECCHI*GEARDEPTH+GEARTEMP*DOGEAR+GEARTEMP*GEARDEPTH+GEARDEPTH*DOGEAR,data=training, > family=binomial) > summary(glm.int.ag1) Call: glm(formula = ag1less ~ GEARTEMP + DOGEAR + GEARDEPTH + SECCHI + SECCHI * GEARTEMP + SECCHI * DOGEAR + SECCHI * GEARDEPTH + GEARTEMP * DOGEAR + GEARTEMP * GEARDEPTH + GEARDEPTH * DOGEAR, family = binomial, data = training) Deviance Residuals: Min 1Q Median 3Q Max -2.1990 -0.8287 -0.4668 0.8055 2.6673 Coefficients: Estimate Std. Error z value Pr(>|z|) (Intercept) 2.909805 1.928375 1.509 0.131314 GEARTEMP0.005315 0.087159 0.061 0.951379 DOGEAR -0.721864 0.183708 -3.929 8.52e-05 *** GEARDEPTH -0.235961 0.064828 -3.640 0.000273 *** SECCHI 0.391445 0.326542 1.199 0.230622 GEARTEMP:SECCHI-0.082296 0.010437 -7.885 3.14e-15 *** DOGEAR:SECCHI 0.065572 0.022319 2.938 0.003305 ** GEARDEPTH:SECCHI -0.003176 0.005295 -0.600 0.548675 GEARTEMP:DOGEAR 0.030571 0.008961 3.412 0.000646 *** GEARTEMP:GEARDEPTH 0.008692 0.002159 4.027 5.66e-05 *** DOGEAR:GEARDEPTH0.006544 0.004495 1.456 0.145484 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 (Dispersion parameter for binomial family taken to be 1) Null deviance: 3389.5 on 2751 degrees of freedom Residual deviance: 2720.0 on 2741 degrees of freedom AIC: 2742 Number of Fisher Scoring iterations: 6 -- View this message in context: http://r.789695.n4.nabble.com/how-do-remove-those-predictor-which-have-p-value-greater-than-0-05-in-GLM-tp3053921p3053921.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] KMedians clustering in R
Thanks all. But I was looking for "KMedian" algorithm and not the "KMedoids" algorithm. The wiki says, " Note that this algorithm is often confused with k-medoids, which finds the optimal medoid, not median, for each cluster. (A medoid is an actual point from the dataset; a median is the mathematical median calculated separately for each dimension.)" Any package which does KMedian clustering algorthm? Many Thanks. Regards, Shubha. -Original Message- From: Christian Hennig [mailto:chr...@stats.ucl.ac.uk] Sent: Thursday, September 16, 2010 9:32 PM To: Shubha Vishwanath Karanth Cc: r-help@r-project.org; r-h...@stat.math.ethz.ch Subject: Re: [R] KMedians clustering in R pam/clara in package cluster are probably as close to it as you can be. There is no unique definition of a multivariate median and therefore there is no unique definition of "k-medians", but pam/clara is one possible version of it. (Of course if you think of k-medians as defined in a specific paper, it may still be something slightly different.) Christian On Thu, 16 Sep 2010, Shubha Vishwanath Karanth wrote: > Hi R, > > Is there a package in R to perform KMedian clustering? > > Thanks. > Shubha > This e-mail may contain confidential and/or privileged i...{{dropped:10}} > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > *** --- *** Christian Hennig University College London, Department of Statistical Science Gower St., London WC1E 6BT, phone +44 207 679 1698 chr...@stats.ucl.ac.uk, www.homepages.ucl.ac.uk/~ucakche This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] KMedians clustering in R
Hi R, Is there a package in R to perform KMedian clustering? Thanks. Shubha This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Robust Regression + Stepwise
Hi R, Can I perform a stepwise method for robust regression? In other words, how do I combine the methods "step" and "rlm" together? Thanks and Regards, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Stepwise Regression + entry/exit significance level
Hi R, Does the "step" function used to perform stepwise regression has the option to specify the entry/exit significance levels for the independent variables? (This is similar to the 'slentry' and 'slstay' option in 'Proc reg' of SAS.). Or do we have any other package which does the above? Thanks. Thanks and Regards, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Maximum seasonal 'q' parameter
Hi R, Seems like the maximum seasonal 'q' parameter for the ?arima is 350. Any way, where we can increase this? Since I am working on 3 year (q=252*3) and 5 year(q=252*5) returns, I may require this option. Thanks. > fit=arima(r,c(3,0,0),seasonal = list(order = c(0, 0, 500), period = NA));tsdiag(fit);fit$aic Error in makeARIMA(trarma[[1L]], trarma[[2L]], Delta, kappa) : maximum supported lag is 350 Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] as.dendrogram for DICE coefficient.
Hi R, I was using 'as.dendrogram' with the DIST coefficient, where the smaller values of the DIST coefficient, say that the objects are closer to each other, while the larger values of the coefficient say that the objects are far from each other. But now, I have my coefficient as the DICE coefficient(in some sense similar to correlation coefficient), where the larger coefficient value indicates closer objects, while the small coefficient values indicate farther objects. But, once I draw the dendrogram, the initial groupings happens to the smaller DICE coefiicients and then to the larger, which should not be the case, because, the objects with larger coefficients are closer to each other than the smaller. How do I say the as.dendrogram to group the objects for larger values of the DICE coefficient? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Transformation of Y changes the 'lm' object?
Hi R, This is a problem, which I have tried to present in a simple way: Let, x1=1:10 x2=2:11 y=2+3*x1 lm_obj=lm(y~x1+x2) lm_obj step(lm_obj) # Step function for the first time y=y^0.1 lm_obj step(lm_obj) #Step function after a transformation on Y, but 'lm_obj' is not modified. The two step function behave differently. The first one is before the transformation on 'Y', the dependent variable and the second step function is after the transformation. But, please note that I have NOT changed the 'lm_obj' at all after the transformation at all. So, I was wondering, since I have not changed the 'lm_obj', I should get both stepwise results as the same. Or does the transformation of Y, changes the 'lm_obj' without actually specifying? Thanks for the clarifications. Thanks and Regards, Shubha Karanth | Amba Research Ph +91 80 3980 8435 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Extreme Value Regression model
Thanks. But they don't speak of the extreme value distribution like Gumbel, Frechet or Weibull Thanks and Regards, Shubha Karanth | Amba Research Ph +91 80 3980 8435 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Richardson, Patrick [mailto:patrick.richard...@vai.org] Sent: Thursday, July 15, 2010 5:56 PM To: Shubha Vishwanath Karanth; r-help@r-project.org; r-h...@stat.math.ethz.ch Subject: RE: Extreme Value Regression model Well, RSiteSearch("extreme value regression) turns up quite a few relevant posts including one on package "XReg". . . for extreme value regression. Patrick -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shubha Vishwanath Karanth Sent: Thursday, July 15, 2010 2:27 AM To: r-help@r-project.org; r-h...@stat.math.ethz.ch Subject: [R] Extreme Value Regression model Hi R, Just like a Poisson regression model, is there a package in R to do Extreme Value Regression model? Thanks. Thanks and Regards, Shubha Karanth This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. The information transmitted is intended only for the per...{{dropped:16}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Extreme Value Regression model
Hi R, Just like a Poisson regression model, is there a package in R to do Extreme Value Regression model? Thanks. Thanks and Regards, Shubha Karanth This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R user interface
Hi R, I have a an excel file with a lot of data. I need to create an user interface in R, which has one single screen. It needs to contain a right pane containing the click buttons for different countries (say). If the user clicks a country, then a chart needs to be created for that country, taking the data from Excel. Is this possible and which package helps me in doing this? Many thanks in advance. Thanks and Regards, Shubha Karanth This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] fgev + negative location parameter for positive data?
Hi R, I have a vector with all positive values and have fit the GEV distribution (shape parameter=0) to the data and I get the negative value of the location parameter. Is this possible? library(evd) r=read.table("clipboard",header=F)[,1] > length(r) [1] 2087 > sum(r>=0) #All data points are positive [1] 2087 > sum(r>=100) #All data points are positive [1] 2087 Now, > fgev_fit=fgev(r,std.err = FALSE) > fgev_fit Call: fgev(x = r, std.err = FALSE) Deviance: 82397.2 Estimates loc scale shape -1.977e+07 1.141e+08 1.555e-02 Optimization Information Convergence: successful Function Evaluations: 30 Gradient Evaluations: 5 When all the values in the data are positive, how can the location parameter of the fit be negative? Or is it something to do with the large deviation? Please let me know, whether my assumptions are correct. Thanks and Regards, Shubha Karanth This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] F-statistic in ARIMA model
Hi all, Can I get the F-statistic from the arima() option? Or at least the residual degrees of freedom in the arima()? Or do I have to convert the ARIMA model back to the regression model and then get the F-statistic? Thanks. Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Creating R exe files
Hi all, Just like Fortran creates EXE files for a code, can R also do the same? Thanks for the info. Thanks and Regards, Shubha Karanth | Amba Research Ph +91 80 3980 8283 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] DICE Coefficient of similarity measure
Just wrote a small piece of code to do so. Thanks. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shubha Vishwanath Karanth Sent: Saturday, April 24, 2010 6:28 PM To: r-help@r-project.org; r-h...@stat.math.ethz.ch Cc: gabor.csa...@unil.ch Subject: [R] DICE Coefficient of similarity measure Hi, I wanted the DICE coefficient (similarity measure for binary variables) to be calculated in R and found that the "igraph" package has the option of "similarity.dice" to do this. But, for this command, the input object should be an igraph object. But, I have a dataframe of columns containing 1's and 0's. Can I convert this dataframe into an igraph object, so that the DICE coefficient can be reproduced? Or does any other packages gives the DICE coefficient? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] table command
Hi, Let s be a dataframe. > s A B C 0 0 1 1 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 1 1 0 1 1 0 0 1 > tab1=table(s[,c(1,2)]) > tab1 B A 0 1 0 3 3 1 3 0 > tab2=table(s[,c(1,3)]) > tab2 C A 1 0 6 1 3 The problem is I need to access frequency corresponding to (0,0). tab1[1] will give me the correct value while tab2[1] will not give the frequency which I expected. So, is there a possibility in the table command to have the order of tab1 and tab2 being equal? (here 2*2). May be by filling in the appropriate value as 0 or NA? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] DICE Coefficient of similarity measure
Hi, I wanted the DICE coefficient (similarity measure for binary variables) to be calculated in R and found that the "igraph" package has the option of "similarity.dice" to do this. But, for this command, the input object should be an igraph object. But, I have a dataframe of columns containing 1's and 0's. Can I convert this dataframe into an igraph object, so that the DICE coefficient can be reproduced? Or does any other packages gives the DICE coefficient? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Time series cross-sectional regression analysis
Hi all, Is there a package in R to perform time series cross-sectional regression analysis (like the TSCSREG procedure in SAS)? Thanks for the info. Thanks and Regards, Shubha Karanth | Amba Research Ph +91 80 3980 8283 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Scores in Dimensions in Correspondence Analysis
Got that... Thanks and Regards, Shubha Karanth | Amba Research Ph +91 80 3980 8283 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shubha Vishwanath Karanth Sent: Sunday, January 03, 2010 6:30 PM To: r-help@r-project.org Subject: Re: [R] Scores in Dimensions in Correspondence Analysis Does the $rowcoord and $colcoord help? Thanks and Regards, Shubha Karanth -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shubha Vishwanath Karanth Sent: Sunday, January 03, 2010 6:25 PM To: r-help@r-project.org Subject: [R] Scores in Dimensions in Correspondence Analysis Hi R, I was experimenting with the CA package for correspondence analysis. data(author) ca(author) plot(ca(author)) How can I get the values used by the plot for the two axis for biplot? In other words, how will I be able to obtain the scores in the dimensions (which are obtained by PCA) of the graphs? Thanks. Thanks and Regards, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Scores in Dimensions in Correspondence Analysis
Does the $rowcoord and $colcoord help? Thanks and Regards, Shubha Karanth -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shubha Vishwanath Karanth Sent: Sunday, January 03, 2010 6:25 PM To: r-help@r-project.org Subject: [R] Scores in Dimensions in Correspondence Analysis Hi R, I was experimenting with the CA package for correspondence analysis. data(author) ca(author) plot(ca(author)) How can I get the values used by the plot for the two axis for biplot? In other words, how will I be able to obtain the scores in the dimensions (which are obtained by PCA) of the graphs? Thanks. Thanks and Regards, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Scores in Dimensions in Correspondence Analysis
Hi R, I was experimenting with the CA package for correspondence analysis. data(author) ca(author) plot(ca(author)) How can I get the values used by the plot for the two axis for biplot? In other words, how will I be able to obtain the scores in the dimensions (which are obtained by PCA) of the graphs? Thanks. Thanks and Regards, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Digitizing the Plot
Hi R, Wanted to check if there are any packages available for getting the (x,y) data points of a graph or a plot, which is in the image format. Say, the plot could be a published report, and I want to get the points of the curve plotted. (I am speaking something related the subject discussed in http://www.uniphiz.com/digitizing.htm) Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Built-in Code behind SVM
Hi R, I need to see the inner code behind the function "svm" in the package e1071. I enter svm in the console and get the below output. > svm function (x, ...) UseMethod("svm") Is there any way I can look into the code of what svm (support vector machine) is doing? Thanks a lot for your help... Thanks and Regards, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Have a function like the "_n_" in R ? (Automatic count function)
> temp=data.frame(a=c(4,3,2,6),b=c(7,4,2,4)) > temp a b 1 4 7 2 3 4 3 2 2 4 6 4 > temp$counter=1:nrow(temp) > temp a b counter 1 4 7 1 2 3 4 2 3 2 2 3 4 6 4 4 Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Nash Sent: Wednesday, February 25, 2009 5:55 PM To: r-help Subject: [R] Have a function like the "_n_" in R ? (Automatic count function) Have the counter function in R ? if we use the software SAS /*** SAS Code **/ data tmp(drop= i); retain seed x 0; do i = 1 to 5; call ranuni(seed,x); output; end; run; data new; counter=_n_; * this keyword _n_ ; set tmp; run; /* _n_ (Automatic variables) are created automatically by the DATA step or by DATA step statements. */ /*** Output counter seed x 1 5840432880.27197 2 9359029630.43581 3 3018795230.14057 4 7532125980.35074 5 1607264573 0.74844 / Have a function like the "_n_" in R ? -- Nash - morri...@ibms.sinica.edu.tw __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Calling R from SAS
Got it working... Just that the R code file's extension was missing in the physical folder... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shubha Vishwanath Karanth Sent: Saturday, January 24, 2009 6:58 PM To: r-h...@stat.math.ethz.ch Subject: [R] Calling R from SAS Can I call R from SAS? I tried the below command in SAS, but not working... OPTIONS XWAIT XSYNC; X "C:\Program Files\R\R-2.7.1\bin\R.exe --no-save -quiet <""C:\TEMPO\program.r""> ""C:\TEMPO\program.log"""; Had done this before and it was working perfect... But now, not... Sorry if this query was supposed to be put in SAS mailing list. But thought if someone would have worked with this, can help... Thanks for your help, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Calling R from SAS
Can I call R from SAS? I tried the below command in SAS, but not working... OPTIONS XWAIT XSYNC; X "C:\Program Files\R\R-2.7.1\bin\R.exe --no-save -quiet <""C:\TEMPO\program.r""> ""C:\TEMPO\program.log"""; Had done this before and it was working perfect... But now, not... Sorry if this query was supposed to be put in SAS mailing list. But thought if someone would have worked with this, can help... Thanks for your help, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Downloading Reuters data from R
Thank you very much for this. But since I don't know much of DLL, I am kind of a stuck with how to proceed with 'reuters_ts1.zip'. This zip file contains the 'reuters_ts.dll' file. dyn.load("reuters_ts.dll") generates the error, > dyn.load("Z:\\reuters_ts1\\package\\reuters_ts.dll") Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared library 'C:/Documents and Settings/shubhak/reuters_ts1/package/reuters_ts.dll': LoadLibrary failure: This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem. Where should the 'reuters_ts1.zip' to be stored? And how can I access 'reuters_ts.dll' file for my use? Even checked ?dyn.load, but a bit confused. How do we use this? I am sorry, if this troubles. Mine is a Windows XP Config. Thanks again, Shubha -Original Message- From: rory.wins...@rbs.com [mailto:rory.wins...@rbs.com] Sent: Thursday, December 11, 2008 9:44 PM To: Shubha Vishwanath Karanth; r-h...@stat.math.ethz.ch Subject: RE: Downloading Reuters data from R Hi Shubha I have created an extension DLL for downloading time series data from Reuters. You can download it from here: http://www.theresearchkitchen.com/blog/archives/287 There is also a short manual available at the same location: http://www.theresearchkitchen.com/blog/wp-content/uploads/2008/12/intro. pdf I am currently in the process of uploading a separate extension DLL for retrieval of real-time data from Reuters. Thanks Rory Rory Winston RBS Global Banking & Markets Office: +44 20 7085 4476 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Shubha Vishwanath Karanth Sent: 11 December 2008 07:41 To: r-h...@stat.math.ethz.ch Subject: [R] Downloading Reuters data from R Hi R, Can we download Reuters (3000 Xtra) data from R? Does ODBC package help me in this? Or otherwise, is there a way to extract daily closing prices data of Reuters from R? Thank you very much, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. *** The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB. Authorised and regulated by the Financial Services Authority This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer. Internet e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept responsibility for changes made to this message after it was sent. Whilst all reasonable care has been taken to avoid the transmission of viruses, it is the responsibility of the recipient to ensure that the onward transmission, opening or use of this message and any attachments will not adversely affect its systems or data. No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the recipient should carry out such virus and other checks as it considers appropriate. Visit our websites at: www.rbs.com www.rbs.com/gbm www.rbsgc.com *** This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Any views or opinions presented are solely those of the author and do not necessarily represent those of Amba Holdings Inc., and/or its affiliates. Important additional terms relating to this email can be obtained at http://www.ambaresearch.com/disclaimer __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Downloading Reuters data from R
Hi R, Can we download Reuters (3000 Xtra) data from R? Does ODBC package help me in this? Or otherwise, is there a way to extract daily closing prices data of Reuters from R? Thank you very much, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Mismatch in logical result?
Hi R, I have certain checkings, which gives FALSE, but actually it is true. Why does this happen? Note that the equations that I am checking below are not even the case of recurring decimals... > 1.4^2 == 1.96 [1] FALSE > 1.2^3==1.728 [1] FALSE Thanks in advance, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Row and Column positions
Hi R, m=data.frame(a=c(1,NA,5,5),b=c(4,5,6,7),c=c(NA,NA,NA,5)) I want to know the methods of getting row and column positions of NA in the above dataframe. How do I do this? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SAS Data
library(foreign) Rdata=read.ssd("Z:/MyFolder","data1",sascmd = "C:/Program Files/SAS/SAS 9.1/sas.exe") Rdata Y D1 D2 D3 1 100 1 0 0 2 101 1 0 0 3 105 1 0 0 4 200 0 1 0 5 201 0 1 0 6 205 0 1 0 7 300 0 0 1 8 301 0 0 1 9 305 0 0 1 where 'data1' is the SAS datafile to be read, ' Z:\\MyFolder' is the physical path where 'data1.sas7bdat' is situated and 'sascmd' refers to the path where SAS is installed in your system. Please confirm that your SAS is installed in the same path. Also note that you have to install the 'foreign' package to do this. BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stefo Ratino Sent: Monday, October 13, 2008 5:20 PM To: r-help@r-project.org Subject: [R] SAS Data Hello everybody, I would like to read a SAS Data data1.sas7bdat in R! Is this possible? Thank you a lot in advance ;), Stefo __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Cross-tabulation Question
Hi R, This is a cross tabulation question. Suppose that, > d=read.table("clipboard",header=F) > d V1 V2V3 A One Apple A One Cake A One Cake B One Apple B One Apple B One Apple > table(d$V2,d$V3) Apple Cake One 42 But, I don't want the count to be like the above. Here, it is counting the number of rows in that particular category. What I need is in each category, the count of unique V1's. So, my output should look like, Apple Cake One 21 Any ideas please... Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] To find vector X under contraints
Hi R, I have the variance-covariance matrix, >V=matrix(c(0.09238, 0.002407527, 0.002407527, 0.020739401),2,2) I need to find a vector X=c(x1,x2), such that 1) X'VX is equal to a constant 2 (say) and 2) sum(x) should be equal to a another constant 1.5 (say). How do we do this in R? BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] extracting max row from data matrix
> aggregate(x$weight,list(x$fruit),max) Group.1 x 1 apple 1.6 2 orange 1.6 Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Srinivas Iyyer Sent: Monday, September 08, 2008 7:55 AM To: [EMAIL PROTECTED] Subject: [R] extracting max row from data matrix dear group, i have a data matrix with some replicate items with different values. I want to extract the row with max value. for example: > x fruit weight 1 apple1.3 2 apple1.5 3 apple1.6 4 orange1.4 5 orange1.6 x is a data frame. I want to extract unique items from fruits that has max weight. that is: 3 apple1.6 5 orange1.6 I want to be able to use apply functions. Could some one lend some help please. Thanks srini __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Between the values
Not to define a vector of all infinite values... But if I have some object (may not be a vector) which has this interval, then I can apply whatever function I need to on this interval apart from 'between' function... Is there something like that... Hope I am clear with the idea... Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dan Davison Sent: Tuesday, August 12, 2008 7:21 PM To: r-help@r-project.org Subject: Re: [R] Between the values Shubha Vishwanath Karanth wrote: > > Or at least anyways of defining a vector/(or something like that) which > has all values between 0 and 1? > > For example: > C(0,1) is incorrect, seq(0,1,0.2) is also incorrect, seq(0,1,0.1) is > also incorrect How does one specify this? > > Hi Shubha, What are you trying to do? The set of all real numbers between 0 and 1 is infinitely large. Obviously you can't explicitly construct an infinitely large vector in R. If you want to construct an implicit specification of that set, then I think I've already given you a good answer in R: define a predicate function and use it. E.g. between <- function(x, low, high) x > low && x < high I don't know much at all about symbolic mathematics packages like Maple and Mathematica, but maybe you're thinking of something you can do in those softwares? R is not trying to be a competitor to them; they do lots of things R doesn't, and vice versa. Dan Shubha Vishwanath Karanth wrote: > > > Thanks, Shubha > > > -Original Message----- > From: Dan Davison [mailto:[EMAIL PROTECTED] > Sent: Tuesday, August 12, 2008 5:54 PM > To: Shubha Vishwanath Karanth > Cc: [EMAIL PROTECTED] > Subject: Re: [R] Between the values > > On Tue, Aug 12, 2008 at 05:16:01PM +0530, Shubha Vishwanath Karanth > wrote: >> Hi R, >> >> >> >> This is a very trivial one >> >> >> >> C=0.1 >> >> >> >> I want to check whether my value of C is between 0 and 1 > exclusively >> I don't want to use (C>0 & C<1). And I can't use a single statement > like >> (0 1? >> Does %in% help me? > > If you don't like (C > 0 && C < 1), then just write your own function > is.between(x, low, high) (NB1 you've basically written it already; NB2 > single '&' for the vectorised version 'are.between'). People's > personal tastes about what's desirable will vary, and anyway it's good > practice to build up your own personal library of > functions. Ultimately if you have a high quality collection of related > functions for working on a particular sort of problem, then you should > publish them as an R package on CRAN. > > Dan > >> >> >> >> >> >> Many Thanks, >> >> Shubha >> >> >> >> This e-mail may contain confidential and/or privileged > i...{{dropped:13}} >> >> __ >> R-help@r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. > > -- > www.stats.ox.ac.uk/~davison > This e-mail may contain confidential and/or privileged i...{{dropped:10}} > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > -- View this message in context: http://www.nabble.com/Between-the-values-tp18943069p18944668.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Between the values
ThanksDidn't mean actually using '&', but not bigger than that too... I usually see something done much better in R-help by a code which I don't know at all. So, wanted to know if I am missing somewhere in using some codes which I am not aware of...so, posted the query... Thanks for your help, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Ravi Varadhan [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2008 7:34 PM To: Shubha Vishwanath Karanth; 'Dan Davison' Cc: [EMAIL PROTECTED] Subject: RE: [R] Between the values Here is how you check whether a < x < b "without" using the `&' condition: is.between <- function(x, a, b) { (x - a) * (b - x) > 0 } Ravi. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Tuesday, August 12, 2008 9:46 AM To: Ravi Varadhan; Dan Davison; Ravi Varadhan; Dan Davison; Ravi Varadhan; Dan Davison; Ravi Varadhan; Dan Davison Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [R] Between the values Thanks Ravi... But was just wondering if there existed a simple tricky command for that without using the & condition Also was thinking on my second question that how do we define an interval between 0 and 1 which contains all the values between 0 and 1. Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Ravi Varadhan [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2008 7:12 PM To: Shubha Vishwanath Karanth; 'Dan Davison' Cc: [EMAIL PROTECTED] Subject: RE: [R] Between the values Hi Shubaa, Here is one way to do this: is.between <- function(x, a, b) { x > a & x < b } set.seed(123) x <- rnorm(5) is.between(x, -1, 1) > is.between(x, -1, 1) [1] TRUE TRUE FALSE TRUE TRUE > Ravi. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Tuesday, August 12, 2008 9:25 AM To: Dan Davison Cc: [EMAIL PROTECTED] Subject: Re: [R] Between the values Or at least anyways of defining a vector/(or something like that) which has all values between 0 and 1? For example: C(0,1) is incorrect, seq(0,1,0.2) is also incorrect, seq(0,1,0.1) is also incorrect How does one specify this? Thanks, Shubha -Original Message- From: Dan Davison [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2008 5:54 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Between the values On Tue, Aug 12, 2008 at 05:16:01PM +0530, Shubha Vishwanath Karanth wrote: > Hi R, > > > > This is a very trivial one > > > > C=0.1 > > > > I want to check whether my value of C is between 0 and 1 exclusively > I don't want to use (C>0 & C<1). And I can't use a single statement like > (0 Does %in% help me? If you don't like (C > 0 && C < 1), then just write your own function is.between(x, low, high) (NB1 you've basically written it already; NB2 single '&' for the vectorised version 'are.between'). People's personal tastes about what's desirable will vary, and anyway it's good practice to build up your own personal library of functions. Ultimately if you have a high quality collection of related functions for working on a particular sort of problem, then you should publish them as an R package on CRAN. Dan > > > > > > Many Thanks, > > Shubha > > > > This e-mail may contain confidential and/or privileged i...{{dropped:13}} > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- www.stats.ox.ac.uk/~davison This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented,
Re: [R] Between the values
Thanks Ravi... But was just wondering if there existed a simple tricky command for that without using the & condition Also was thinking on my second question that how do we define an interval between 0 and 1 which contains all the values between 0 and 1. Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Ravi Varadhan [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2008 7:12 PM To: Shubha Vishwanath Karanth; 'Dan Davison' Cc: [EMAIL PROTECTED] Subject: RE: [R] Between the values Hi Shubaa, Here is one way to do this: is.between <- function(x, a, b) { x > a & x < b } set.seed(123) x <- rnorm(5) is.between(x, -1, 1) > is.between(x, -1, 1) [1] TRUE TRUE FALSE TRUE TRUE > Ravi. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Tuesday, August 12, 2008 9:25 AM To: Dan Davison Cc: [EMAIL PROTECTED] Subject: Re: [R] Between the values Or at least anyways of defining a vector/(or something like that) which has all values between 0 and 1? For example: C(0,1) is incorrect, seq(0,1,0.2) is also incorrect, seq(0,1,0.1) is also incorrect How does one specify this? Thanks, Shubha -Original Message- From: Dan Davison [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2008 5:54 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Between the values On Tue, Aug 12, 2008 at 05:16:01PM +0530, Shubha Vishwanath Karanth wrote: > Hi R, > > > > This is a very trivial one > > > > C=0.1 > > > > I want to check whether my value of C is between 0 and 1 exclusively > I don't want to use (C>0 & C<1). And I can't use a single statement like > (0 Does %in% help me? If you don't like (C > 0 && C < 1), then just write your own function is.between(x, low, high) (NB1 you've basically written it already; NB2 single '&' for the vectorised version 'are.between'). People's personal tastes about what's desirable will vary, and anyway it's good practice to build up your own personal library of functions. Ultimately if you have a high quality collection of related functions for working on a particular sort of problem, then you should publish them as an R package on CRAN. Dan > > > > > > Many Thanks, > > Shubha > > > > This e-mail may contain confidential and/or privileged i...{{dropped:13}} > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- www.stats.ox.ac.uk/~davison This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Between the values
Or at least anyways of defining a vector/(or something like that) which has all values between 0 and 1? For example: C(0,1) is incorrect, seq(0,1,0.2) is also incorrect, seq(0,1,0.1) is also incorrect How does one specify this? Thanks, Shubha -Original Message- From: Dan Davison [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 12, 2008 5:54 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Between the values On Tue, Aug 12, 2008 at 05:16:01PM +0530, Shubha Vishwanath Karanth wrote: > Hi R, > > > > This is a very trivial one > > > > C=0.1 > > > > I want to check whether my value of C is between 0 and 1 exclusively > I don't want to use (C>0 & C<1). And I can't use a single statement like > (0 Does %in% help me? If you don't like (C > 0 && C < 1), then just write your own function is.between(x, low, high) (NB1 you've basically written it already; NB2 single '&' for the vectorised version 'are.between'). People's personal tastes about what's desirable will vary, and anyway it's good practice to build up your own personal library of functions. Ultimately if you have a high quality collection of related functions for working on a particular sort of problem, then you should publish them as an R package on CRAN. Dan > > > > > > Many Thanks, > > Shubha > > > > This e-mail may contain confidential and/or privileged i...{{dropped:13}} > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- www.stats.ox.ac.uk/~davison This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Between the values
Hi R, This is a very trivial one C=0.1 I want to check whether my value of C is between 0 and 1 exclusively I don't want to use (C>0 & C<1). And I can't use a single statement like (0https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Downloading Yahoo data
Yes Henrique... we are connecting to the internet through a proxy... Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Henrique Dallazuanna [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2008 8:17 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Downloading Yahoo data You are connecting to the internet trougth a proxy? On Thu, Aug 7, 2008 at 9:40 AM, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: > Hi R, > > > > I am trying to download the data from R. I give the below command. > > > >> library(fImport) > >> yahooSeries("IBM") > > trying URL > 'http://chart.yahoo.com/table.csv?s=IBM&a=7&b=08&c=2007&d=7&e=07&f=2008&; > g=d&x=.csv' > > Error in download.file(url = url, destfile = file, method = method) : > > cannot open URL > 'http://chart.yahoo.com/table.csv?s=IBM&a=7&b=08&c=2007&d=7&e=07&f=2008&; > g=d&x=.csv' > > In addition: Warning message: > > In download.file(url = url, destfile = file, method = method) : > > unable to connect to 'chart.yahoo.com' on port 80. > > Error: cannot get a slot ("data") from an object of type "character" > > In addition: Warning message: > > trying to get slot "data" from an object of a basic class ("character") > with no slots > > > > > > The problem is related with connection of R with the internet. But my > port 80 is opened. Then also the error persists. > > > > And also, the link is accessible in my PC via the direct internet. How > do I make this work? > > > > Many Thanks, > > Shubha > > > > This e-mail may contain confidential and/or privileged i...{{dropped:13}} > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Downloading Yahoo data
Hi R, I am trying to download the data from R. I give the below command. > library(fImport) > yahooSeries("IBM") trying URL 'http://chart.yahoo.com/table.csv?s=IBM&a=7&b=08&c=2007&d=7&e=07&f=2008&; g=d&x=.csv' Error in download.file(url = url, destfile = file, method = method) : cannot open URL 'http://chart.yahoo.com/table.csv?s=IBM&a=7&b=08&c=2007&d=7&e=07&f=2008&; g=d&x=.csv' In addition: Warning message: In download.file(url = url, destfile = file, method = method) : unable to connect to 'chart.yahoo.com' on port 80. Error: cannot get a slot ("data") from an object of type "character" In addition: Warning message: trying to get slot "data" from an object of a basic class ("character") with no slots The problem is related with connection of R with the internet. But my port 80 is opened. Then also the error persists. And also, the link is accessible in my PC via the direct internet. How do I make this work? Many Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] "dens" function
Hi R, Is there a function called "dens" in R? Is it similar to density? I found this function in an RExcel demo... Or is it in a specific other package? The function is used as (=rapply("dens",A11:A1010,100,D8,-5,5)) Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] sequential sum of a vector...
Many Thanks Jorge... That was one more way...Is it possible if I can do this without using rep(1:10,each=8) or the groupingbecause I feel the number 8 here is fixed... If there is some technique of tracking the position of first 8, then next 8... don't know whether I am clear in conveying... Thanks, shubha From: Jorge Ivan Velez [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2008 8:59 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] sequential sum of a vector... Dear Shubha, Try this: x=1:80 tapply(x,rep(1:10,each=8),sum) 1 2 3 4 5 6 7 8 9 10 36 100 164 228 292 356 420 484 548 612 HTH, Jorge On Wed, Jul 23, 2008 at 10:03 AM, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: Hi R, Let, x=1:80 I want to sum up first 8 elements of x, then again next 8 elements of x, then again another 8 elements. So, my new vector should look like: c(36,100,164,228,292,356,420,484,548,612) I used: aggregate(x,list(rep(1:10,each=8)),sum)[-1] or rowsum(x,group=rep(1:10,each=8)) But without grouping, can I achieve the required? Any other ways of doing this? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] sequential sum of a vector...
Hi R, Let, x=1:80 I want to sum up first 8 elements of x, then again next 8 elements of x, then again another 8 elements. So, my new vector should look like: c(36,100,164,228,292,356,420,484,548,612) I used: aggregate(x,list(rep(1:10,each=8)),sum)[-1] or rowsum(x,group=rep(1:10,each=8)) But without grouping, can I achieve the required? Any other ways of doing this? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Simple... but...
OK, Let x=c(4,2,2) y=c(1,5,3) My result should be c(4,1,2,5,2,3) Thanks, Shubha -Original Message- From: Doran, Harold [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 23, 2008 6:47 PM To: Shubha Vishwanath Karanth; [EMAIL PROTECTED] Subject: RE: [R] Simple... but... x <- c(1,3,5) y <- c(2,4,6) sort(c(x,y)) > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Shubha > Vishwanath Karanth > Sent: Wednesday, July 23, 2008 8:55 AM > To: [EMAIL PROTECTED] > Subject: [R] Simple... but... > > Hi R, > > > > If > > x=c(1,3,5) > > y=c(2,4,6) > > > > I need a vector which is c(1,2,3,4,5,6) from x and y. > > > > How do I do it? I mean the best way > > > > Thanks, Shubha > > > > This e-mail may contain confidential and/or privileged > i...{{dropped:13}} > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Simple... but...
Guess this should be fine c(rbind(x,y)) Please let me know if there are some better ways... Thanks, Shubha -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Wednesday, July 23, 2008 6:25 PM To: [EMAIL PROTECTED] Subject: [R] Simple... but... Hi R, If x=c(1,3,5) y=c(2,4,6) I need a vector which is c(1,2,3,4,5,6) from x and y. How do I do it? I mean the best way Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Simple... but...
Hi R, If x=c(1,3,5) y=c(2,4,6) I need a vector which is c(1,2,3,4,5,6) from x and y. How do I do it? I mean the best way Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] A neural network problem---neuralnet package
Hi R, Here's a question/problem on the 'neuralnet' package for neural networks. I have more than 50 factors in each of my independent variables. When I apply the command 'neuralnet', I get the below warning message, > net.sum <- neuralnet( Sum~Var1+Var2+Var3, b, hidden=0,linear.output=TRUE) Warning message: 'predictions' will not be calculated, as at least one covariate contains more than 50 different values > > net.sum$predictions NULL Understand that the documentation of 'neuralnet' also says this. But I need to get the predictions. How do I achieve this? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Sum(Random Numbers)=100
...actually I need to allocate certain amount of money (here I mentioned it as 100) to a randomly selected stocks(50 stocks)... i.e., 100 being divided among 50 stocks and preferably all are integer allocations(i.e., 5 8 56 12 etc without any decimals)... Thank you, Shubha -Original Message- From: Moshe Olshansky [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 08, 2008 12:09 PM To: [EMAIL PROTECTED]; Shubha Vishwanath Karanth Subject: Re: [R] Sum(Random Numbers)=100 If they are really random you can not expect their sum to be 100. However, it is not difficult to get that given that the sum of n independent Poisson random variables equals N, any individual one has the conditional binomial distribution with size = N and p = 1/n, i.e. P(Xi=k/Sn=N) = (N over k)*(1/n)^k*((n-1)/n)^(N-k). So you can generate X1 binomial with size = 100 and p = 1/50; if X1 = k1 then the sum of the rest 49 must equal 100 - k1, so now you generate X2 binomial with size = 100-k1 and p = 1/49; if X2 = k2 then generate X3 binomial with size = 100 -(k1+k2) and p = 1/48, etc. Why do you need this? --- On Tue, 8/7/08, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: > From: Shubha Vishwanath Karanth <[EMAIL PROTECTED]> > Subject: [R] Sum(Random Numbers)=100 > To: [EMAIL PROTECTED] > Received: Tuesday, 8 July, 2008, 3:58 PM > Hi R, > > > > I need to generate 50 random numbers (preferably poisson), > such that > their sum is equal to 100. How do I do this? > > > > > > Thank you, > > Shubha > > > > This e-mail may contain confidential and/or privileged > i...{{dropped:13}} > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, > reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Sum(Random Numbers)=100
Hi R, I need to generate 50 random numbers (preferably poisson), such that their sum is equal to 100. How do I do this? Thank you, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Comparison between R and MATLAB
Hi R, Can I get a comparison between R and MATLAB? How is R efficient than MATLAB? Or what are the weaknesses of R compared to MATLAB? Thank you very much for your help, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Calling R functions into C# or C++
Hi R, I have a request... Can I call R functions/routines from C# or C++? If so, how do I do this? Do I need to have some knowledge on DLL to do this? Thanks a lot for your help, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] The log function problem
Hi R, Please see the below commands. The question is I can see the value of log(2) before loading the package fcalendar in R. But after loading the package, the 'log' function doesn't work. How to solve this problem? Also note that the function code differs before and after downloading the packages. > log function (x, base = exp(1)) .Primitive("log") > log(2) [1] 0.6931472 > library(fCalendar) Loading required package: fEcofin Rmetrics, (C) 1999-2006, Diethelm Wuertz, GPL fCalendar: Time, Date and Calendar Tools > library(fCalendar) > log function (x, base = exp(1)) { UseMethod("log") } > log(2) Error in .Internal(log(x)) : no internal function "log" Many Thanks for your help, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Polynomial Goal Programming
Hello R, Is there a package to perform Polynomial goal programming in R? BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Overlaying the matrices
Suppose if I modify the question as: > x A B C D E a 0 0 0 0 1 b 0 1 0 2 1 c 1 2 0 1 2 d 0 0 0 2 0 e 0 1 2 0 2 > y D E F b 2 1 2 a 4 0 1 f 1 4 1 I need to get a matrix, which has the dimension being the union of the row names and column names of both x and y such that the new matrix 'xx' should contain only the corresponding elements in x, rest all should be NA. Any ideas for this? Thanks, Shubha -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Monday, June 09, 2008 4:57 PM To: [EMAIL PROTECTED] Subject: [R] Overlaying the matrices Hi R, I have a matrix, > x1=matrix(NA,6,6,dimnames=list(letters[1:6],LETTERS[1:6])) > x1 A B C D E F a NA NA NA NA NA NA b NA NA NA NA NA NA c NA NA NA NA NA NA d NA NA NA NA NA NA e NA NA NA NA NA NA f NA NA NA NA NA NA > x2=matrix(rpois(9,1),3,3,dimnames=list(c("b","a","f"),c("D","E","F"))) > x2 D E F b 0 3 0 a 2 2 1 f 1 0 0 I need to put the values of x2 in the corresponding elements of x1. So then, x1 would look like: A B C D E F a NA NA NA 2 2 1 b NA NA NA 0 3 0 c NA NA NA NA NA NA d NA NA NA NA NA NA e NA NA NA NA NA NA f NA NA NA 1 0 0 What would be the best way to do this? Many Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Overlaying the matrices
Hi R, I have a matrix, > x1=matrix(NA,6,6,dimnames=list(letters[1:6],LETTERS[1:6])) > x1 A B C D E F a NA NA NA NA NA NA b NA NA NA NA NA NA c NA NA NA NA NA NA d NA NA NA NA NA NA e NA NA NA NA NA NA f NA NA NA NA NA NA > x2=matrix(rpois(9,1),3,3,dimnames=list(c("b","a","f"),c("D","E","F"))) > x2 D E F b 0 3 0 a 2 2 1 f 1 0 0 I need to put the values of x2 in the corresponding elements of x1. So then, x1 would look like: A B C D E F a NA NA NA 2 2 1 b NA NA NA 0 3 0 c NA NA NA NA NA NA d NA NA NA NA NA NA e NA NA NA NA NA NA f NA NA NA 1 0 0 What would be the best way to do this? Many Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] sum of unknown number of matrices
Thanks all...Reduce() is the new function I learnt today... Thanks... BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Barry Rowlingson [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2008 8:49 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] sum of unknown number of matrices Shubha Vishwanath Karanth wrote: > I need: > >> a+b+c+d > > [,1] [,2] > > [1,]4 12 > > [2,]8 16 > > > > Something like do.call("+",l) is not working...why is this? Because do.call constructs a function call with the elements of l as arguments, so you end up with: "+"(1:4, 1:4, 1:4, 1:4) but "+" only takes two arguments. Use 'Reduce': > Reduce("+",l) [,1] [,2] [1,]4 12 [2,]8 16 Barry This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] sum of unknown number of matrices
Hi R, I have a list of matrices. I need to get the sum of all the matrices in the list. Example: a=b=c=d=matrix(1:4,2,2) l=list(a,b,c,d) I need: > a+b+c+d [,1] [,2] [1,]4 12 [2,]8 16 Something like do.call("+",l) is not working...why is this? I may not be knowing the number of matrices in the list... Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Solving 100th order equation
Was also wondering which theoretical method is used to solve this problem? Thanks, Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Saturday, May 24, 2008 6:13 PM To: Peter Dalgaard Cc: Shubha Vishwanath Karanth; [EMAIL PROTECTED]; Duncan Murdoch Subject: Re: [R] Solving 100th order equation On Sat, May 24, 2008 at 8:31 AM, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > Shubha Vishwanath Karanth wrote: >> >> To apply uniroot I don't even know the interval values... Does numerical >> methods help me? Or any other method? >> >> Thanks and Regards, >> Shubha >> >> -Original Message- >> From: Duncan Murdoch [mailto:[EMAIL PROTECTED] Sent: Saturday, May 24, >> 2008 5:08 PM >> To: Shubha Vishwanath Karanth >> Subject: Re: [R] Solving 100th order equation >> >> Shubha Vishwanath Karanth wrote: >> >>> >>> Hi R, >>> >>> >>> I have a 100th order equation for which I need to solve the value for x. >>> Is there a package to do this? >>> >>> >>> For example my equation is: >>> >>> >>> (x^100 )- (2*x^99) +(10*x^50)+.. +(6*x ) = 4000 >>> >>> >>> I have only one unknown value and that is x. How do I solve for this? >>> >>> >> >> uniroot() will find one root. If you want all of them, I don't know what >> is available. >> >> Duncan Murdoch >> > > polyroot() is built for this, but it stops at 48th degree polynomials, at > least as currently implemented. Not sure that it (or anything else) would be > stable beyond that limit. YACAS perhaps? > Unfortunately yacas does not seem to be able to handle it: > library(Ryacas) > x <- Sym("x") > Solve((x^100 )- (2*x^99) +(10*x^50)+(6*x ) - 4000 == 0, x) [1] "Starting Yacas!" expression(list()) Simpler one works ok: > Solve(x^2 - 1, x) expression(list(x == 1, x == -1)) This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Solving 100th order equation
To apply uniroot I don't even know the interval values... Does numerical methods help me? Or any other method? Thanks and Regards, Shubha -Original Message- From: Duncan Murdoch [mailto:[EMAIL PROTECTED] Sent: Saturday, May 24, 2008 5:08 PM To: Shubha Vishwanath Karanth Subject: Re: [R] Solving 100th order equation Shubha Vishwanath Karanth wrote: > Hi R, > > > > I have a 100th order equation for which I need to solve the value for x. Is > there a package to do this? > > > > For example my equation is: > > > > (x^100 )- (2*x^99) +(10*x^50)+.. +(6*x ) = 4000 > > > > I have only one unknown value and that is x. How do I solve for this? > > uniroot() will find one root. If you want all of them, I don't know what is available. Duncan Murdoch > > > > > > > BR, Shubha > > Shubha Karanth | Amba Research > > Ph +91 80 3980 8031 | Mob +91 94 4886 4510 > > Bangalore * Colombo * London * New York * San José * Singapore * > www.ambaresearch.com > > > > This e-mail may contain confidential and/or privileged i...{{dropped:13}} > > > > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Solving 100th order equation
Hi R, I have a 100th order equation for which I need to solve the value for x. Is there a package to do this? For example my equation is: (x^100 )- (2*x^99) +(10*x^50)+.. +(6*x ) = 4000 I have only one unknown value and that is x. How do I solve for this? BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Pros and Cons of R
Completely agreed! BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ruben Roa Ureta Sent: Thursday, May 22, 2008 10:53 PM To: Monica Pisica Cc: r-help@r-project.org Subject: Re: [R] Pros and Cons of R > Hi, > > I am doing a very informal presentation for my office about R capabilities > to deal with and analyze spatial data, display data and maps, and > connections with GIS. I've used in my presentation info from the CRAN, the > spatial Task view, and the more striking graphics examples from > http://addictedtor.free.fr/graphiques/thumbs.php and NCEAS > http://www.nceas.ucsb.edu/scicomp/GISSeminar/UseCases/MapProdWithRGraphics/OneMapProdWithRGraphics.html > together with examples of my own work. > > I am finishing with pros and cons about R and I am wondering if you can > come up with other examples, or comments. Here they are: > > Pros: > > - R is a programming environment well suited for statistical analysis. > - R is open source and cross platforms (Windows, Mac, Linux). > - Fortran, C (C++), and Python wrappers are in place. > - Deals well with spatial data, has a robust graphical interface and has > an active user group list / forum. > - External packages for R are almost daily increasing, most of them based > on published up-to-date books and peer-reviewed articles. > - R related books - quite a few I think you should considering adding the quality of support, as represented by this list and the archives (easily accesible with RSiteSearch). Not many softwares have their creators and best minds answering the cries for help from the most humble users (though these creators and best minds can be rough at times, probably with good reasons). Rubén __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Reading SAS data into R
By RD library I mean the xport library... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Shubha Vishwanath Karanth Sent: Thursday, May 15, 2008 7:21 PM To: [EMAIL PROTECTED] Cc: Peter Dalgaard Subject: RE: [R] Reading SAS data into R Oh!...Got that...A member in the RD library of SAS can contain only 8 characters in its filename. Since the variables 'tsubset1', 'tsubset2','tsubset9' had exactly 8 letters in the name, those files read properly and then onwards, since the number of letters/characters exceeded 8, those were not read! Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Thursday, May 15, 2008 6:35 PM To: Peter Dalgaard Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Seems that it gets deleted But lemme try again by providing the arguments... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Peter Dalgaard [mailto:[EMAIL PROTECTED] Sent: Thursday, May 15, 2008 6:30 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Shubha Vishwanath Karanth wrote: > Hi R, > > > > Suppose that SAS dataset 'tsubset1' is stored in the path, "Z:/data". > Then I give the below read.ssd() command to read SAS dataset, > 'tsubset1.sas7bat' into R. > > > > >> library(foreign) >> > > >> s=read.ssd("Z:/data","tsubset1",sascmd = "C:/Program Files/SAS/SAS >> > 9.1/sas.exe") > > >> s >> > > A B C > > 1 3 4 5 > > 2 6 7 8 > > 3 3 4 5 > > > > It reads perfect! It reads well for "tsubset1","tsubset2",., > "tsubset9" datasets. But then onwards it gives an error as below: > > > > * s=read.ssd("Z:/data","tsubset10",sascmd = "C:/Program > Files/SAS/SAS 9.1/sas.exe") > > > > SAS failed. SAS program at > C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file6df11649.sas > > The log file will be file6df11649.log in the current directory > > Warning message: > > In read.ssd("Z:/data", "tsubset1011", sascmd = "C:/Program Files/SAS/SAS > 9.1/sas.exe") : > > SAS return code was 2 > > > > Why is this? Are two numerical digits in a filename of a SAS dataset > cannot be read by R? The error prevails for "tsubset201", "tsubset35462" > etc Can somebody point out to me where actually the error is? > > What is in the SAS log file? -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Reading SAS data into R
Oh!...Got that...A member in the RD library of SAS can contain only 8 characters in its filename. Since the variables 'tsubset1', 'tsubset2','tsubset9' had exactly 8 letters in the name, those files read properly and then onwards, since the number of letters/characters exceeded 8, those were not read! Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Thursday, May 15, 2008 6:35 PM To: Peter Dalgaard Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Seems that it gets deleted But lemme try again by providing the arguments... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Peter Dalgaard [mailto:[EMAIL PROTECTED] Sent: Thursday, May 15, 2008 6:30 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Shubha Vishwanath Karanth wrote: > Hi R, > > > > Suppose that SAS dataset 'tsubset1' is stored in the path, "Z:/data". > Then I give the below read.ssd() command to read SAS dataset, > 'tsubset1.sas7bat' into R. > > > > >> library(foreign) >> > > >> s=read.ssd("Z:/data","tsubset1",sascmd = "C:/Program Files/SAS/SAS >> > 9.1/sas.exe") > > >> s >> > > A B C > > 1 3 4 5 > > 2 6 7 8 > > 3 3 4 5 > > > > It reads perfect! It reads well for "tsubset1","tsubset2",., > "tsubset9" datasets. But then onwards it gives an error as below: > > > > * s=read.ssd("Z:/data","tsubset10",sascmd = "C:/Program > Files/SAS/SAS 9.1/sas.exe") > > > > SAS failed. SAS program at > C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file6df11649.sas > > The log file will be file6df11649.log in the current directory > > Warning message: > > In read.ssd("Z:/data", "tsubset1011", sascmd = "C:/Program Files/SAS/SAS > 9.1/sas.exe") : > > SAS return code was 2 > > > > Why is this? Are two numerical digits in a filename of a SAS dataset > cannot be read by R? The error prevails for "tsubset201", "tsubset35462" > etc Can somebody point out to me where actually the error is? > > What is in the SAS log file? -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Reading SAS data into R
After running the codes in the log file, I realized that this has something to do with SAS only... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Shubha Vishwanath Karanth Sent: Thursday, May 15, 2008 7:03 PM To: Peter Dalgaard Cc: [EMAIL PROTECTED] Subject: RE: [R] Reading SAS data into R Hi Peter, Realized that the log files are generated only when there is an error. Here are my contents of the log file: libname src2rd 'Z:/data'; libname rd xport 'C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file323b4e45'; proc copy in=src2rd out=rd; select tsubset10 ; Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Thursday, May 15, 2008 6:35 PM To: Peter Dalgaard Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Seems that it gets deleted But lemme try again by providing the arguments... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Peter Dalgaard [mailto:[EMAIL PROTECTED] Sent: Thursday, May 15, 2008 6:30 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Shubha Vishwanath Karanth wrote: > Hi R, > > > > Suppose that SAS dataset 'tsubset1' is stored in the path, "Z:/data". > Then I give the below read.ssd() command to read SAS dataset, > 'tsubset1.sas7bat' into R. > > > > >> library(foreign) >> > > >> s=read.ssd("Z:/data","tsubset1",sascmd = "C:/Program Files/SAS/SAS >> > 9.1/sas.exe") > > >> s >> > > A B C > > 1 3 4 5 > > 2 6 7 8 > > 3 3 4 5 > > > > It reads perfect! It reads well for "tsubset1","tsubset2",., > "tsubset9" datasets. But then onwards it gives an error as below: > > > > * s=read.ssd("Z:/data","tsubset10",sascmd = "C:/Program > Files/SAS/SAS 9.1/sas.exe") > > > > SAS failed. SAS program at > C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file6df11649.sas > > The log file will be file6df11649.log in the current directory > > Warning message: > > In read.ssd("Z:/data", "tsubset1011", sascmd = "C:/Program Files/SAS/SAS > 9.1/sas.exe") : > > SAS return code was 2 > > > > Why is this? Are two numerical digits in a filename of a SAS dataset > cannot be read by R? The error prevails for "tsubset201", "tsubset35462" > etc Can somebody point out to me where actually the error is? > > What is in the SAS log file? -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Reading SAS data into R
Hi Peter, Realized that the log files are generated only when there is an error. Here are my contents of the log file: libname src2rd 'Z:/data'; libname rd xport 'C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file323b4e45'; proc copy in=src2rd out=rd; select tsubset10 ; Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Thursday, May 15, 2008 6:35 PM To: Peter Dalgaard Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Seems that it gets deleted But lemme try again by providing the arguments... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Peter Dalgaard [mailto:[EMAIL PROTECTED] Sent: Thursday, May 15, 2008 6:30 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Shubha Vishwanath Karanth wrote: > Hi R, > > > > Suppose that SAS dataset 'tsubset1' is stored in the path, "Z:/data". > Then I give the below read.ssd() command to read SAS dataset, > 'tsubset1.sas7bat' into R. > > > > >> library(foreign) >> > > >> s=read.ssd("Z:/data","tsubset1",sascmd = "C:/Program Files/SAS/SAS >> > 9.1/sas.exe") > > >> s >> > > A B C > > 1 3 4 5 > > 2 6 7 8 > > 3 3 4 5 > > > > It reads perfect! It reads well for "tsubset1","tsubset2",., > "tsubset9" datasets. But then onwards it gives an error as below: > > > > * s=read.ssd("Z:/data","tsubset10",sascmd = "C:/Program > Files/SAS/SAS 9.1/sas.exe") > > > > SAS failed. SAS program at > C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file6df11649.sas > > The log file will be file6df11649.log in the current directory > > Warning message: > > In read.ssd("Z:/data", "tsubset1011", sascmd = "C:/Program Files/SAS/SAS > 9.1/sas.exe") : > > SAS return code was 2 > > > > Why is this? Are two numerical digits in a filename of a SAS dataset > cannot be read by R? The error prevails for "tsubset201", "tsubset35462" > etc Can somebody point out to me where actually the error is? > > What is in the SAS log file? -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Reading SAS data into R
Seems that it gets deleted But lemme try again by providing the arguments... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Peter Dalgaard [mailto:[EMAIL PROTECTED] Sent: Thursday, May 15, 2008 6:30 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Reading SAS data into R Shubha Vishwanath Karanth wrote: > Hi R, > > > > Suppose that SAS dataset 'tsubset1' is stored in the path, "Z:/data". > Then I give the below read.ssd() command to read SAS dataset, > 'tsubset1.sas7bat' into R. > > > > >> library(foreign) >> > > >> s=read.ssd("Z:/data","tsubset1",sascmd = "C:/Program Files/SAS/SAS >> > 9.1/sas.exe") > > >> s >> > > A B C > > 1 3 4 5 > > 2 6 7 8 > > 3 3 4 5 > > > > It reads perfect! It reads well for "tsubset1","tsubset2",., > "tsubset9" datasets. But then onwards it gives an error as below: > > > > * s=read.ssd("Z:/data","tsubset10",sascmd = "C:/Program > Files/SAS/SAS 9.1/sas.exe") > > > > SAS failed. SAS program at > C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file6df11649.sas > > The log file will be file6df11649.log in the current directory > > Warning message: > > In read.ssd("Z:/data", "tsubset1011", sascmd = "C:/Program Files/SAS/SAS > 9.1/sas.exe") : > > SAS return code was 2 > > > > Why is this? Are two numerical digits in a filename of a SAS dataset > cannot be read by R? The error prevails for "tsubset201", "tsubset35462" > etc Can somebody point out to me where actually the error is? > > What is in the SAS log file? -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Reading SAS data into R
Hi R, Suppose that SAS dataset 'tsubset1' is stored in the path, "Z:/data". Then I give the below read.ssd() command to read SAS dataset, 'tsubset1.sas7bat' into R. > library(foreign) > s=read.ssd("Z:/data","tsubset1",sascmd = "C:/Program Files/SAS/SAS 9.1/sas.exe") > s A B C 1 3 4 5 2 6 7 8 3 3 4 5 It reads perfect! It reads well for "tsubset1","tsubset2",., "tsubset9" datasets. But then onwards it gives an error as below: * s=read.ssd("Z:/data","tsubset10",sascmd = "C:/Program Files/SAS/SAS 9.1/sas.exe") SAS failed. SAS program at C:\DOCUME~1\SHUBHA~1.AMB\LOCALS~1\Temp\1\RtmpObHuqk\file6df11649.sas The log file will be file6df11649.log in the current directory Warning message: In read.ssd("Z:/data", "tsubset1011", sascmd = "C:/Program Files/SAS/SAS 9.1/sas.exe") : SAS return code was 2 Why is this? Are two numerical digits in a filename of a SAS dataset cannot be read by R? The error prevails for "tsubset201", "tsubset35462" etc Can somebody point out to me where actually the error is? Many Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] apply function
Hi R, Getting a strange result using ?apply. Please look into the below codes: > d=data.frame(a=c(1,2,3),b=c("A","B","C"),c=c(TRUE,FALSE,FALSE),d=c(T,F,F )) > class(d[,1]) [1] "numeric" > class(d[,2]) [1] "factor" > class(d[,3]) [1] "logical" > class(d[,4]) [1] "logical" > apply(d,2,class) a b c d "character" "character" "character" "character" > apply(d[,c(1,3)],2,class) a c "numeric" "numeric" > apply(d[,c(3,4)],2,class) c d "logical" "logical" > apply(d[,c(3,2)],2,class) c b "character" "character" > Why is this so? How do I get the actual classes of columns of my dataframe d? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] A very simple question
Hi R, Suppose l=c(1,1,1,2,2,1,1,1) k[-which(k==1)] [1] 2 2 k[-which(k==2)] [1] 1 1 1 1 1 1 But, k[-which(k==3)] numeric(0) I do not want this numeric(0), instead the whole k itself should be my result... How do I do this? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] dataframes to a list
How do I proceed from this stage? paste("data",1:10,sep="",collapse=",") Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Wednesday, May 14, 2008 3:59 PM To: [EMAIL PROTECTED] Subject: [R] dataframes to a list Hi R, I have the data frames, data1, data2data50. Now I want to put all of these in a single list. But, >list(data1, data2,.data50) is very big to write. How do I then do it? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] dataframes to a list
Hi R, I have the data frames, data1, data2data50. Now I want to put all of these in a single list. But, >list(data1, data2,.data50) is very big to write. How do I then do it? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Remove an object by the reference
Hi R, A simple question, but don't know the answer... x="a" a=5 I need to remove the object "a" by using only x. something like rm(somefunction(x))...Is this possible? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Regular Expressions
Hi R, Again struck with regular expressions... Suppose, S=c("World_is_beautiful", "one_two_three_four","My_book") I need to extract the last but one element of the strings. So, my output should look like: Ans=c("is","three","My") gsub() can do this...but wondering how do I give the regular expression Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Quadratic Constraints
Hello R, By any chance, Rdonlp2 package of R defined in http://arumat.net/Rdonlp2/tutorial.html#SECTION0002 serves the below purpose? BR, Shubha -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Monday, May 12, 2008 3:27 PM To: [EMAIL PROTECTED] Subject: [R] Quadratic Constraints Hi R, A quick question How can I optimize the objective function constrained to quadratic constraints? Which function of R is useful for quadratic constraints? Many Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Quadratic Constraints
Hi R, A quick question How can I optimize the objective function constrained to quadratic constraints? Which function of R is useful for quadratic constraints? Many Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Re turning variable names with variables (in a function)
You can just go for a small change in the function as, results <- cbind(se, upper, lower, cv) OR results <- data.frame(se, upper, lower, cv) -S- -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stropharia Sent: Thursday, May 08, 2008 5:51 PM To: r-help@r-project.org Subject: [R] Re turning variable names with variables (in a function) Dear R Users, I have written a function that returns 4 variables. I would like to have the variables returned with their variable names, is this possible? - R Code - mc.error <- function(T, p=0.05){ se <- sqrt((p)*(1-(p))/T) # standard error upper <- p+(1.96*se) # upper CI lower <- p-(1.96*se) # lower CI cv <- se/p # coefficient of variation results <- c(se, upper, lower, cv) return(results) } - R Code - This returns (or something like this, depending on the value of T): [1] 0.004998685 0.059797422 0.040202578 0.099973695 I would like: [1] se=0.004998685 upper=0.059797422 lower=0.040202578 cv=0.099973695 Or even better: se upper lowercv 0.004998685 0.059797422 0.040202578 0.099973695 Any help is much appreciated, thanks. Steve ~~ Steven Worthington Ph.D. Candidate New York Consortium in Evolutionary Primatology & Department of Anthropology New York University 25 Waverly Place New York, NY 10003 U.S.A. ~~ -- View this message in context: http://www.nabble.com/Returning-variable-names-with-variables-%28in-a-fu nction%29-tp17124874p17124874.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] orders of the arima model
Hi R, Was just checking the "?ar ", the autoregressive model. It's great that R can give the order of the autoregressive model. Suppose if I had 2000 observations to fit an AR model. Then, if I am correct R builds 33+1 autoregressive models (10*log10(2000)=33) and select the order at which the aic's of the models were the least. My question is whether the procedure "?arima " can throw the orders (p and q) of the arima model? Many Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] To preserve the class "Matrix"
Thank you very much Mark! That worked Just a question, ?[ does give an error to me...how do I find it? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Shubha Vishwanath Karanth Sent: Tuesday, May 06, 2008 8:50 PM To: 'Mark Leeds' Subject: RE: [R] To preserve the class "Matrix" Thank you very much Mark! That worked Just a question, ?[ does give an error to me...how do I find it? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Mark Leeds [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 06, 2008 8:46 PM To: Shubha Vishwanath Karanth Subject: RE: [R] To preserve the class "Matrix" Hui Shubha: If I understand what you're asking, you want to use drop=FALSE as in a[1,,drop=FALSE] That retains the dimension ( ie, the matrixness ) of the object. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Tuesday, May 06, 2008 11:07 AM To: [EMAIL PROTECTED] Subject: [R] To preserve the class "Matrix" Hi, Suppose a=matrix(1:9,3,3) > a [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 Now, > class(a[1:2,]) [1] "matrix" > class(a[1:3,]) [1] "matrix" > class(a[,1:2]) [1] "matrix" > class(a[,1:3]) [1] "matrix" But, > class(a[1,]) [1] "integer" > class(a[,1]) [1] "integer" Can in a general way get class(a[1,]) or class(a[,1]) to be "matrix" only? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San Josi * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] To preserve the class "Matrix"
Hi, Suppose a=matrix(1:9,3,3) > a [,1] [,2] [,3] [1,]147 [2,]258 [3,]369 Now, > class(a[1:2,]) [1] "matrix" > class(a[1:3,]) [1] "matrix" > class(a[,1:2]) [1] "matrix" > class(a[,1:3]) [1] "matrix" But, > class(a[1,]) [1] "integer" > class(a[,1]) [1] "integer" Can in a general way get class(a[1,]) or class(a[,1]) to be "matrix" only? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] single plot statement, multiple plots
Wonderful...This works... lapply(list(x1,x2,x3,x4),plot,type="l") Thanks a lot! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Winsemius Sent: Tuesday, May 06, 2008 7:55 PM To: [EMAIL PROTECTED] Subject: Re: [R] single plot statement, multiple plots "Shubha Vishwanath Karanth" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > Hi R, > > par(mfrow=c(2,2)) > > x1=(1:5)^1; x2=(1:5)^2; x3=(1:5)^3; x4=(1:5)^4 > > I need to write a single plot statement, which creates 4 plots (for > x1, x2, x3 and x4) in the graphics window, without using 'for' loop. > Is this possible? Does 'do.call' help in this context? Or do I have > any option in the 'plot' statement itself to do this? > Have you considered lapply()? -- David Winsemius __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] single plot statement, multiple plots
Thank you very much Gabor...Zoo is very powerful... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 06, 2008 7:40 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] single plot statement, multiple plots Try plot.zoo in which case you don't need the par: library(zoo) plot(zoo(cbind(x1, x2, x3, x4)), nc = 2) or plot(zoo(outer(1:5, 1:4, "^")), nc = 2) See ?plot.zoo, ?xyplot.zoo and the three vignettes in the zoo package. On Tue, May 6, 2008 at 9:47 AM, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: > Hi R, > > > > par(mfrow=c(2,2)) > > x1=(1:5)^1; x2=(1:5)^2; x3=(1:5)^3; x4=(1:5)^4 > > > > I need to write a single plot statement, which creates 4 plots (for x1, > x2, x3 and x4) in the graphics window, without using 'for' loop. Is this > possible? Does 'do.call' help in this context? Or do I have any option > in the 'plot' statement itself to do this? > > > > Thanks in advance, > > Shubha > > This e-mail may contain confidential and/or privileged i...{{dropped:13}} > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] single plot statement, multiple plots
Hi R, par(mfrow=c(2,2)) x1=(1:5)^1; x2=(1:5)^2; x3=(1:5)^3; x4=(1:5)^4 I need to write a single plot statement, which creates 4 plots (for x1, x2, x3 and x4) in the graphics window, without using 'for' loop. Is this possible? Does 'do.call' help in this context? Or do I have any option in the 'plot' statement itself to do this? Thanks in advance, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Number of words in a string
So powerful, the gsub... But I really don’t understand the how the regular expressions like " *\\S+$", need to be used and how to make best use of it... Any article/material/links that I can go through? BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore • Colombo • London • New York • San José • Singapore • www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Charilaos Skiadas Sent: Thursday, April 10, 2008 3:10 AM To: Hans-Jörg Bibiko Cc: [EMAIL PROTECTED] Subject: Re: [R] Number of words in a string On Apr 9, 2008, at 1:27 PM, Hans-Jörg Bibiko wrote: > > On 09.04.2008, at 17:46, Shubha Vishwanath Karanth wrote: >> To put it simple, >> >> C=c("My Dog", "Its really good", "Beautiful") >> >> Now, >> SOMEFUNCTION(C) should give: c("My", "Its really", "") > > SOMEFUNCTION <- function(x) gsub(" *\\w+$", "", x) > > But be aware that this won't work for instance for combining > diacritics. > If you have this: > > C <- c("My Dog", "Its really good", "Beautiful", "Tuli faŝda") > > in fasda above the s is a combining circumfix ^ > > would give > > [1] "My" "Its really" "" "Tuli faŝ" > > Then one should use the strsplit approach. How about: SOMEFUNCTION <- function(x) gsub(" *\\S+$", "", x) > Cheers, > > --Hans Haris Skiadas Department of Mathematics and Computer Science Hanover College __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Any views or opinions presented are solely those of the author and do not necessarily represent those of Amba Holdings Inc., and/or its affiliates. Important additional terms relating to this email can be obtained at http://www.ambaresearch.com/disclaimer __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Number of words in a string
To put it simple, C=c("My Dog", "Its really good", "Beautiful") Now, SOMEFUNCTION(C) should give: c("My", "Its really", "") Thanks, Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Wednesday, April 09, 2008 9:01 PM To: Markus Gesmann; [EMAIL PROTECTED] Subject: Re: [R] Number of words in a string Exactly...this is what I wanted... Can we also extract/remove the last word of the strings? Example: > C=c("My Dog", "Its really good", "Beautiful") > sapply(strsplit(C, " "), length) [1] 2 3 1 Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Markus Gesmann [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 09, 2008 9:00 PM To: Shubha Vishwanath Karanth; [EMAIL PROTECTED] Subject: RE: [R] Number of words in a string Would this: sapply(strsplit(C, " "), length) work for? Markus Gesmann │Associate Director│Libero Ventures Ltd, One Broadgate, London EC2M 2QS tel: +44 (0)207 826 9080│ dir: +44 (0)207 826 9085│fax: +44 (0)207 826 9090 │www.libero.uk.com A Lehman Brothers Company AUTHORISED AND REGULATED BY THE FINANCIAL SERVICES AUTHORITY -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: 09 April 2008 16:21 To: [EMAIL PROTECTED] Subject: [R] Number of words in a string Hi R, A quick question: How do we find the number of words in a string? Example: C="Have a nice day" And the number of words should be 4. any built in function or?... Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} This message is intended for the personal and confidential use for the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction or as an official statement of Libero Ventures Ltd. Email transmissions cannot be guaranteed to be secure or error-free. Therefore we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Any views or opinions presented are solely those of the author and do not necessarily represent those of Amba Holdings Inc., and/or its affiliates. Important additional terms relating to this email can be obtained at http://www.ambaresearch.com/disclaimer __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Any views or opinions presented are solely those of the author and do not necessarily represent those of Amba Holdings Inc., and/or its affiliates. Important additional terms relating to this email can be obtained at http://www.ambaresearch.com/disclaimer __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Number of words in a string
Got all the answers using ?strsplit... Is there any way without using string split?... More specifically... How can I just extract the last word in all the strings without using ?strsplit ? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hans-Joerg Bibiko Sent: Wednesday, April 09, 2008 9:10 PM To: [EMAIL PROTECTED] Subject: Re: [R] Number of words in a string On 9 Apr 2008, at 17:29, Markus Gesmann wrote: > Would this: > > sapply(strsplit(C, " "), length) > > work for? or length(unlist(strsplit(C, " "))) --Hans __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Number of words in a string
Exactly...this is what I wanted... Can we also extract/remove the last word of the strings? Example: > C=c("My Dog", "Its really good", "Beautiful") > sapply(strsplit(C, " "), length) [1] 2 3 1 Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Markus Gesmann [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 09, 2008 9:00 PM To: Shubha Vishwanath Karanth; [EMAIL PROTECTED] Subject: RE: [R] Number of words in a string Would this: sapply(strsplit(C, " "), length) work for? Markus Gesmann │Associate Director│Libero Ventures Ltd, One Broadgate, London EC2M 2QS tel: +44 (0)207 826 9080│ dir: +44 (0)207 826 9085│fax: +44 (0)207 826 9090 │www.libero.uk.com A Lehman Brothers Company AUTHORISED AND REGULATED BY THE FINANCIAL SERVICES AUTHORITY -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: 09 April 2008 16:21 To: [EMAIL PROTECTED] Subject: [R] Number of words in a string Hi R, A quick question: How do we find the number of words in a string? Example: C="Have a nice day" And the number of words should be 4. any built in function or?... Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} This message is intended for the personal and confidential use for the designated recipient(s) named above. If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited. This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction or as an official statement of Libero Ventures Ltd. Email transmissions cannot be guaranteed to be secure or error-free. Therefore we do not represent that this information is complete or accurate and it should not be relied upon as such. All information is subject to change without notice. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. Any views or opinions presented are solely those of the author and do not necessarily represent those of Amba Holdings Inc., and/or its affiliates. Important additional terms relating to this email can be obtained at http://www.ambaresearch.com/disclaimer __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Number of words in a string
To put in more general, C=c("My Dog", "Its really good", "Beautiful") And the resultant output should be [1] 2 3 1 ...the number of words Thank you... Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Wednesday, April 09, 2008 8:51 PM To: [EMAIL PROTECTED] Subject: [R] Number of words in a string Hi R, A quick question: How do we find the number of words in a string? Example: C="Have a nice day" And the number of words should be 4. any built in function or?... Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Number of words in a string
Hi R, A quick question: How do we find the number of words in a string? Example: C="Have a nice day" And the number of words should be 4. any built in function or?... Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Mode Vs Class
Hi R, Just came across the 'mode' of an object. What is the basic difference between ?class and ?mode...For example: d=data.frame(a=c(1,2),b=c(5,6)) class(d) [1] "data.frame" mode(d) [1] "list" But, c=c(2,3,5,6,7) class(c) [1] "numeric" mode(c) [1] "numeric" Could anyone help me out... Thanks, shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Dimensions of a List
Thanks a lot for your reply...Exactly...I need the same...But can I store these numbers and hence can access further? In other words how do I extract the numbers/dimensions from this class? Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: jim holtman [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 9:21 PM To: Shubha Vishwanath Karanth Cc: [EMAIL PROTECTED] Subject: Re: [R] Dimensions of a List Is this what you want? > l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66))) > str(l) List of 2 $ :List of 3 ..$ : num [1:2] 1 2 ..$ : num [1:2] 4 5 ..$ : num [1:2] 6 7 $ :List of 2 ..$ : num [1:3] 11 22 33 ..$ : num [1:3] 44 55 66 > On 3/25/08, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: > Hi R, > > > > I have a list, > > > > l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66))) > > > > > l > > [[1]] > > [[1]][[1]] > > [1] 1 2 > > > > [[1]][[2]] > > [1] 4 5 > > > > [[1]][[3]] > > [1] 6 7 > > > > > > [[2]] > > [[2]][[1]] > > [1] 11 22 33 > > > > [[2]][[2]] > > [1] 44 55 66 > > > > > > How do I know the dimensions of this list?... In other words, how many > sub-lists, sub-sub-lists etc...are there in l? How do I know this? > > > > Thanks in advance > > Shubha > > This e-mail may contain confidential and/or privileged i...{{dropped:13}} > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Dimensions of a List
Hi R, I have a list, l=list(list(c(1,2),c(4,5),c(6,7)),list(c(11,22,33),c(44,55,66))) > l [[1]] [[1]][[1]] [1] 1 2 [[1]][[2]] [1] 4 5 [[1]][[3]] [1] 6 7 [[2]] [[2]][[1]] [1] 11 22 33 [[2]][[2]] [1] 44 55 66 How do I know the dimensions of this list?... In other words, how many sub-lists, sub-sub-lists etc...are there in l? How do I know this? Thanks in advance Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] extracting p-value from an lrm object
Hi, How can I extract p-values from an 'lrm' (logistic regression model) oject? Thank you, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] RMysql question
R users, I have a problem in RMysql. The error I get is: > library(RMySQL) > library(RMySQL) >options(expressions=1) > MySQL(max.con = 16, fetch.default.rec = 500, force.reload = FALSE) Error: protect(): protection stack overflow I have no idea of why the error is. Can anyone help on this? Many Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Transposing by a group variable
Hi R, Can I transpose a data frame by a particular group variable? For example: d=data.frame(group=c(1,1,2,2,2),val=c(6,4,6,3,5)) And my output should be: data.frame(group=c(1,2),v1=c(6,6),v2=c(4,3),v3=c(NA,5)) Many thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] .fortran code
Hi Ravi, ...In the same fashion, I was trying to look at wilder.f of 'wilderSum' command of the TTR package. I even googled for the keyword, "wilder.f wilderSum" or " subroutine wilder", but did not find anything useful. Also I did not get when you said " So,you can look at these files if you had installed the source code". Where to look at these files(without going to google)...is there anything which I need to install more? BR, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Ravi Varadhan [mailto:[EMAIL PROTECTED] Sent: Thursday, February 07, 2008 8:56 PM To: Shubha Vishwanath Karanth; [EMAIL PROTECTED] Subject: RE: [R] .fortran code If you look at the source code for eigen() you will notice that the .Fortran calls a subroutine named either "rs.f" or "rg.f" depending on whether your matrix is real and symmetric or real and asymmetric, respectively. So, you can look at these files if you had installed the source code. Even if you had not installed the full source, you can google using keywrods "rs.f eigenvalue" or "rg.f eigenvalue" to see the Fortran code for these functions available from EISPACK. However, I am not sure how illuminating that would be since rs.f and rg.f are just calling routines that each calls a number of other subroutines. So, unless you are willing to spend a great deal of time, you may not be any wiser at the end of all this. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shubha Vishwanath Karanth Sent: Thursday, February 07, 2008 9:42 AM To: [EMAIL PROTECTED] Subject: [R] .fortran code Hi, I need to look/understand what the ".fortran()" doing in say, the source code of the "eigen" command. How do I look into this? Thanks, Shubha This e-mail may contain confidential and/or privileged i...{{dropped:13}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This e-mail may contain confidential and/or privileged i...{{dropped:10}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.