similar to: function in aggregate applied to specific columns only

Displaying 20 results from an estimated 3000 matches similar to: "function in aggregate applied to specific columns only"

2010 Jan 30
2
aggregate by factor
I have a data frame with two columns, a factor and a numeric. I want to create data frame with the factor, its frequency and the median of the numeric column > head(motifList) events score 1 aeijm -0.25000000 2 begjm -0.25000000 3 afgjm -0.25000000 4 afhjm -0.25000000 5 aeijm -0.25000000 6 aehjm 0.08333333 To get the frequency table of events: > motifTable <-
2009 Apr 04
2
data.frame, converting row data to columns
I have a data frame something like: name wrist nLevel emot 1 4094 3.34 1 frustrated 2 4094 3.94 1 frustrated 3 4094 NA 1 frustrated 4 4094 3.51
2010 Aug 09
2
efficient matrix element comparison
It is a simple problem in that I simply want to convert the For loop to a more efficient method. It simply loops through a large vector checking if the numeric element is not equal to the index of that element. The following example demonstrates a simplified example: > rows <- 10 > collusionM <- Matrix(0,10,10,sparse=TRUE) > matchM <- matrix(c(1,2,3,4,4,6,7,9,9,10)) > >
2010 Jun 15
4
shifted window of string
basically I need to create a sliding window in a string. a way to explain this is: > v <-
2010 Mar 06
1
color2D.matplot not giving colors
I am using color2D.matplot to plot a matrix about 400 by 200. The values in the matrix are 0:5 and NA. The resulting plot is not color, but shaded b/w. I tried to figure out how to add colors, I would like something like c(blue, green, red, cyan, green) #example motifx <- matrix(NA, nrow=100,ncol=20) motifx[,1:5] <- 1 motifx[,6:10] <- 2 motifx[,11:15] <- 3 motifx[,15:19] <- 4
2010 Jul 13
2
Checking for duplicate rows in data frame efficiently
I wrote something to check for duplicate rows in a data frame, but it is too inefficient. Is there a way to do this without the nested loops? This code correctly indicates rows 1-7, 1-8, 2-9 and 7-8 are duplicates. > m <- matrix(c(1,1,1,1,1, 2,2,2,2,2, 6,6,6,6,6, 3,3,3,3,3, 4,4,4,4,4, 5,5,5,5,5, 1,1,1,1,1, 1,1,1,1,1, 2,2,2,2,2, 7,7,7,7,7), ncol=5, byrow=TRUE) > df <- data.frame(m)
2009 Feb 12
3
Strange dialplan matching issue
Greetings list, Wondering if anyone has come across this strange dialplan pattern matching issue before: I have a context defined as follows (the plus simply implies it follows on from an existing context in another #include - which, yes, has been included first): [privatedundi](+) exten => _hilton-2XX,1,Goto(hilton,${EXTEN:7},1) When dialling hilton-202 from another box via IAX2, I get:
2011 May 11
3
ddply with mean and max...
I'm trying to use ddply to compute summary statistics for many variables splitting on the variable site. however, it seems to work fine for mean() but if i use max() or min() things fall apart. whats going on? test.set<-data.frame(site=1:10,x=.Random.seed[1:100],y=rnorm(100)) means<-ddply(test.set,.(site),mean) means site x y 1 1 -97459496 -0.14826303 2
2006 May 24
6
newbie question: missing template
Hi I''m new to this forum and new to Rails so excuse me if this is a daft question. I''m following the ONLamp.com tuturial and all has been well untill changing the template for the recipes. I have followed the instructions and added this code to the controller: class RecipeController < ApplicationController scaffold :recipe def list @recipes = Recipe.find_all end
2011 Mar 03
2
lattice custom axis function -- right side margins
Dear R help list, I have a plot with two different vertical scales that I want to display on either side of the plot. It's quite similar to the Fahrenheit-Centigrade example in the examples section of the documentation for axis.default. The right-side axis is clipped off, though, and I haven't been able to figure out anything with viewport() and clipping or trellis.par.set to fix
2010 Apr 21
2
Sparseby Problems
I've got a problem with the sparseby command (reshape library), and I have reached the peak of my R knowledge (it isn't really that high). I have a small data frame of 23 rows and 15 columns, here is a subset, the first four columns are factors and the rest are numeric (only one, line54 is provided). bearID YEAR Season SEX line54 5 1900 8 3 0 16.3923519 11 2270
2009 Feb 18
2
[package-car:Anova] extracting residuals from Anova for Type II/III Repeated Measures ?
Hello dear R members. I have been learning the Anova syntax in order to perform an SS type III Anova with repeated measures designs (thank you Prof. John Fox!) And another question came up: where/what are the (between/within) residuals for my model? ############ Play code: phase <- factor(rep(c("pretest", "posttest", "followup"), c(5, 5, 5)),
2007 Jul 26
1
Lohan the observable
Sorry, that name is a misnomer. However, I was excited to find that Ruby has a built in Observable module and I''m pretty bored, so I apologize in advance.... require ''observer'' # one who is observed class Celebrity include Observable attr_accessor :name attr_reader :is def is=(val) @is = val changed notify_observers(self) end end # one who
2013 Mar 26
2
Controlling an APC 9210 with nut
I have an APC 9210 PDU in my rack. It's connected to the network and is configurable by web access. I'd like to control it in combination with my ups. Unfortunately I cannot get NUT to recognise this PDU. Here's my ups.conf section: [apc] driver = snmp-ups port = 192.168.10.21 mibs = auto community = public snmp_version = v1 running upsdrvctl gives this: $ sudo
2008 Mar 17
1
Std errors in glm models w/ and w/o intercept
I am doing a reanalysis of results that have previously been published. My hope was to demonstrate the value of adoption of more modern regression methods in preference to the traditional approach of univariate stratification. I have encountered a puzzle regarding differences between I thought would be two equivalent analyses. Using a single factor, I compare poisson models with and without
2011 Oct 12
3
Applying function to only numeric variable (plyr package?)
My data frame consists of character variables, factors, and proportions, something like c1 <- c("A", "B", "C", "C") c2 <- factor(c(1, 1, 2, 2), labels = c("Y","N")) x <- c(0.5234, 0.6919, 0.2307, 0.1160) y <- c(0.9251, 0.7616, 0.3624, 0.4462) df <- data.frame(c1, c2, x, y) pct <- function(x) round(100*x, 1) I want to
2005 Jul 07
1
Queues and busy agents problem
Hi I have a problem with the queues on Asterisk. The setup is Asterisk@Home v1.0 with Asterisk 1.0.7. I have 1 queue (4500) set up, with leastrecent strategy. There are no agents configured in this queue. Agents log in by dialing 4500* on their phones. All incoming calls are sent to the queue. Calls wait 120 seconds in the queue, and are then sent to voicemail extension 310. My problem is
2019 Sep 13
6
Is the smbldap-tools package no longer maintained?
I've been trying to find news on the smbldap-tools package from IDEALX but my google searches have been fruitless. In my FreeBSD port build run yesterday I noticed that the port is listed as *broken* because the download link no longer works. Is there a new home for this code or has it lost it's maintainer? *Note* I was able to build against a cached download but if the (download)
2005 Jun 30
5
Logrotate
I created some scripts to logrotate. I am having a problem. After I do it, I am sending kill -HUP to the process its not using the newly created messages file again. Could someone help me out with how I can rotate asterisk's log's without killing the process? ..o-------------------------------------------------------o. Brian Fertig NOC/Network Engineer Planet Telecom, Inc. Tampa, FL
2008 Dec 16
3
Check if data frame column is numeric
Hi R-users, I want to apply a function to each column of a data frame that is numeric. Thus I tried to check it for each column first: > apply(df, 2, function(x) is.numeric(x)) A60 A64 A66a A67 A71 A75a A80 A85 A91 A95 A96 A97 A98 A99 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE