Displaying 20 results from an estimated 9000 matches similar to: "Summarize by two or more attributes"
2011 Dec 01
2
Summarizing elements of a list
Hi everyone,
I looked around the list for a while but couldn't find a solution to my
problem. I am storing some results to a simulation in a list and for each
element i have two separate vectors(is that what they are called, correct my
vocab if necessary). See below
Version1_<-list()
for(i in 1:5){
Version1_[[i]]<-list(First=rnorm(1),Second=rnorm(1))
}
What I want is to put all
2011 Sep 01
3
Oh apply functions, how you confuse me
Hi guys,
I have a crap load of data to parse and have enjoyed creating a script that
takes this data and creates a number of useful graphics for our area. I am
unable to figure out one summary though and its all cause I dont fully
understand the apply family of functions. Consider the following:
#Create data
2010 Jan 12
5
Drop last numeral
Hello all,
Frustrated and i know you can help
I need to drop the last numeral of each of my values in my data set. So for
the following i have tried the ?substring but since i have to specify the
length, but because my data are of varying lengths it doenst work so well
Data<-c("1131", "1132", "1731" ,"1732" ,"1821" ,"1822",
2012 Feb 06
5
I bet apply has a solution
Hi all
For the data below, I would like to return a logical value indicating
differences in the data.
#Create data
Data..<-data.frame(a=rep(1,10),b=c(rep(1,9),2),c=c(rep(1,8),2,2))
a b c
1 1 1 1
2 1 1 1
3 1 1 1
4 1 1 1
5 1 1 1
6 1 1 1
7 1 1 1
8 1 1 1
9 1 1 2
10 1 2 2
So what I want is to return logical value telling me if all the values are
the same. So the result would be a b
2010 Nov 29
3
List elements of NULL to value
Hi everyone,
I am posting this because i know its easy and i cant for the life of me
figure out how to do it though i have tried and through a ridiculously
complex loop made it happen. I need to convert some list elements of NULL
value to 0s so they mesh with my data frame properly. So for
A<-list(1,NULL)
returns
[[1]]
[1] 1
[[2]]
NULL
Would instead return
[[1]]
[1] 1
[[2]]
[1] 0
2010 Sep 13
2
proportion
Hi ,
SO i have been on a role of asking simple questions lately. So much for
feeling like im getting this R business.
I wrote a script 2 weeks ago that utilized "proportion" to turn values in a
table (from "table") into proportions to then graph. I now get an error
that proportion is not a function so im confused. I ran the script a few
times and im thinking maybe i had
2010 Aug 09
4
Pie Chart in map
Hey R'rs,
So im sick of dealing with ESRI products and am looking to stream line a
process i now use GIS to do using R. I have made a lot of maps using R but
have not yet seen a map that puts pie charts within the map to help
represent data like the attachment.
http://r.789695.n4.nabble.com/file/n2318816/template1.bmp
I found Tanimura et al. work "Proportional Symbol Mapping in
2012 Oct 11
3
Sorting a data frame by specifying a vector
Hello all,
I cannot seem to figure out this seemingly simple procedure.
I want to sort a data frame by a specified character vector.
So for :
df.. <- data.frame(Season=rep(c("Summer","Fall","Winter","Spring"),4),Obs=
runif(length(rep(c("Summer","Fall","Winter","Spring"),4))))
I want to sort the data frame
2006 Apr 19
1
Hmisc + summarize + quantile: Why only quantiles for first variable in data frame?
Hi,
I'm working on a data set that contains a couple of factors and a
number of dependent variables. From all of these dependent variables
I would like to calculate mean, standard deviation and quantiles.
With the function FUN I get all the means and stdev that I want but
quantiles are only calculated for the first of the dependent
variables (column 8 in the summarize command). What do I
2009 Jun 13
1
Hmisc summarize() with level "" in by variable
I was using summarize() in a data set in which one of the levels of
the by variable was "". The summary statistic was consistently off by
one level and the "" level was not in the output data frame. I tried
to report it as a bug, but I could not log into the Hmisc bug
reporting website to do so. I searched for this in the email
archives. If it's there, I failed to find
2006 May 05
0
summarize: A log analysis script
Hi folks,
I wrote a quick script to extract performance one-liners from Rails logs.
(Didn''t want to futz with syslog for http://rails-analyzer.rubyforge.org/ .)
Reads output from :info or :debug log levels (the defaults).
Usage:
# summarize < development.log
# summarize < production.log
Output looks like:
(w/FULL_URL set false)
123.23.23.123 2006-05-05 10:59:42 | r
2014 Nov 13
2
Help with ddply/summarize
I have a straightforward application of ddply() and summarize():
ddply(MyFrame, .(Treatment, Week), summarize, MeanValue=mean(MyVar))
This works just fine:
Treatment Week MeanValue
1 MyDrug BASELINE 5.91
2 MyDrug WEEK 1 4.68
3 MyDrug WEEK 2 4.08
4 MyDrug WEEK 3 3.67
5 MyDrug WEEK 4 2.96
6 MyDrug WEEK 5 2.57
7 MyDrug
2014 Nov 21
1
dplyr/summarize does not create a true data frame
I got an error when trying to extract a 1-column subset of a data frame (called "my.output") created by dplyr/summarize. The ncol() function says that my.output has 4 columns, but "my.output[4]" fails. Note that converting my.output using as.data.frame() makes for a happy ending.
Is this the intended behavior of dplyr?
Tx,
John
> library(dplyr)
> # set up data frame
2010 Apr 13
0
Hmisc::summarize with a dataframe as input?
Hi all,
I'm looking for a function with the same functionalities as Hmisc::summarize
but accepting a dataframe as input (not just a vector or a matrix).
I'd like to compute the correlation between two variables in my dataframe,
grouped according to other variables in the same dataframe.
For exemple, consider the following dataframe D:
V1 V2 V3
A 1 -1
A 1 1
A -1 -1
2006 Dec 28
2
Aggregation using list with Hmisc summarize function
Hi All,
I'm using the Hmisc summarize function and used list instead of llist to
provide the by variables. It generated an error message. Is this a bug,
or do I misunderstand how Hmisc works with lists? The program below
demonstrates the error message.
Thanks,
Bob
x<-1:8
group <- c(1,1,1,1,2,2,2,2)
gender<- c(1,2,1,2,1,2,1,2)
mydata<-data.frame(x,group,gender)
2010 Jun 03
2
Subsetting for unwanted values
Hi all,
I have toyed with this for too long today and in the past i used multiple
lines of code to get at what i want. Consider the following:
All i need to do is subset Pc to the values that do not equal Pc.X. The
first attempt doesnt work because i have unequal lengths. The second
attempt doesnt give me an the right answer.
2004 Apr 06
0
Curious about nomenclature: random deviates
< Does anyone know why they're called random deviates, as opposed to random
numbers?>
Others will probably give you some technical reason about random numbers can
be considered as random deviates from a mean (I think at least the 1875
Galton paper at http://www.mugu.com/galton/ uses similar terminology (I'm
not claiming this is the earliest use - just the easiest to access at the
2010 Apr 16
3
problem with FUN in Hmisc::summarize
Hi all,
I'd like to use the Hmisc::summarize function, but it uses a function (FUN)
of a single vector argument to create the statistical summaries.
Consider an easy case: I'd like to compute the correlation between two
variables in my dataframe, grouped according to other variables in the same
dataframe.
For exemple, consider the following dataframe D:
V1 V2 V3
A 1 -1
A 1
2004 Jul 13
0
Is there a statistics that can summarize the correlation formore than two random variables?
This seems more like a STATS question than an R question - asking on a
list like STAT-L or ALLSTAT may result in more replies
Nevertheless, it seems to me that you need to describe (and maybe
decide) what you mean by 'summarize' the correlations. Certainly the
mean DOES summarize them, but is it the summary you want? Maybe, maybe
not. Perhaps the median? Or a trimmed mean? Do you want
2009 Apr 24
0
By= levels with the Hmisc summarize function.
Hi, All
I have a data frame as follows:
> attach(mf)
> names(mf)
[1] "centre" "complex" "appl" "pool" "month" "alloc_gb"
I want to summarize this as follows:
agg<-summarize(alloc_gb,by=llist(centre,complex,appl,month),FUN=sum,
na.rm=TRUE)
That seems to run fine but there something odd about the output. The