[R] Help with shiny::reactiveFileReader()

2017-09-16 Thread Lars Bishop
Hello, Is it possible to execute functions (outside the ui and server shiny environments) after reading data using reactiveFileReader() ? For example, I'd like to fit a linear model on data read using reactiveFileReader() outside ui/server. library(shiny) library(dplyr) bigData <-

Re: [R] Avoid duplication in dplyr::summarise

2017-09-09 Thread Lars Bishop
2,X_name)%>% >> do(describe(.$X_value)) >> >> ##To obtain only means of your data >> df%>% gather(X_name,X_value,X1:X4)%>% >> group_by(f1,f2,X_name)%>% >> do(describe(.$X_value))%>% >> select(mean)%>%# You select only mean value >&g

[R] Avoid duplication in dplyr::summarise

2017-09-09 Thread Lars Bishop
Dear group, Is there a way I could avoid the sort of duplication illustrated below? i.e., I have the same dplyr::summarise function on different group_by arguments. So I'd like to create a single summarise function that could be applied to both. My attempt below fails. df <-

[R] R Server - Resource Manager

2016-08-09 Thread Lars Bishop
Hi All, I'd appreciate if you can point me to any good open source (and free) Resource Manager for R installed on a unix server. Essentially, I'm looking to have the ability to selectively allocate computational resources to individuals or groups who have access to this server. I understand R

Re: [R] Help please with error from nnet::multinom

2016-06-26 Thread Lars Bishop
NAs are not allowed in subscripted assignments In addition: Warning message: 'newdata' had 200 rows but variables found have 300 rows On Sun, Jun 26, 2016 at 3:46 PM, David Winsemius <dwin

Re: [R] Help please with error from nnet::multinom

2016-06-26 Thread Lars Bishop
net> wrote: > > > On Jun 26, 2016, at 11:32 AM, Lars Bishop <lars...@gmail.com> wrote: > > > > Thanks Bert. > > > > But I it doesn't complain when predict is used on X instead of X_new > > (using nnet_7.3-12), which is even more puzzling to me: > &g

Re: [R] Help please with error from nnet::multinom

2016-06-26 Thread Lars Bishop
r predict.nnet, at > least in my version: nnet_7.3-12 > > Cheers, > Bert > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County"

[R] Help please with error from nnet::multinom

2016-06-26 Thread Lars Bishop
Hello, I'd appreciate your help in spotting the reason for the error and warning messages below. library(nnet) set.seed(1) ysim <- gl(3, 100) y <- model.matrix(~ysim -1) X <- matrix( 3 * runif(length(ysim)), nrow = 300, ncol = 3) X_new <- matrix( 3 * runif(length(ysim)), nrow = 200, ncol = 3)

Re: [R] Issue installing packages - Linux

2016-05-02 Thread Lars Bishop
age. Perhaps > there is a problem with R trying to read a different character set > from that used in the package. > > Jim > > On Sat, Apr 30, 2016 at 8:22 PM, Lars Bishop <lars...@gmail.com > <javascript:;>> wrote: > > Hello, > > > > I can’t seem to be a

[R] Issue installing packages - Linux

2016-04-30 Thread Lars Bishop
Hello, I can’t seem to be able to install packages on a redhat-linux-gnu. For instance, this is what happens when I try to install “bitops”. Any hint on what might be the issue would be much appreciated. > sessionInfo() R version 3.2.3 (2015-12-10) Platform: x86_64-redhat-linux-gnu (64-bit)

[R] Interactive ggvis plot - question

2016-04-24 Thread Lars Bishop
Hello, I'm trying to plot a histogram (or alternatively the density) of a variable, with a slider that displays a vertical line with the corresponding quantile of the distribution of the variable. That is, I what to interactivity pick for example, the median, and have the vertical line move to

Re: [R] Annoying startup error message

2016-02-26 Thread Lars Bishop
ad any of the profile files. > > https://stat.ethz.ch/R-manual/R-devel/library/base/html/Startup.html > > Sarah > > On Fri, Feb 26, 2016 at 12:01 PM, Lars Bishop <lars...@gmail.com> wrote: > > Thank you Ulrik. I actually don't want to install SparkR, just don't want >

Re: [R] Annoying startup error message

