Re: [R] stringr::str_split_fixed query

2015-01-15 Thread Bernhard Pröll
Dear David, str_split_fixed calls str_locate_all, which gives str_locate_all(ab, ) ## [[1]] ## start end ## [1,] 1 0 ## [2,] 2 1 ## in your example, since is a character of length 1. substring() is probably more intuitive to get your expected result: substring(ab, 1:2, 1:2)

Re: [R] Approximation of a function from R^2 to R

2015-01-15 Thread rala
Thanks for the reply. I have datapoints. What I actually want to do is to estimate a joint density function. I used npudens() to estimate the kernel density of two vectors and got the densities at the evaluation points. Now I want an approximation for this so I can have an estimate for different

Re: [R] R 3.1.2 mle2() function on Windows 7 Error and multiple solutions

2015-01-15 Thread Ravi Varadhan
Hi, I tried your problem with optimx package. I found a better solution than that found by mle2. ?library(optimx) # the objective function needs to be re-written LL2 - function(par,y) { lambda - par[1] alpha - par[2] beta - par[3] R = Nweibull(y,lambda,alpha,beta) -sum(log(R)) }

Re: [R] stringr::str_split_fixed query

2015-01-15 Thread Hadley Wickham
FWIW this is fixed in the dev version of stringr which uses stringi under the hood: stringr::str_split_fixed('ab','',2) [,1] [,2] [1,] a b stringr::str_split_fixed('ab','',3) [,1] [,2] [,3] [1,] a b Hadley On Wed, Jan 14, 2015 at 12:47 PM, David Barron dnbar...@gmail.com wrote:

Re: [R] R 3.1.2 mle2() function on Windows 7 Error and multiple solutions

2015-01-15 Thread Ravi Varadhan
A more important point that want to make is that I find few people taking advantage of the comparative evaluation or benchmarking ability of optimx. There is no uniformly best optimizer for all problems. Different ones turn out to perform better for different problems and it is quite

Re: [R] passing elements of named vector / named list to function

2015-01-15 Thread Jeff Newmiller
It x is a list... do.call(fun,x) You should keep external data input away from this code construct to avoid intentional or unintentional misuse of your fun. If your toy example were your actual usage I would suggest the collapse argument of paste.

[R] Mlogit: Error in model.frame.default/ Error in solve.default

2015-01-15 Thread Lee van Cleef
Dear R users, 1) My problem in short: Mlogit cannot calculate certain conditional models. 2) My database: The target was a logistical regression analysis and a probability function which should include generic coefficients and alternative-specific ones. The database was a survey, the

[R] How to get items for both LHS and RHS for only specific columns in arules?‏

2015-01-15 Thread Kim C.
Hi all, I have a question about the arules package in R. I hope the example tables are readable in your email, otherwise you can view it in the question.txt in the attachment.Within the apriori function in the arules package, I want the outcome to only contain these two variables in the LHS

Re: [R] sparse matrix from vector outer product

2015-01-15 Thread Philipp A.
thanks, that sounds good! Martin Maechler maech...@stat.math.ethz.ch schrieb am Thu Jan 15 2015 at 09:07:04: Philipp A flying-sh...@web.de on Wed, 14 Jan 2015 14:02:40 + writes: Hi, creating a matrix from two vectors a, b by multiplying each combination can be

[R] Iteratively subsetting data by factor level across multiple variables

2015-01-15 Thread Reid Bryant
Hi R experts! I would like to have a scripted solution that will iteratively subset data across many variables per factor level of each variable. To illustrate, if I create a dataframe (df) by: variation - c(A,B,C,D) element1 - as.factor(c(0,1,0,1)) element2 - as.factor(c(0,0,1,1)) response -

[R] Latest version of Rtools is incompatible with latest version of R !!

