Displaying 20 results from an estimated 800 matches similar to: "Aggregate Values for All Levels of a Factor"
2007 Sep 08
1
ggplot legend consolidation
Hello Everyone,
I have recently been introduced to the ggplot package by Hadley Wickham
and must say I am quite impressed so far at how easy it is to make
attractive plots, but one thing I am struggling over is how to
consolidate legends.
I have 3 plots that I would like to put on a single page and all 3 map
the same dimension of the data to the colour aesthetic. Right now, when
I plot all
2009 Jun 25
1
Help with Wine and PPRS
I have downloaded an application at "http://www.philhealth.gov.ph/employers/download/pprs.htm" this is a custom windows application, it loads its own mouse pointer Hand.avi which cannot be opened in wine. Can anyone help me on what to do? I am using Wine version 1.1.16 because I am also running MS Office 2007 with wine. I am also using Ubuntu Jaunty.
2007 May 12
0
How to Derive an S4 Class from a data.frame?
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello R-Help:
I would really appreciate some help on this. I have spent a good deal of
time searching for an answer for what I would think to be a common
practice: Subclasses an S4 class from a data.frame. But have found very
little.
Here is some sample code that I've been trying:
setClass("MyDataFrame",
2008 Oct 20
1
passing a list where names arguments are expected
hi,
say i have a function f and i'd like to to call it like this:
1) f(list(a=...,b=...))
but i can't do it, because f is defined as:
2) f<-function(a=NULL,b=NULL){...}
is there a way that i can approximate 1), such as mapping list(a=,...b=...)
to "list(a=,...b=...)" and then replacing "list" by "f", and then evaluating
the expression?
thanks.
2008 Oct 20
3
Trying to pass arrays as arguments to a function
I'd like to avoid looping through an array in order to change values in
the array as it takes too long.
I red from an earlier post it can be done by "do.call" but never got it
to work. The Idea is to change the value of "y" according to values in
"x". Wherever "x" holds the value 3, the corresponding value in "y"
should be set to 1.
So I
2008 Oct 26
3
Process dataframes from list
Hi all,
I have roughly fifty dataframes and a dataframe with the names of the fifty
dataframes. I want to perform the same set of manipulations on all fifty
dataframes, but can't find a way to batch process from a list with the
dataframe names using a loop. Is there a way to read the file names from
the dataframe with the names and then call the referenced dataframe? This
would save me a
2008 Oct 20
3
The evaluation of optional function arguments
Dear R-helpers,
I've got two functions; callTimes() calls times(), passing it an
optional argument (bar) by name (bar=harry). times() then believes it
has been passed a name, rather than a value ? but I want the value,
not the name.
Worse, if I evaluate the name, it is evaluated in the environment
times() was defined, not where it is called.
How can I call times(), defining its optional
2004 Aug 23
1
samba.schema in 3.0.6
I installed samba 3.0.6 today. I had to upgrade samba.schema in openldap as
well to include sambaPasswordHistory and sambaLoginTime, otherwise certain
things would not work (e.g. smbpasswd or users changing passwords)
openldap failed to start because both attributes have the same OID,
...2.1.50.
In order to get started anyway, I changed the sambaPasswordHistory OID to
...2.1.52 (which, in my
2007 Dec 16
2
question about the aggregate function with respect to order of levels of grouping elements
Hi,
I am using aggregate() to add up groups of data according to year and month.
It seems that the function aggregate() automatically sorts the levels of
factors of the grouping elements, even if the order of the levels of factors
is supplied. I am wondering if this is a bug, or if I missed something
important. Below is an example that shows what I mean. Does anyone know if
this is just the way
2011 Apr 07
1
Assigning a larger number of levels to a factor that has fewer levels
Hello!
I have larger and a smaller data frame with 1 factor in each - it's
the same factor:
large.frame<-data.frame(myfactor=LETTERS[1:10])
small.frame<-data.frame(myfactor=LETTERS[c(9,7,5,3,1)])
levels(large.frame$myfactor)
levels(small.frame$myfactor)
table(large.frame$myfactor)
table(small.frame$myfactor)
myfactor has 10 levels in large.frame and 5 levels in small.frame. All
5
2008 Sep 25
1
Repeated factor levels - inconsistency of factor and levels<- functions?
Hello,
I have a vector x containing letters ("a", "b" etc.). Now I want to
convert it to factor and group some letters into one common level. If I do
it by factor function, giving the same label names for all values I want
to group, it doesn't work:
> x<-letters[1:5]
> x
[1] "a" "b" "c" "d" "e"
>
2009 Dec 08
1
Printing 'k' levels of factors 'n' times each, but 'n' is unequal for all levels ?
Dear List,
I need to print out each of 'k' levels of a factor 'n' times each, where
'n' is the number of elements belonging to each factor.
I know that this can normally be done using the gl() command,
but in my case, each level 'k' has an unequal number of elements.
Example with code is as below:
vc<-read.table("P:\\Transit\\CORRECT
2009 Jun 20
1
how to apply the dummy coding rule in a dataframe with complete factor levels to another dataframe with incomplete factor levels?
Dear R helpers:
Sorry to bother for a basic question about model.matrix.
Basically, I want to apply the dummy coding rule in a dataframe with
complete factor levels to another dataframe with incomplete factor levels.
I used model.matrix, but could not get what I want.
The following is an example.
#Suppose I have two dataframe A and B
2006 Aug 09
0
Sum/Aggregate at database level or in rails controller?
Hi,
Database model of my web app is as follows,
users(id,name)
Taskcategories(id,user_id,name)
Tasks(id,taskcategory_id,name)
TasksData(id,tasks_id,durationInHrs,date)
I want to collect and show following data from the above tables, in the
view,
1. Category wise duration total for a user for a week.
2. Category wise duration total for a user for each of the 7 days of the
week.
3. Total
2006 Jul 11
1
Aggregate Controllers
Hi,
I''m developing a dashboard like page and basically want to combine the result of multiple actions on a page. I''ve done this so far:
def index
r1 = render_to_string :action => "action1"
r2 = render_to_string :action => "action2"
render :text => r1+r2
end
This works, but now I want to render from other controllers and this is where
2005 Jun 13
0
Aggregate 3 internet connexions.
Hi,
I have 3 internet connexions :
Router 1 : 192.168.212.2
Router 2 : 192.168.212.3
Router 3 : 196.200.8.73
I can''t change IP adress of router 3 because I haven''t admin password
and my provider don''t want to give it.
I want only 1 PC to aggregate the 3 connexions.
How I can make that Router 3 work on my 192.168.212.x network?
Thanks
Jeremy
2012 Apr 26
1
Aggregate function for comparison stats
Hi,
I have a data.frame which contains timeseries from several different
locations, which I want to compare against each other for example
calculating RMSE, or normalized mean bias of each location against the
others. An example of this is the cor function where I can put in a
data.frame and get the correlation of each location compared to the
others in the data.frame eg.
2011 Jan 11
1
question on aggregate
an example available on the net goes like
> df
identifier quantity
1 1 10
2 1 20
3 2 30
4 1 15
5 2 10
6 3 20
> aggregate(df$quantity, by=list(df$identifier), sum)
Group.1 x
1 1 45
2 2 40
3 3 20
I'd like Group.1 to retain the name "identifier" and would like to
2008 Jun 17
1
re sultant column names from reshape::cast, with a fun.aggregate vector
try this:
scores.melt = data.frame(grade = floor(runif(100, 1,10)), variable =
'score', value = rnorm(100));
cast(scores.melt, grade ~ variable, fun.aggregate = c(mean, length))
it has the nice column names of:
grade score_mean score_length
1 1 0.08788535 8
2 2 0.16720313 15
3 3 0.41046299 7
4 4 0.13928356 13
...
but
2012 Jan 18
1
Reshape with multiple aggregate functions
I have a data frame and I would like to reshape it to wide format while at
the same time applying different aggregate functions to each column AND at
times multiple aggregate functions:
test1 = data.frame(
id = c(rep('101',8),rep('102',8)),
phase = rep(c('D','D','L','L'),4),
day =