similar to: Help with ordering values

Displaying 20 results from an estimated 40000 matches similar to: "Help with ordering values"

2013 Oct 12
2
Order of factors with facets in ggplot2
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 each factor `f2', where the boxplots are ordered based on the average of x
2010 Dec 31
4
Sweave for "big" data analysis
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 these situations. I would just run the function once,
2009 Mar 17
3
Non-Linear Optimization - Query
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 results after running the program for 5 hrs. Is it normal to run this type of programs for hours? Also,
2010 Feb 24
4
R Graphics into Latex‏
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} \begin{document} blah..blah…blah \begin{figure} \centering
2011 Jul 30
3
Problem with effects package
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 apply(mod.matrix[, components], 1, prod) : subscript out of bounds Error in
2011 May 21
3
Simple R Question...
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 data frame). My attempt is #4 but doesn't work. dd <- data.frame(a =
2017 Sep 09
0
Avoid duplication in dplyr::summarise
Hi Lars I am not very sure what you really want. However, I am suggesting the following code that enables (1) to obtain the full summary of your data and (2) retrieve only mean of X values as function of factors f1 and f2. library(tidyverse) library(psych) df <- data.frame(matrix(rnorm(40), 10, 4), f1 = gl(3, 10, labels = letters[1:3]), f2 = gl(3, 10, labels
2011 Jul 16
2
(unclassified?) Help Question
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 factor g. Of course I'm looking for a generic solution (i.e, not something that just work
2017 Sep 09
1
Avoid duplication in dplyr::summarise
Hi Lars, Two comments: 1. You can achieve what you want with a slight modification of your definition of s(), using the hint from the error message that you need an argument '.': s <- function(.) { dplyr::summarise(., x1m = mean(X1), x2m = mean(X2), x3m = mean(X3), x4m = mean(X4)) } 2. You have not given a great test case in
2010 Aug 12
2
R 64-bit and Revolution
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. Regards, Lars. [[alternative HTML version deleted]]
2017 Sep 09
2
Avoid duplication in dplyr::summarise
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 <- data.frame(matrix(rnorm(40), 10, 4), f1 = gl(3, 10, labels = letters[1:3]), f2 =
2011 Apr 26
7
Second largest element from each matrix row
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 <- sapply(1:length(sec.large), function(i) a[i, sec.large[i]]) ans Thanks in advance for your
2011 May 20
1
Contrasts in Penalized Package
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 the function with a formula. I typed "library(penalized) ;
2010 Aug 03
1
Penalized Gamma GLM
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]]
2017 Sep 16
1
Help with shiny::reactiveFileReader()
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 <- reactiveFileReader(1000, NULL, 'data.csv', read.csv) fit <- lm(y ~., data = bigData()) ui
2011 Apr 05
1
Help in splitting a list
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 results shown in mylist2 for an arbitrary number of matrices in mylist?
2009 Jul 03
2
Error using the Rdonlp2‏ Package
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 parameters (par.u and par.l). When I run the code, I get the error message shown below. Any idea
2009 Mar 13
1
Help with Function!
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 <-(1+x1)*(1+x2)*(1+x3)*(1+xm) if row n is equal to [0 1 0 1 1 0 ..... 0] then
2009 Sep 26
2
Design Package - Penalized Logistic Reg. - Query
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 internally in lrm or I would have to do it prior to applying this function. Also, as I'm new in R (coming
2009 Sep 03
1
Help with GLM please!
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 ordered factor as shown below, but in the summary results of the logistic regression I