2015-01-15 Thread PRAMEET LAHIRI
 I have installed R version 3.1.2.  I tried to install RTools32.exe which is the latest version (using this link -  http://cran.r-project.org/bin/windows/Rtools/) ! However on using the function find_rtools() an error message was displayed which said --- Rtools is required to build R packages,

Re: [R] Iteratively subsetting data by factor level across multiple variables

2015-01-15 Thread William Dunlap
There are lots of ways to do this. You have to decide on how you want to organize the results. Here are two ways that use only core R packages. Many people like the plyr package for this split-data/analyze-parts/combine-results sort of thing. df - data.frame(x=1:27,response=log2(1:27),

Re: [R] Psych package: why am I receiving NA for many of the factor scores?

2015-01-15 Thread William Revelle
Dear Elizabeth, A correction to my suggestion: scaled - scale(mydata) wts - f4$weights scores -t( apply(scaled,1,function(x) colSums(x*wts,na.rm=TRUE))) #you need the colSums not the sum function Also, your confusion in getting the NAs with missing data was due to a bug in the fa function

[R] Problem with latex when checking a package

2015-01-15 Thread Leandro Roser
Hello everyone. I'm checking a package in Windows 8.1, and when the program starts to create the PDF manual, exits with status 1, printing the following message: # End(Not run) Sorry, but I'm not programmed to handle this case; I'll just pretend that you didn't ask for it. ! You can't use

Re: [R] Problem with latex when checking a package

2015-01-15 Thread Richard M. Heiberger
You didn't show your code, so this is a guess. My guess is that the \dontrun{} is outside the \examples{} section. It must be inside the \examples{} section. This is right \examples{ abc - 123 \dontrun{ def - 456 } ghi - 789 } This is my guess as to what you did. \examples{ abc - 123 ghi - 789

Re: [R] Problem with latex when checking a package

2015-01-15 Thread Leandro Roser
Hi, Richard. I was putting some piece of code in a wrong section (description). After correcting that, I have no more errors. Many tanks for your help, Leandro. 2015-01-16 1:59 GMT-03:00 Richard M. Heiberger r...@temple.edu: You didn't show your code, so this is a guess. My guess is that

Re: [R] Help installing packages with dependencies for R, behind

2015-01-15 Thread jose.nunez-zuleta
Hello all, Sorry about the first post, I forgot to mention that I am using R on Linux. As Brian suggested I looked closely into the R help and tried the verbose option ( install.packages(ggplot2, verbose = 'true')) but it wasn't very helpful. But after checking 'help(download.file)' I found

Re: [R] Latest version of Rtools is incompatible with latest version of R !!

2015-01-15 Thread Henrik Bengtsson
On Thu, Jan 15, 2015 at 9:27 AM, PRAMEET LAHIRI prameet_lah...@yahoo.co.in wrote: I have installed R version 3.1.2. I tried to install RTools32.exe which is the latest version (using this link - http://cran.r-project.org/bin/windows/Rtools/) ! However on using the function find_rtools()

Re: [R] How to speed up the simulation when processing time and date

2015-01-15 Thread MacQueen, Don
I don't have time to look at your example in detail, but there are couple of things that caught my eye. Use as.POSIXct() instead of as.POSIXlt() I don't see anything that requires POSIXlt, and POSIXct is simpler. If everything in Total_Zone1 is numeric, then leave it as a matrix, do not

[R] Interactive Decion Trees in R

2015-01-15 Thread balakrishna
How can we have the Interactive Decision in R, I want a variable which is of Business importance to be injected in the Tree (Rpart specifically). R tree is not picking up the variable, we have this functionality in SAS and Statistica where we can force a variable to be injected in a branch and

Re: [R] two-sample KS test: data becomes significantly different after normalization

2015-01-15 Thread Monnand
Thank you, Chris and Martin! On Wed Jan 14 2015 at 7:31:12 AM Andrews, Chris chri...@med.umich.edu wrote: Your definition of p-value is not correct. See, for example, http://en.wikipedia.org/wiki/P-value#Misunderstandings -Original Message- From: Monnand [mailto:monn...@gmail.com]

Re: [R] sparse matrix from vector outer product

2015-01-15 Thread Martin Maechler
Philipp A flying-sh...@web.de on Wed, 14 Jan 2015 14:02:40 + writes: Hi, creating a matrix from two vectors a, b by multiplying each combination can be done e.g. via a %*% t(b) or via outer(a, b) # default for third argument is '*' really the best

Re: [R] using poly() to predict

2015-01-15 Thread Stanislav Aggerwal
Thanks Prof Ripley. For anybody else wondering about this, see: http://stackoverflow.com/questions/26728289/extracting-orthogonal-polynomial-coefficients-from-rs-poly-function = The polynomials are defined recursively using the alpha and norm2 coefficients of the poly

Re: [R] RStudio connection to server: Safari cannot open page because it could not connect to the server

2015-01-15 Thread Ista Zahn
Hi John, This isn't a question about R, and so is off-topic here. Try a web search for home server port forwarding or similar. Best, Ista On Jan 15, 2015 7:30 AM, John Sorkin jsor...@grecc.umaryland.edu wrote: I set up Rstudio, and can access it from within my lan using

[R] RStudio connection to server: Safari cannot open page because it could not connect to the server

2015-01-15 Thread John Sorkin
I set up Rstudio, and can access it from within my lan using http:/192.168.108:8787. I looked up my external IP address using one of the websites that returns an ip addresses and tried to connect from outside my LAN using http://73.213.144.65:8787 and received a message: Safari cannot open the

[R] Probit regression with misclassified binary dependent variable

2015-01-15 Thread Jack
Is there a generalized linear mixed-effects model implementation for R that could handle misclassified binary data? Unless I have overlooked something in the documentation, glmer with family=binomial(link=probit) does not handle misclassification. Closest to what I have found was misclass, which

[R] How to speed up the simulation when processing time and date

2015-01-15 Thread Faranak Golestaneh
Dear Friends, I am trying to program a forecasting method in R. The predictors are weather variables in addition to lag measured Power values. The accuracy of data is one minute and their corresponding time and date are available. To add lag values of power to the predictors list, I am aiming

[R] HOW TO DOWNLOAD INTRADAY DATA AT ONE TIME

2015-01-15 Thread Amatoallah Ouchen
Is there any way VIA R to download all available intraday data for stocks at once (for example, all the data available at the Indian stock exchange)? I need to make a comparative analysis and downloading the data by ticker is too time consuming, besides I want to know if there is any website that

[R] passing elements of named vector / named list to function

2015-01-15 Thread Rainer M Krug
Hi Following scenario: I have a function fun --8---cut here---start-8--- fun - function(A, B, C, ...){paste(A, B, C, ...)} --8---cut here---end---8--- and x defined as follow --8---cut

Re: [R] R 3.1.2 mle2() function on Windows 7 Error and multiple solutions

2015-01-15 Thread Ben Bolker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 For what it's worth, you can use either nlminb (directly) or optimx within the mle2 wrapper by specifying the 'optimizer' parameter ... this gives you flexibility in optimization along with the convenience of mle2 (likelihood ratio tests via