similar to: Weighted Average on More than One Variable in Data Frame

Displaying 20 results from an estimated 100 matches similar to: "Weighted Average on More than One Variable in Data Frame"

2008 Jul 25
1
transcript a matlab code in R
Dear R-users, I am trying to translate a matlab code for calculating the Local Whittle estimator in time series with long memory originally written by Shimotsu and available free in his webpage ( http://www.econ.queensu.ca/pub/faculty/shimotsu/ ) The Matlab code is ======================================================================================= function[r] = whittle(d,x,m) % WHITTLE.M
2009 Jul 23
3
Calculate weighted mean for each group
Hi R experts, I need know how calculate a weighted mean by group in a data frame. I have tried with aggragate() function: data.frame(x=c(15,12,3,10,10),g=c(1,1,1,2,2,3,3),w=c(2,3,1,5,5,2,5)) -> d aggregate(d$x,by=list(d$g),weighted.mean,w=d$w) Generating the following error: Error en FUN(X[[1L]], ...) : 'x' and 'w' must have the same length Thanks in advance [[alternative
2005 Jul 15
3
Java
Hi everyone, I'm a newbie to centos and having trouble upgrading java's jdk1.4 to jdk1.5. I assume I have to get the jdk from jpackage, but I'm having trouble locating it, let alone finding any instructions on how to upgrade. Much appreciated if anyone can help. Thanks!
2005 Aug 02
2
rpmbuild question.
I am attempting to build from a src.rpm (knowing very little about rpm at all) and the spec file notes that the architecture should be set on the command line: > # platform defines - set one below or define the build_xxx on the command line Now. My question is this, how does one do this using rpmbuild? The syntax rpmbuild --target centos4 package.src.rpm seemingly has no effect.
2007 Mar 17
5
Fix for crash at exit
Hi This is a very small patch that seems to solve that "Exit the app and get a segfault in return" problem. Another thing: bigdemo.rb:395 does item = event.get_item() if item.is_ok but get_item typemaps TreeItemId into a plain integer, so it doesn''t have is_ok method anymore, is there any wxruby2''yish solution to this kind of problem ? A.K. In case
2012 Apr 20
1
pasting a formula string with double quotes in it
Hello everyone, I have tried several ways of doing this and searched the documentation and help lists and I have been unable to find an answer or even whether it is possible to do it. I am pasting together a formula and I need to insert double quotes around the strings. Here's an example: location <- c("AL", "AK", "MA", "PA") v=2 test <-
2006 Oct 17
1
Trouble syncing Palm via USB
Hi, I'm having trouble getting my Palm to sync with jpilot on my Centos system via USB. When I sync, I get this error in jpilot: pi_accept Illegal seek Exiting with status SYNC_ERROR_PI_ACCEPT Finished I have jpilot syncing fine with this Palm over the network, BTW. For USB, I set things up for udev as described on various websites. Here are the relevant ports & symlink (created
2006 Sep 11
15
ruby method names
Hi Attached is a patch that adds aliases to the API for methods that look like attribute accessors. So a_frame.set_title(''The title'') # currently a_frame.title = ''The title'' # now an alternative textctrl.get_value # currently textctrl.value # now an alternative Also, C++ methods named ''IsXXX'' are now exposed in ruby with
2011 Aug 23
2
Replacing NAs in one variable with values of another variable
Hello everyone, I am trying to figure out a way of replacing missing observations in one of the variables of a data frame by values of another variable. For example, assume my data is X X <-as.data.frame(matrix(c(9, 6, 1, 3, 9, "NA", "NA","NA","NA","NA", 6, 4, 3,"NA", "NA", "NA", 5, 4, 1, 3),
2011 Jun 28
2
How do I output all the R-squares of an SUR? summary(fitSUR$eq[[1:4]])$r.squared does not work
Greetings R Users, I have a system of equations for which I would like to output all the R-squares. Assume there are four equations in my system, the only way I found to output all the R-squares is by calling them out one by one as this: summary(fitSUR$eq[[1]])$r.squared summary(fitSUR$eq[[2]])$r.squared summary(fitSUR$eq[[3]])$r.squared summary(fitSUR$eq[[4]])$r.squared But isn't there a
2007 Sep 10
3
php 5.2
Hi, I was asking about php 5.2 because I would like to use this program with these requirements: http://www.magentocommerce.com/system-requirements This ecommerce store is built with the zend framework and requires php 5.2. Mcrypt is not in the centos mirrors either. I did manage to get this beta ecommerce store installed on php 5.1.6-12 by removing the mycript line in the install xml file and
2007 Jul 20
3
binned column in a data.frame
Dear all, I would like to know how can I create a binned column in a data.frame. The output that I would like is something like this: Start Binned_Start 1 0-5 2 0-5 6 5-10 8 5-10 13 10-15 ... Best regards João Fadista Ph.d. student UNIVERSITY OF AARHUS Faculty of Agricultural Sciences Dept. of Genetics and Biotechnology Blichers
2011 Jun 24
4
What does class "call" mean? How do I make class "formula" into a "call"?
I have a list called "tabs" that I would like to have the same structure as my list "eqSystem." The two look like they have the same format but they are different because when I look at their attributes, class(eqSystem[[1]]) is "call" but class(tabs[[1]]) is "formula". I want to have class(tabs[[1]]) as a call too. So what does "call" mean? And how
2013 Mar 25
2
Ordering a matrix by row value in R2.15
fitz_ra wrote > I know this is posted a lot, I've been through about 40 messages reading > how to do this so let me apologize in advance because I can't get this > operation to work unlike the many examples shown. > > I have a 2 row matrix >> temp > [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] > [,9] [,10] > [1,] 17.000
2007 Apr 11
3
Help with pexp( )
Dear all, Sorry for bringing up an old issue: >pexp(50, 0.5) [1] 1 In some cases, pexp() gives CDF=1. I read some discussion in 2002 saying it has been patched. However it's not working in "R2.4.1Patched". Could anyone help me out? Thanks a lot, Jeann _________________________________________________________________ Fine Dining & Fancy Food. Check Out This
2008 Oct 29
1
How to set read.table variables to vectors?
The summary stats for the xin and yin variables below are correct. However, if I use plot(xin,yin), an exception is thrown saying that "object xin is not found." Also, it is apparent that I can't successfully replace the x and y vectors with values from xin and yin. The four plots on one panel are showing but the range of x and y is only [0,1], and therefore, it seems like an
2005 Jul 18
5
colnames
Hi, I have a matrix with column names starting with a character in [0-9]. After some matrix operations (e.g. copy to another matrix), R seems to add a character 'X' in front of the column name. Is this a normal default behaviour of R? Why has it got this behaviour? Can it be changed? What would be the side effect? Thank you. Regards, Gilbert [[alternative HTML version deleted]]
2012 Nov 23
6
Summary statistics for matrix columns
Hi, is there a way I can calculate a summary statistics for a columns matrix let say we have this matrix x <- matrix(sample(1:8000),nrow=100) colnames(x)<- paste("Col",1:ncol(x),sep="") if I used summary summary(x) i get the output for each column but I need the output to be in matrix with rownames and all the columns beside it this how I want it
2005 Nov 08
2
retrieve most abundant species by sample unit
Hi R-users: [R 2.2 on OSX 10.4.3] I have a (sparse) vegetation data frame with 500 rows (sampling units) and 177 columns (plant species) where the data represent % cover. I need to summarize the cover data by returning the names of the most dominant and the second most dominant species per plot. I reduced the data frame to omit cover below 5%; this is what it looks like stacked. I have
2010 Feb 11
1
Using sapply on a two argument function
Dear R users, I have a function (simplified here) that accepts two arguments and performs various calculations: foo <- function(y, x) { a <- y*sqrt(x) b <- a+2 c <- a*b return(c) } If I call the function as follows I get the result I desire: > foo(.1, 1:12) [1] 0.2100000 0.3028427 0.3764102 0.4400000 0.4972136 0.5498979 0.5991503 0.6456854 0.6900000 0.7324555 0.7733250