Displaying 20 results from an estimated 20000 matches similar to: "table function in a matrix"
2007 Jun 06
2
Multiple color schemes for barchart (lattice)
Hello R-help.
I am trying to make a stacked barplot where the color of the sections of
each bar depend on another variable.
> myData[1:11,]
score percent marker cellType Malignant
1 0 100.00000 ESR1 (ER) Bladder.M(5) TRUE
2 0 80.00000 PAX8 Bladder.M(5) TRUE
3 1 20.00000 PAX8 Bladder.M(5) TRUE
4 0 100.00000 ESR1 (ER) Brain.N(3) FALSE
5 0
2012 Jul 02
4
R sub query
Hello,
I would like to substitute a substring of characters defined by a specific start and end sequence.
i.e. in the example matrix below, I would like to substitute ".:X:" with "", where X varies in sequence...
m<-matrix(c(".:0:0,0", ".:2:0,2", ".:194:193,1", ".:56:0,56", ".:58:50,8", ".:13:0,13",
2010 Jan 20
3
barchart with stacked and beside bars
Hi,
Is there a way to stack bars in a barchart as well as "beside" bars for the
same treatment? eg....
I have one barchart like this:
bio<-matrix(c(10,23,9,25),nrow=2,byrow=T)
ntreat<-c("n0","n96")
colnames(bio)<-ntreat
barplot(bio,beside=T)
now i want a similar barchart but with stacked bars:
2012 Jan 20
1
Stacked barchart in ggplot (or other library)
Hey,
I want to create a stacked barchart in R for the following dataset
(http://pastebin.com/pyHUNgr2):
# usage capacity diff
1 4 10 6
2 2 20 18
3 5 10 5
The stacked barchart should, in one plot show each line of the dataset as a
stacked bar using data from 'usage' and 'diff' to create the stacked bar.
I can't find a good example of how to do this on the ggplot2 site.
2010 Nov 08
1
Add text to a stacked barplot
Hi All,
I need some help in putting text in a stacked barplot. The barplot is filled
with 5 levels and now I would like to put text to each level in the stacked
barplot. However, it seems that the code that I am using is not placing the
text at the correct hight (centered at each fill) in the barplot. Any
suggestions to improve the code to make it work?
barchart(FREQ ~ VISIT
2009 Dec 02
1
barchart() {Lattice} -- auto.key()
Hi R Users,
I'm using following data/code (data is also attached) to produce a stacked
barplot.
*I need help with changing legend boxes, currently I'm using
"rectangles=TRUE". Is it possible to get small squares instead -- may be
with a small gap between colored squares.* Currently there is no gap between
the colored rectangles.
# Sample Data:
Names Col1 Col2 Col3
Row1 -20 40
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,
2017 Sep 22
0
Lattice stacked barplot vertical bars
Hi Luigi
will this do
barchart(
D ~ A|E,
DF,
groups = C,
stack = TRUE,
horizontal = F,
main = "Comparison of test results",
xlab = "Count",
col = c("yellow", "orange"),
par.settings = list(
strip.background = list(col="light grey"),
superpose.polygon=list(col= c("yellow",
2017 Sep 22
2
Lattice stacked barplot vertical bars
Dear all,
I have made a barplot using lattice in which the bars are stacked
horizontally. I would like to stack them vertically, but if I use the
parameter 'horizontal = FALSE' I get the error: 'Error in FUN(X[[i]],
...) : invalid 'type' (character) of argument'. The problem I face is
that, in drawing the bars vertically, the y variable becomes numeric
rather than
2009 Dec 02
2
Help: barchart() {Lattice}
Hi R Users,
I'm using following data/code (data is attached also) to produce a stacked
barplot.
# Sample Data:
Names Col1 Col2 Col3
Row1 -20 40 -10
Row2 30 -20 40
Row3 30 10 -20
Row4 20 20 -10
# R Code:
dta<-read.table("data.txt", header=TRUE, row.names="Names")
barchart(data.matrix(dta),
horizontal=FALSE,
stack=TRUE,
par.settings = simpleTheme(col =
2009 Dec 08
1
{Lattice} help.
Hi All,
I have a 4-dimensional data. I'm using barchart() function from lattice
package. The R code and data are below - code includes one for stack=TRUE
and other for stack=FALSE.
I would like to present the data in another form which would be plotting
Factor3 levels (P, Q, R, S) as two stacked bars (side by side). Like, for
each level of Factor1 there should be two bars: first bar showing
2011 Mar 22
1
Group labels in lattice barchart
Hello, I've been searching on the web for a few hours and seem to be stuck on this. The code pasted below generates a histogram of subject responses in four different conditions in an experiment. This version of the graph is one I'm using for internal consistency checking, so I've set it up to indicate the order of the responses, which is contained in the variable StimCount. The
2008 Jun 13
1
Switching the order of legend boxes in a lattice bar graph
I suspect there is a simple solution to this problem, but have been
unable to find it. Below is some code that I have run to create 3
lattice graphs. I have been asked to change the legend so that the
'No' and dark blue are above "Y" and light blue in the legend to
mirror the stacked bars in the graph which feature dark blue above light blue.
I have tried changing the data
2008 Nov 17
1
coerce data.frame with table-like data to a table for use with barchart.table
I have a data.frame containing survey data that is already organized
like a table:
> foo
Excellent Very Good Good Fair Poor Very Poor
Question 1 8 7 3 0 0 0
Question 2 5 5 7 1 0 0
Question 3 7 10 1 0 0 0
> class(foo)
[1] "data.frame"
>
I would like to make a barchart
2004 Oct 19
1
barchart fails when grouping variable has more than 7 levels (PR#7293)
Full_Name: Andreas Kiermeier
Version: 2.0.0
OS: Windows XP
Submission from: (NULL) (203.26.122.12)
I've struck a problem drawing barcharts after installing R 2.0.0. Previously
I've used the following command
print(barchart(100*result ~ sample,
groups=congener,
data=dioxin.2003.fresh.ub.p, stack=TRUE, ylim=c(0,102)))
to draw a stacked barchart of the
2010 Mar 15
1
Resizing Graphic Device Windows
Hi all,
I have been struggling with this one. When creating graphic devices, how do
you go about resizing the output device window automatically without having
to manually tinker with it to show everything in terms of tick marks and x/y
lims that you specify?
I have tried the aspect="" function, but that seems to only stretch the data
set one way or another, and not the actual window.
2012 Mar 15
2
Ggplot barchart drops factor levels: how to show them with zero counts?
Hello,
When plotting a barchart with ggplot it drops the levels of the factor for
which no counts are available.
For example:
library(ggplot)
mtcars$cyl<-factor(mtcars$cyl)
ggplot(mtcars[!mtcars$cyl==4,], aes(cyl))+geom_bar()
levels(mtcars[!mtcars$cyl==4,])
This shows my problem. Because no counts are available for factorlevel '4',
the label 4 dissapears from the plot. However, I
2023 May 03
1
[External] Error in percentage stacked barplot
Dear Richard,?
Thank you very much for your reply. I went through the code and it worked. I was also able to change the colours.?
I was wondering if I can change the legend position; instead of being in the bottom to be on the left side.?
I tried the following but without any success
strip = FALSE
strip.right = TRUE
likert(t(hellisheidi), ReferenceZero=.5, xlab="X-lab",
2004 Jun 22
1
Grouped AND stacked bar charts possible in R?
Good day all,
My statisticians want an R procedure that will produce grouped stacked
barplots. Barplot will
stack or group, but not both. The ftable function can produce a table
of the exact form they want, but the barplot doesn't show all the
divisions we want.
For an example, here's the sample from the help file for "ftable:"
data(Titanic)
ftable(Titanic, row.vars = 1:3)
2009 Dec 02
1
Fw: Re: Help: barchart() {Lattice}
I HAVE BEEN ASKED TO BE REMOVED FROM THIS LIST OVER 20 TIMES, PLEASE CAN I BE REMOVED!!!!!!!!!!!!!
--- On Thu, 3/12/09, Peng Cai <pengcaimaillist@gmail.com> wrote:
From: Peng Cai <pengcaimaillist@gmail.com>
Subject: Re: [R] Help: barchart() {Lattice}
To: "Felix Andrews" <felix@nfrac.org>
Cc: r-help@r-project.org
Received: Thursday, 3 December, 2009, 10:17 AM
Got it