2016-02-26 Thread Lars Bishop
vel/library/base/html/Startup.html >> > > Another possibility is that SparkR defines some S4 classes, and you have > an object of that type in your workspace. To read it might need SparkR > installed. > > The solution here is to run R --vanilla as above, or to delete the obje

Re: [R] Annoying startup error message

2016-02-26 Thread Lars Bishop
pkg and I haven't > tried it myself. > > Hope this helps, > Ulrik > > On Fri, 26 Feb 2016 at 17:40 Lars Bishop <lars...@gmail.com> wrote: > >> Hello, >> >> Just installed R version 3.2.3, and I'm getting the error message below >> every time I start

[R] Annoying startup error message

2016-02-26 Thread Lars Bishop
Hello, Just installed R version 3.2.3, and I'm getting the error message below every time I start R. I had SparkR installed in the prior version. I googled this problem, but didn;t find anything useful. Any help would be very appreciated. Error in library(SparkR) : there is no package called

Re: [R] Order of formula terms in model.matrix

2016-01-17 Thread Lars Bishop
e first matrix (where the first level of “f1” is omitted in the resulting matrix). This would’t happen if the user specifies the terms in reverse order (as per the second matrix). Thanks again, Lars. > On Jan 17, 2016, at 2:53 PM, Lars Bishop <lars...@gmail.com> wrote: > >

Re: [R] Order of formula terms in model.matrix

2016-01-17 Thread Lars Bishop
This is very helpful, thanks! Lars. > On Jan 17, 2016, at 1:34 PM, Charles C. Berry <ccbe...@ucsd.edu> wrote: > > On Sun, 17 Jan 2016, Lars Bishop wrote: > >> I’d appreciate your help on understanding the following. > >> It is not very clear to me from th

[R] Order of formula terms in model.matrix

2016-01-17 Thread Lars Bishop
I’d appreciate your help on understanding the following. It is not very clear to me from the model.matrix documentation, why simply changing the order of terms in the formula may change the number of resulting columns. Please note I’m purposely not including main effects in the model formula

[R] Median expected survival

2014-07-10 Thread Lars Bishop
Hi All, Apologies for the simple question, but I could not find a straightforward answer based on my limited knowledge of survival analysis. I’m trying to obtain the predicted median survival time for each subject on a new dataset from a fitted coxph{survival} or cph{rms} object. Would the

[R] Math symbols in ggplot facets

2014-02-22 Thread Lars Bishop
Hello, I would like to show in my facet labels the equivalent in LaTex of $\sigma_{0}= \sqrt{2}$. I think I'm close below, but not yet as it shows $(\sigma_{0}, \sqrt{2})$ m - mpg levels(m$drv) - c(sigma[0]=sqrt(2), sigma[0]=2 * sqrt(2), sigma[0]= 3 * sqrt(2)) ggplot(m, aes(x = displ, y = cty))

[R] Help with {tables} package

