Displaying 20 results from an estimated 900 matches similar to: "converting histogram to barchart"
2008 Jun 23
5
Need ideas on how to show spikes in my data and how to code it in R
Hi
I have recently been analyzing birthweight data from a clinic. The
data has obvious defects in that there is digit preference on certain
weights making them overrepresented. This shows as spikes in the
histogram on certain well rounded weights like 2, 2.5, 3, etc. I
would like to show this to government officials but can't figure out
how I should present the finding in an easy to
2000 Jul 28
2
Loop removal?
Dear all,
I've got a quite large dataframe (stor) with rows subject and rt (reaction
time). I would like to split the reaction times per subject into 6 bins of
equal size. Right now, I'm using the following code:
bindata <- function(rt) {
bindata <- rep(-1,length(rt))
binwidth <- length(rt)/6
bindata[order(rt)[(0*binwidth)+1:(1*binwidth)]] <- 1
2010 Feb 05
1
histogram scott
Dear all,
I want to use the histogtam as a density estimator, with the binwidths calculated using scott's formula which is
binwidth = 3.49*ST.dev.*n^(-1/3)
for the following data (30 data points)
12-9-3-6-1-23-21-7-18-16-15-4-19-22-20-2-3-18-8-10-1-7-5-4-11-12-3-9-19-7
so first,I' ve tried this manually, and substituted in the above formula and I got
st.dev.=7.02745
and thus the
2009 Mar 02
3
ways to put multiple graphs on single page (using ggplot2)
Hi, Here are three plots:
library(ggplot2)
data(diamonds)
randind <- sample(nrow(diamonds),1000,replace=FALSE)
dsmall <- diamonds[randind,]
qplot(carat, data=dsmall, geom="histogram",binwidth=1)
qplot(carat, data=dsmall, geom="histogram",binwidth=.1)
qplot(carat, data=dsmall, geom="histogram",binwidth=.01)
What are ways to put these three plots on a single
2010 Jul 29
2
ggplot2 histograms... a subtle error found
Hello all,
I have a peculiar and particular bug that I stumbled across with
ggplot2. I cannot seem to replicate it with anything other than my specific
data set.
Here is the problem:
- when I try to plot a histogram, allowing for ggplot2 to decide the
binwidths itself, I get the following error:
- stat_bin: binwidth defaulted to range/30. Use 'binwidth = x' to
2009 Feb 02
1
Broke ggplot...
It appears I broke ggplot in my script, but that maybe it is because the caffeine has worn off or maybe it is late in the day. I thought I was beginning to understand ggplot, but I have encountered a silly little issue.
For some reason the following does not produce a histogram with fill due to the Person's characteristics:
(Note that VADeaths_flat_df$Data works fine...)
2009 Dec 10
1
barplot and cumulative curve using ggplot2 layers
Hello
My dataset is as follows:
jobno recruits
1100 18
1200 1
1850 5
2100 190
2789 25
3000 1
. .
. .
the dataset has 130 rows
I want to plot barplot from left side and cumulative curve from right side
in one graph itself using layers in ggplot2.
I sorted the recruits 1st in decreasing order
2015 Jun 16
4
Ayuda boxplot ggplot2
Hola a todos
Me gustaría saber si me pueden ayudar con lo siguiente.
Realicé un Boxplot usando ggplot2 para visualizar el comportamiento de dos
variables. Visualmente no se notan las diferencias porque la gráfica de la
derecha (parásitos en el abdomen) llega hasta 20 en el eje y. ¿Cómo puedo
hacer para que las dos gráficas muestren la misma escala en el eje Y, es
decir, que las dos lleguen a 60?
2023 Jan 12
1
Reg: ggplot error
Hallo
I am not familiar with any of packages you use (except of MASS and ggplot2) and the code is too complicated without any hint where the error could come from and what is the message you get. I wonder if anybody would like to go through your whole code.
1. data seems to be read correctly
ICUData <- read.csv(file = "ICUData.csv", stringsAsFactors = TRUE)
ICUData.neuro <-
2009 Aug 19
2
ggplot2 legend problem
I'm trying to overlay two histograms using transparency to enable viewing of
multiple distributions on a single scale. So far ggplot2 seems to do what I
want. However I'm having a problem generating the legend coloring
appropriate to each distribution in the plot.
Here is a test case to show my best (failed) effort so far:
library(ggplot2)
x <- data.frame(X=rnorm(1000, mean=0))
y
2007 Dec 06
3
using "eval(parse(text)) " , gsub(pattern, replacement, x) , to process "code" within a loop/custom function
R-help users,
Thanks in advance for any assistance ... I truly appreciate your expertise. I searched help and could not figure this out, and think you can probably offer some helpful tips. I apologize if I missed something, which I'm sure I probably did.
I have data for many "samples". (e.g. 1950, 1951, 1952, etc.)
For each "sample", I have many data-frames.
1998 Jul 07
2
S speedup in R
Venables and Ripley describe a speedup where you take a structure like
x<-NULL
for(i in sequence)
y<-c(y,function(x,i))
and convert it to one like
x<-numeric(its length)
for(i in sequence)
y[i]<-function(x,i)
I tried this speedup on some simple examples and it made them twice as
fast.
But now I am hitting a snag with some real code.
This original version works:
2012 Sep 14
1
Adding annotations to qplot from a data frame
I have the following data frame:
> algaedata =
year DIV cellsperml
2001 BAC 72.808
2001 CHL 3.273
2002 BAC 14.002
2002 CYA 220.896
2002 UNI 464.699
2003 BAP 0
2003 BAC 1.782
2004 CYA 315.799
2005 UNI 222.532
2005 BAP 0.2
2005 CYA 163.627
2005 BAC 324.949
2006 CHL 1.636
2006 BAC 199.145
2007 CHL 19.635
2007 CYA 134.174
2007 BAC 485.405
2007 CHL 11.454
2007 CYA 104.721
...which makes a fine
2011 Nov 03
2
query about counting rows of a dataframe
Dear R users,
I have got the following data frame, called my_df:
gender day_birth month_birth year_birth labour
1 F 22 10 2001 1
2 M 29 10 2001 2
3 M 1 11 2001 1
4 F 3 11
2009 Nov 14
2
formatting dates in axis labels (ggplot2)
I'm having trouble figuring out how to format Date variables when used
as axis labels in graphs.
The particular case here is an attempt to re-create Nightingale's
coxcomb graph with ggplot2,
where I'd like the months to be labeled as "Mar 1885", "Apr 1885", using
a date format
of "%b %Y" applied to label the dates, or really anything other than
2011 Jan 26
1
return object from loop inside a function
Hi All,
I have a for loop inside the function and I cannot get UUU to give me an
updated grid.dens object when I run the function (it does update when I
run just the for loop). Here's a simplified version of my function:
UUU=function(pop, grid.dens) {
for (i in 1:10){
Food=grid.dens[pop$yloc[i],pop$xloc[i]] #use initial grid.dens values
Consumed=(pop$weight[i]*0.25)
Left=Food-Consumed
2008 Mar 31
5
[LLVMdev] Additional Optimization I'm Missing?
Hello, I'm working on using the LLVM JIT for a little project of mine,
amazing work first off! I have a question about optimization passes. I
initially have this function I've created, in python it looks like this:
OS_end = 50OS_start = 0OS_timestep = 1birth_rate = .3population =
30.0for time in range(OS_start, OS_end, OS_timestep):
births = birth_rate * population
deaths = 0.1
2012 Dec 04
4
partial analisys of a time series
Dear list members
I want to analyze separately the months of a time series. In other words, I
want to plot and fit models for each month separately.
Taking the example of
http://a-little-book-of-r-for-time-series.readthedocs.org/en/latest/src/timeseries.html
births <- scan("http://robjhyndman.com/tsdldata/data/nybirths.dat")
birthstimeseries <- ts(births, frequency=12,
2010 Nov 30
2
ggplot2 histograms
Hi
With ggplot2 I can very easily create beautiful histograms but I would like to put two histograms on the same plot. The histograms may be over-lapping.
When they are overlapping the bars are shown on top of each other (so that the overall height is the sum of the two). Is there any way to get them to display overlapping (with smaller value in front, larger value behind) so that the overall
2010 Mar 30
1
hist.default()$density
Dear developers,
the current implementation of hist.default() calculates 'density' (and
'intensities') as
dens <- counts/(n*h)
where h has been calculated before as
h <- diff(fuzzybreaks)
which results in 'fuzzy' values for the density, see e.g.
> tmp <- hist(1:10,breaks=c(-2.5,2.5,7.5,12.5),plot=FALSE)
> print(tmp$density,digits=15)
[1]