Displaying 20 results from an estimated 10000 matches similar to: "barplot and NA"
2012 Apr 06
2
multiple values in one column
I have some data files in which some fields have multiple values. For example
first last sex major
John Smith M ANTH
Jane Doe F HIST,BIOL
What's the best R-like way to handle these data (Jane's major in my example), so that I can do things like summarize the other fields by them (e.g., sex by major)?
Right now I'm processing the files (in excel since they're
2007 May 15
1
stacked barplot with positive and negatvie values
Hello I'm trying to create a barplot with a couple of stacked positive
values and with one negative value for each group.
example:
trees<-c(20,30,10)
shrubs<-c(12,23,9)
veg<-c(2,3,4)
soil<-c(-100,-123,-89)
example1<-t(cbind(trees,shrubs,veg))
barplot(example1)
#this works so far
#but now:
example2<-t(cbind(trees,shrubs,veg,soil))
barplot(example2)
This shows no more
2004 Sep 16
1
barplot with vcd library
'barplot' doesn't seem to work with vcd library.
Am I supposed to detach vcd when I want to use barplot?
Here's an example.
Say I have the following matrix,
> m <- matrix(c(1,2,3, 4,5,6, 3,4,5, 2,3,4), ncol=4)
> m
[,1] [,2] [,3] [,4]
[1,] 1 4 3 2
[2,] 2 5 4 3
[3,] 3 6 5 4
Then
> barplot(m)
gives a barplot of the data.
However,
2012 Aug 26
3
Aligning barplot
All, Consider:
BagA <- c(-1000,10,10,10,10,10,10,
10,20,20,20,20,20,20,30,
30,40,40,50,60)
BagB <- c(10,20,30,30,40,40,50,50,
50,50,50,50,60,60,60,60,
60,60,60,1000)
layout(c(2,1))
barplot(table(BagB))
barplot(table(BagA))
At this point, I'd like to arrange the plots so that the 10-bars are
aligned, the 20-bars are aligned, etc. So, I started
2008 Dec 06
2
Barplot label
Dear all,
I am trying to make barplot from matrix with "beside=FALSE". I have 165 labels in my bar plot. When i plot the label horizontally below the barplot, then all labels are not appear in the plot due to lack of space. I used the following function:
barplot(t(bar), main="Barplot based on LCMS", ylab="RF membership Probability",
2011 Apr 04
2
gap.barplot doesn't support data arrays?
I am trying to make a barplot with a broken axis using gap.barplot (in the
indispensable plotrix package). This works well when the data is a vector:
> twogrp<-c(rnorm(10)+4,rnorm(10)+20)
> gap.barplot(twogrp,gap=c(8,16),xlab="Index",ytics=c(3,6,17,20),ylab="Group
values",main="Barplot with gap")
But when the data is an array (for a bar plot with multiple
2011 Jul 14
2
Problem with x labels of barplot
Hello everyone,
i am currently creating a barplot.
This barplot takes a vector of ~200 datapoints.
Each datapoint represents one bar.
http://img96.imageshack.us/i/human1w.png/
(Ok as you see, it is not only one barplot, but a series of barplots).
Now, these barplots represent a human chromosome. This means they are
ordered. For instance bar number 50, means position 50 in the human
chromosome.
2007 Nov 04
2
Fw: Creating a barplot--advice needed
Subject: Creating a barplot--advice needed
> Advice needed: I am preparing a computer program to do a barchart. Advice
> needed: Should I learn the lattice package, or try to? As a
> non-statistician, much of the terminology is unfamiliar to me. "grouping
> variable," "object of class trellis," etc. Or, is there a more easily
> learned way to do it? It is a
2009 Feb 12
2
barplot() x axes are not updated after removal of categories from the dataframe
Hi all,
I'd be grateful for your help. I am a new user struggling with a barplot
issue.
I am plotting categories (X axis) and their mean count (Y axies) with
barplot().
The first call to barplot works fine.
I remove records from the dataframe using final=[!final$varname == "some
value",]
I echo the dataframe and the records are no longer in the dataframe.
When I call plot again
2011 Jul 01
1
Reverse legend label order in barplot
Hi list,
I've thus far not found a solution to my problem and hope someone can help.
I have a data matrix and wish to plot a stacked bar plot using barplot().
This is simple enough, but I have a problem with the legend labels being in
the reverse order from what I want. The default appears to have labels
ascending bottom-to-top reflecting bottom-to-top sub-bars, but I would like
the
2009 Mar 03
2
preparing data for barplot()
What is the best way to produce a barplot from my data? I would like
the barplot to show each person with the values stacked
val1+val2+val3, so there is one bar for each person When I use
barplot(data.matrix(realdata)), it shows one bar for each value
instead.
To post here, I created an artificical data set, but it works fine.
fakedata <- as.data.frame(list(LETTERS[1:3]))
colnames(fakedata)
2011 Aug 25
1
How to vary the distance between the pairs of a side-by-side barplot?
Hello,
for my project I wanted to create a side-by-side barplot. For each of 143 treatments there are always two measurement. This two measurements (a pair) are represented by a red resp. a yellow bar. I was able to write the code for the side-by-side barplot. Unfortunately however I am not able to vary the distance between the measurement pairs ( the distance from one red-yellow bar pair to the
2007 Mar 13
3
Adding bars to the right of existing ones using barplot
I'm trying to create a barplot that has two sets of data next to each
other. I'm using barplot with the add=TRUE option, but this simply
adds the second dataset on top of the first, obscuring it. How do I
add the new data to the right on the existing barplot so that both
sets are visible? I've been playing with all sorts of option and
reading the list archives with no
2002 Oct 14
2
barplot + plot
Dear all,
I've got another question,
By default barplot and plot seem to produce slightly different y-axis.
The problem I've got is when using a mix figure with both, barplot and
plot. For example:
barplot(1:5, ylim=c(0, 6))
par(new= T)
plot(1:5, 9:5, type="b", axes=FALSE, ylim=c(0,9))
axis(4)
box()
note that both plots (barplot and plot) should start at 0, but the exact
2004 Jun 15
2
tapply/barplot (PR#6983)
Hello,
there seems to be a bug in tapply or barplot in R 1.9.0 that was not in =
earlier versions. The following code creates two nice barplots in 1.7.0, =
but the first one is bad in 1.9.0:
par(mfrow=3Dc(1,2))
x <- rep(1:10,10)
y <- runif(100,1,100)
z <- tapply(y,x,mean)
barplot(z)
barplot(as.numeric(z))
although is.numeric(z) returns TRUE!
Best regards,
Vidar Hjellvik
Institute of
2006 Sep 07
1
barplot: different colors for the bar and the strips
Hi,
I am using barplot and would like to know if it is possible to have bars
filled with one color while use a different color for the shading lines.
The following code colors the shading lines, leaving the bars in white:
barplot(1:5, col=c(1:5), density=c(1:5)*5)
while the colors are applied to the bars when density is removed.
barplot(1:5, col=c(1:5))
I did check ?barplot and found the
2010 Jan 29
1
Barplot/Histogram (lattice)
Dear Rxperts..
what settings in barplot and histogram do I use, to show bars in an
monotonously increasing or decreasing order of the frequency of a
categorical variable?
an example is provided below..
histogram(~factor(sample(letters,200,rep=T)))
I was able to get it in 3 - 4 steps.. l
a1 <- sample(letter,200,rep=T)
a2 <- table(a1)
barplot(a2); barplot(sort(a2)) # all variables are not
2005 Nov 14
1
bug/feature with barplot?
I have found a bug/feature with barplot that at least to me shows
undesireable behaviour. When using barplot and plotting fewer
groups/levels/factors(I am unsure what they are called) than the number
of colors stated in a col statement, the colors wrap around such that
the colors are not fixed to one group. This is mostly problematic when
I make R figures using scripts, since I sometimes have
2011 Jan 25
2
barplot with varaible-width bars
I would like to produce a bar plot with varying-width bars. Here is an example to illustrate:
ww <- c(417,153,0.0216,0.0065,556,256,0.0162,0.0117,
+ 726,379,0.0358,0.0501,786,502,0.0496,0.0837,
+ 892,591,0.0785,0.0795)
yy<-t(t(array(ww,c(2,10))))
barplot(yy[,2*1:5],las=1,space=c(.1,.5),beside=T)
produces a barplot of 5 pairs of bars that are of equal width
2010 Feb 02
2
barplot y axis too short
Hello,
The function barplot automatically creates a y-axis that doesn't necessarily
cover the range of y-values to be plotted. I know how to manually create my
own y-axis so that it does cover the range, but I was wondering if there is
some parameter to change so that the scale of the y-axis is automatically
taller than the tallest bar.
I thought setting xpd=F would do it, since it says that