2014-01-02 Thread Lars Bishop
Dear list, I'm most likely doing something wrong, but I'm getting an error message in tab2 below (tab1 is fine). Any hint is much appreciated. library(tables) set.seed(1) dd - data.frame(x = rnorm(100), f1 = gl(2, 50, labels = c(A, B)), f2 = gl(4, 25, labels = c(a, b, c, d)),

[R] Order of factors with facets in ggplot2

2013-10-12 Thread Lars Bishop
Hello, I'd like to produce a ggplot where the order of factors within facets is based on the average of another variable. Here's a reproducible example. My problem is that the factors are ordered similarly in both facets. I would like to have, within each facet of `f1', boxplots for 'x' within

[R] Permutation tests in {coin}

2013-10-05 Thread Lars Bishop
Hello, I'm trying to get familiar with the coin package for doing permutation tests. I'm not sure I understand the documentation regarding the difference between distribution = asymptotic and approximate in the function independence_test. Are permutations of the test statistic actually computed

[R] Help with ordering values

2012-05-19 Thread Lars Bishop
Hi, Is it possible to use x and y below to produce the vector shown in desired.result (which represents the values in y ordered according to the order specified by x)? Ideally the solution must be efficient in terms of timing as I'm dealing with *very* long vectors. x - c(7, 6, 5, 9, 4, 14, 8,

[R] Issue with xxx-package.Rd

2012-04-15 Thread Lars Bishop
Dear list, I have an issue with placing the information stored in the file mypackage-package.Rd file (as created by promptPackage(mypackage)) in the package manual pdf file. The information on that .Rd file is not placed in the head of the manual as I would expect. I think a possible reason is

[R] Problem with effects package

2011-07-30 Thread Lars Bishop
Dear List, Several times I use this package I get the error message shown below. When I work out simple examples, it turns out to be fine, but when working with real and moderate size data sets I always get the same error. Do you know what could be the cause of the problem? Error in

Re: [R] Problem with effects package

2011-07-30 Thread Lars Bishop
commented, minimal, self-contained, reproducible code. We can not help unless we at least have the data that you are using. On Sat, Jul 30, 2011 at 3:01 PM, Lars Bishop lars...@gmail.com wrote: Dear List, Several times I use this package I get the error message shown below. When I work out simple

Re: [R] Problem with effects package

2011-07-30 Thread Lars Bishop
-help-boun...@r-project.org] On Behalf Of Lars Bishop Sent: July-30-11 4:30 PM To: jim holtman; r-help@r-project.org Subject: Re: [R] Problem with effects package ok. Here's an example: R version 2.11.1 effects_2.0-10 var1 - c(25631.9392, 2521.2590,  6656.6516,  1362.5997,  6369.9818

[R] (unclassified?) Help Question

2011-07-16 Thread Lars Bishop
Dear List, I'd appreciate you guidance for obtaining the desired result shown below, by combining tapply(x, g, mean) and g in the example. Basically, I'm trying to create a vector whose values are based on the result from tapply(x, g, mean) but that follow the pattern and length given by the

[R] Simple R Question...

2011-05-21 Thread Lars Bishop
Let's say I have the data frame 'dd' below. I'd like to select one column from this data frame (say 'a') and keep its name in the resulting data frame. That can be done as in #2. However, what if I want to make my selection based on a vector of names (and again keep those names in the resulting

[R] Contrasts in Penalized Package

2011-05-20 Thread Lars Bishop
Hi, The penalized documentation says that Unordered factors are turned into as many dummy variables as the factor has levels. This is done by a function in the package called contr.none. I'm trying to figure out how exactly is a model matrix created with this contrast option when the user calls

[R] Help with contrasts

2011-05-11 Thread Lars Bishop
Hi, I need to build a function to generate one column for each level of a factor in the model matrix created on an arbitrary formula (instead of using the available contrasts options such as contr.treatment, contr.SAS, etc). My approach to this was first to use the built-in function for

[R] Second largest element from each matrix row

2011-04-26 Thread Lars Bishop
Hi, I need to extract the second largest element from each row of a matrix. Below is my solution, but I think there should be a more efficient way to accomplish the same, or not? set.seed(1) a - matrix(rnorm(9), 3 ,3) sec.large - as.vector(apply(a, 1, order, decreasing=T)[2,]) ans -

Re: [R] Second largest element from each matrix row

2011-04-26 Thread Lars Bishop
, Lars Bishop wrote: Hi, I need to extract the second largest element from each row of a matrix. Below is my solution, but I think there should be a more efficient way to accomplish the same, or not? set.seed(1) a- matrix(rnorm(9), 3 ,3) sec.large- as.vector(apply(a, 1, order

[R] Help in splitting a list

2011-04-05 Thread Lars Bishop
Dear R users, Let's say I have a list with components being 'm' matrices (as exemplified in the mylist object below). Now, I'd like to subset this list based on an index vector, which will partition each matrix 'm' in 2 sub-matrices. My questions are: 1. Is there an elegant way to have the

[R] Help in Compiling R for AIX 5.3 servers

2011-03-22 Thread Lars Bishop
Dear List, I've used R fr a while now, but I'm totally unfamiliar with the compiling process. In particular, I'd like to compile R for AIX 5.3. servers. I'll appreciate your guidance on the best place to get started on this. Thanks in advance, Lars. [[alternative HTML version deleted]]

[R] Problem with RODBC sqlSave

2011-02-26 Thread Lars Bishop
Hi, I'm able to establish a successful odbc connection using RODBC 1.3-2 on Win 7 and R 2.12.0. But I'm getting the following error message when I try to save a data frame into the debase as shown below. library(RODBC) bbdb - odbcConnect(bbdb) odbcGetInfo(bbdb) # returns ok sqlSave(bbdb,

[R] Warning with predict.glm method

2011-01-25 Thread Lars Bishop
Dear list, When I use the predict.glm method on a glm fitted object, I get the following warning message: In addition: Warning message: In predict.lm(object, x) : prediction from a rank-deficient fit may be misleading As the documentation says this happens if the fit is rank-deficient, some

[R] Error Message - effects package

2011-01-20 Thread Lars Bishop
Hi, I'm running R 2.11.1 on Windows 32-bit. I fitted a glm to a large data set with no problems (i.e., nothing is wrong with the created glm object). However, when I try to use the effects package to plot the effects I get the error message shown below. I get the same message if I try to plot a

[R] Sweave for big data analysis

2010-12-31 Thread Lars Bishop
Hi, Maybe I'm missing the point here...but let's suppose you are working with large data sets and using functions that take a significant amount of time to run in R. I woulnd't like to run these functions every time I call Sweave(myfile.Rnw) within R. What is the common practice to use Sweave in

[R] varclus in Hmisc vs SAS PROC VARCLUS

2010-11-07 Thread Lars Bishop
Hi, I'll apreciate your guidance on how can I re-create the output from SAS PROC VARCLUS in R. I've found the varclus function in Hmisc. However, is it possible to use that function to compute for each variable the 1-R**2 ratio (this is the ratio of 1 minus the R-squared with Own Cluster to one

[R] Lasso Logistic Regression - Query

2010-10-20 Thread Lars Bishop
Hi, Is it possible to include class factor inputs in a Logistic Regression model with the glmnet package? It only seems to allow for numeric inputs. Looks like the Penalized package does this? Any other package you would recommend for this purpose? Thanks in advance for any help. Lars.

[R] GAM Predictions (mgvc)

2010-10-16 Thread Lars Bishop
Hi, Is there any way I can see how exactly the prediction equation is constructed in the example below? I'd like to be able to replicate the predictions from the fitted gam object as given by the predict.gam method in the package mgcv. library(mgcv) data(trees) ct1 - gam(Volume ~ s(Height) +

[R] R 64-bit and Revolution

2010-08-12 Thread Lars Bishop
Dear users, The company where I work is considering getting a license for Revolution Enterprise - Windows 64-bit. I'll appreciate for those familiar with the product if can share your experiences with it? In particular, how does it compare to the free version of R 64-bit? Thanks in advance.

[R] Penalized Gamma GLM

2010-08-03 Thread Lars Bishop
Hi, I couldn't find a package to fit a penalized (lasso/ridge) Gamma regression model. Does anybody know any? Thanks in advance, Lars. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] Lattice Wireframe Plot into LaTex

2010-05-22 Thread Lars Bishop
Dear R/LaTex user, I'm simply trying to include a plot created with the Lattice wireframe function into LaTex. I have no problems including other R plots into LaTex by exporting as a Postcript and then including the graph in LaTex using \begin{figure} % Requires \usepackage{graphicx}

[R] Gradient Boosting Trees with correlated predictors in gbm

2010-02-28 Thread Lars Bishop
Dear R users, I’m trying to understand how correlated predictors impact the Relative Importance measure in Stochastic Boosting Trees (J. Friedman). As Friedman described “ …with single decision trees (referring to Brieman’s CART algorithm), the relative importance measure is augmented by a

[R] R Graphics into Latex‏

2010-02-24 Thread Lars Bishop
Hi, I'm new in Latex and I'm trying to include an R chart into a Latex document. This is what I'm doing: 1) In R: save the chart as a a Postcript in a folder C:/xxx/Density.eps 2) In Latex (using TexWorks on windows xp) : In the preambule: \documentclass[11pt]{article} \usepackage{graphicx}

[R] R on Large Data Sets (again)

2009-11-28 Thread Lars Bishop
Dear R users, I’ve search the R site for help on this topic but it is hard to find a precise answer for my questions. Which are the best options to overcome the RAM memory limitation problems when using R on “large” data sets (such as 2 or 3 million records)? - Is the free available

[R] Design Package - Penalized Logistic Reg. - Query

2009-09-25 Thread Lars Bishop
Dear R experts, The lrm function in the Design package can perform penalized (Ridge) logistic regression. It is my understanding that the ridge solutions are not equivalent under scaling of the inputs, so one normally standardizes the inputs. Do you know if input standardization is done

[R] Best Subset Selection - Leaps Package

2009-09-12 Thread Lars Bishop
Dear Experts, I'm a new R user and I'll appreciate your help regarding the following. I'm trying to generate an exhaustive search of all candidate models in a simple linear regression and select the one with the lowest CV-error (or alternatively the lowest Error on a Test set -- if I have lots of

[R] Help with GLM please!

2009-09-03 Thread Lars Bishop
Dear experts, I have a few quick questions related to GLMs: 1) Suppose my response is of the type Yes/No, How can I control which response I'm modelling? 2) How can I perform Type III tests? Is it with - drop1(mymodel, test=Chisq) ? 3) I have a numerical variable which I converted to an

[R] Help with Loop!

2009-07-23 Thread Lars Bishop
Dear experts, I'm new in R and trying to learn by writing a version of the Perceptron Algorithm. How can I tell in the code below to stop the iteration when the condition in the for loop is not satisfied for all training examples? Thanks in advance for your help! ## Generate a linearly

[R] nnet function - help!

2009-07-14 Thread Lars Bishop
Dear experts, I'm new in R. I'd like to know if I need to standarize the input variables prior to using the nnet function or does this function standarizes the variables internally? In the first case, is there a fast way to standarize continuous and categorical inputs? Thanks Lars.

[R] Error using the Rdonlp2‏ Package

2009-07-03 Thread Lars Bishop
Dear experts, I'm attempting to solve a constrained optimization problem using the Rdonlp2 package. I created a Lagrange function (L=f(x)-lambda(g(x)-c)), where x is a vector of 16 parameters. This is what I'm using as objective function in the code below. In addition, I set bounds on these

[R] Package for Clustering - Query

2009-05-28 Thread Lars Bishop
Dear R users, Is there any package for Latent Class Analysis (to be used in a clustering application) which supports mixed indicator variables (categorical and continuous)? Alternatively, is there any other clustering algorithm available that supports this type of data? Thanks in advance for

[R] Neural Networks in R - Query

2009-04-18 Thread Lars Bishop
Dear R users, I'd like to ask your guidance regarding the following two questions: (i) I just finished reading Chris Bishop's book Neural Networks for Pattern Recognition. Although the book gave me good theoretical foundation about NN, I'm now looking for something more practical regarding

[R] Offset Variable in Statistical Models - Query

2009-04-07 Thread Lars Bishop
Hi, I’d appreciate your thoughts regarding the following. I’m working with an insurance data set with the objective of predicting a binary outcome (claim or not). Policyholders in the sample are not observed for equivalent time periods. I have an exposure variable that reflects the amount of

[R] Non-Linear Optimization - Query

2009-03-16 Thread Lars Bishop
Dear All, I couple of weeks ago, I’ve asked for a package recommendation for nonlinear optimization. In my problem I have a fairly complicated non-linear objective function subject to one non-linear equality constrain. I’ve been suggested to use the *Rdonlp2* package, but I did not get any

[R] Help with Function!

2009-03-13 Thread Lars Bishop
Dear All, I need to write 'n' functions on 'm' variables. The functions should be constructed according to the values of an (nxm) matrix of '1/0' values as follows. For example, if row1 is equal to ,say [1 0 ...0 0] then f1 - (1+x1) if row 2 is equal to, say [1 1 1 0...0 1] then f2

[R] Matrices in R - Simple question?

2009-03-10 Thread Lars Bishop
Hi, I'm a new R user and would appreciate your help regarding the following: Can I create a matrix whose elements are n functions of a vector x? In my problem I have 3 vectors (a,b,c) with elements a=[f1(x) f2(x)fn(x)]; b=[g1(x) g2(x)gn(x)]; c=[h1(x) h2(x)hn(x)]. I need to create a

[R] NonLinear Programming in R - QUERY

2009-03-06 Thread Lars Bishop
Hi All, I'll appreciate your help on this. Do you know of any package that can be used to solve optimization problems subject to general *non-linear* equality constraints. Thanks! Lars. [[alternative HTML version deleted]] __

[R] EM for Density Estimation

2009-02-21 Thread Lars Bishop
Hi, Which package would you recommend for an implementation of EM for density estimation (eg. mixture of Gaussian)? Thanks! Lars. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] General query regarding scoring new observations

2009-02-11 Thread Lars Bishop
Hi, I was wondering if I can have some advice on the following problem. Let's say that I have a problem in which I want to predict a binary outcome and I use logistic regression for that purpose. In addition, suppose that my model includes predictors that will not be used in scoring new