Displaying 20 results from an estimated 9000 matches similar to: "How to group a count"
2007 Jun 22
1
Barchart legend position
I am using barchart to make charts for some data with a lot more
functions and labels and such in the command.
barchart(Freq ~ factor(HH), data = dataset1, group= year)
So I have my data grouped by year and I get a legend at the top of
graph, which is great cause I need the legend for the different years
but it is a weird spot. So how can I manipulate the legend, ie. Move
it, shrink it, do
2007 Jun 20
3
Replace number with month
Hi all
I have a multiple datasets that look like this
MM Freq
1 30
2 35
3 54
4 33
5 27
6 13
7 25
8 29
9 40
10 32
11 36
12 23
I am plotting this using barchart (there is probably something better
but it gives me the results I want) and I would like the x-axis to have
the names of the months instead of the month numbers. So I have
2008 Jan 23
1
Bar width and labels in barchart
Hi everyone
I am using barchart to make my graphs. Here is my code.
barchart(percent_below ~ factor(Year)| factor(Season,
levels=unique(Season)),
data= .season_occurrence, origin = 0, layout = c(4, 1),
scales=list(tick.number=ticknum,labels=NULL), ylim=c(0, ymax),
group = factor(Year), xlab= "Year", auto.key = list(points =
FALSE, rectangles =
2007 Dec 19
1
adding lines to a barchart
Hi all
I can't find what I am looking for so I am asking here. I have a
dataset that looks something like this.
Year season percent_below
2000 Winter 6.9179870
2000 Spring 1.6829436
2000 Summer 1.8463501
2000 Autumn 3.8184993
2001 Winter 2.8832806
2001 Spring 2.5870511
2001 Summer 0.0000000
2001 Autumn 4.7248240
2002 Winter
2007 May 10
1
Barplot by two variables
Hi all
I have a bit of a problem. I want to make a barplot of some data. My
data is of a score that is separated by year and by a limit (above 3 and
below 3 to calculate the score).
Year Limit HSS
1999 ALT 0.675
1999 VFR 0.521
2000 ALT 0.264
2000 VFR 0.295
I would like to have a barplot with year on the x axis and HSS on the y
axis and the two limits as two different colors to show the
2008 Nov 24
4
Replace NaN with zero
I need help with replacing NaN with zero (the value '0') in my dataset.
The reason is that I can't get it to graph because of the NaN in the
dataset. I have tried:
data[is.nan(data)] <- 0
that others have suggested in the help archives but this does nothing so
I am not sure what I am doing wrong.
Thanks in advance for your help.
[[alternative HTML version deleted]]
2007 Apr 25
1
Sum of specific column
I have a data set that I have imported (not sure if that makes a
difference) and I would like to calculate the sum of only specific
columns. I have tried
>colSums(dataset, by=list(dataset$col5), dims=1) and I get an error of
unused arguments
I have also tried
>aggregate(dataset, by=list(dataset$col5), sum) and I get the error that
sum is not meaningful for factors.
I want to only calculate
2007 Sep 19
1
Subset any value and blanks
Hi everyone
I need help with subseting a data set. In my dataset there is a
specific row that will either have a value or be blank. I would like to
subset (or split) the dataset into one dataset with the row that has the
value and another dataset that has just the blanks. Now the thing is
that the row that has the value in it, the value is not always the same,
it is a time stamp of when
2007 Jun 29
1
Assign name to a name
I would like to know how I can assign a name to a name. I have a
dataset that has different years in it. I am writing scripts using R
and I would like to give a month a generic name and then use the generic
name to do different analysis. The reason for the generic name would be
so that I only have to change one thing if I wanted to change the year.
For example.
Year1 = 1999
datayear <-
2007 Apr 11
2
Looping through series of names
Hi
I am very new to R and have not able to find the answer to my question
in the manual or any other post. I have a dataset that has various
different sites names with data relating to each site. The data is in
one dataset. I want to loop through the different site names and
perform my test on each site. The sites are named not numbers for
example "YYC". How do I do this. I hope I
2012 Mar 03
2
Grouped barchart confidence intervals in lattice
Hi everyone,
I'm having trouble adding error bars to a grouped barchart in lattice. I know that this topic has been addressed quite a bit, as I've been searching the internet for a while to try to troubleshoot the issue, but I've not been able to find any solution that I could get working on my data. I was wondering if someone could look at my code and tell me what I'm doing
2007 Feb 24
2
barchart (lattice) with text labels
I would like to place the value for each bar in barchart (lattice) at
the top of each bar. Something like the following code produces.
library(lattice)
mypanelfunc <- function(x, y, ...)
{
panel.barchart(x, y, ...)
panel.text(x, y, labels=as.character(round(x,2)), ...)
}
myprepanelfunc <- function(x, y, ...) list(xlim=c(0, max(x)+.1))
mydata <- expand.grid(a=factor(1:5),
2010 May 07
3
How to sort a grouped barchart?
Hi,
I have a barchart very similar to the example on the function documetation,
however, I want to sort the bars according one group in one panel.
Reminding:
library(lattice)
barchart(yield ~ variety | site, data = barley,
groups = year, layout = c(1,6),
ylab = "Barley Yield (bushels/acre)", auto.key=list(),
scales = list(x = list(abbreviate = TRUE,
2007 Dec 19
1
Different labels by panel in barchart
Dear all,
I'm analysing a survey, and creating a barchart of the different responses
for each question. The questions are grouped according to a number of
categories, so I'm using lattice to create a plot with each question in a
category on it. The problem is that the response set for different
questions within the same category varies. I want to be able to draw only
the relevant
2010 Feb 20
1
How get the single bar x coordinate in barchart when groups is used?
Hi all,
I am using barchart() to plot values above the bars. When using groups argument we get bars grouped arround a given x level. By placing values above this bars we need to know the respective x coordinates. How can I get it?
require(lattice)
da <- expand.grid(x=1:5, z=1:3, w=1:2)
da$y <- rpois(da$x, lambda=23)
barchart(y~x|w, groups=z, data=da, horizontal=FALSE,
2010 Feb 20
3
Error Bars in lattice- barcharts
Hello,
I am attempting to write a script that adds error bars to a barchart. I
basing my attempt heavily on the following thread:
http://tolstoy.newcastle.edu.au/R/e2/help/06/10/2791.html
I can't seem to get around the problem that was discussed in the thread. The
following example should illustrate my problem. Sorry about the messy
example but I am 1) trying to make it as close as possible
2010 Feb 26
1
bwplot() {lattice}
Hi All,
I'm trying to plot boxplot graph. I tried barchart with "groups=" option and
it worked fine. But when I try to generate same kind of graph using
bwplot(), "groups=" option doesn't seem to work. Though this works,
yield ~ variety | site * year
I'm thinking why "groups=" doesn't work in this case, can anyone help
please...
#Code:
2008 Apr 28
0
Two graphs on one using barchart
> Hi R users
> Here is an example of my data (only a small part)
>
> Year Season A_Time R_Time O_Time All_Time AandR_Time
> A_number R_number O_number AandR_number all_number
> 1999 Winter 9.590741 35.312963 42.759524 23.228431 18.164815
> 18 9 7 27
> 34
> 2000 Winter 9.899537 47.945000 59.744444 20.301333
Barchart in lattice - wrong order of groups, data labels on top of each other, and a legend question
2009 May 18
1
Barchart in lattice - wrong order of groups, data labels on top of each other, and a legend question
Hello!
I have a question about my lattice barchart that I am trying to build
in Section 3 below. I can't figure out a couple of things:
1. When I look at the dataframe "test" that I am trying to plot, it
looks right to me (the group "Total" is always the first out of 5).
However, in the chart it is the last. Why?
2. How can I make sure the value labels (on y) are not
2009 Nov 26
3
barchart() {Lattice} help.
Hi R Users,
I'm trying to plot a stacked barplot. Here is data:
Sample Col1 Col2 Col3
Row1 -2 4 -1
Row2 3 -2 4
Row3 3 5 -2
Row4 4 1 -1
I'm using following R code:
library(lattice)
dta<-read.table("data.txt", header=TRUE, row.names="Sample")
barchart(data.matrix(dta),
horizontal=FALSE,
stack=TRUE,
col=2:4,