Displaying 20 results from an estimated 10000 matches similar to: "Can hist plot % of count instead of raw count?"
2009 Aug 30
2
aggregating irregular time series
Hi,
I have a couple of aggregation operations that I don't know how to
accomplish. Let me give an example. I have the following irregular
time series
time x
10:00:00.021 20
10:00:00.224 20
10:00:01.002 19
10:00:02:948 20
1) For each entry time, I'd like to get sum of x for the next 2
seconds
2009 Jun 24
2
lapply across using multiple columns
Hi,
To set a simple an clear picture of what I'd like to do, here is an example.
I would like to calculate mean of column A and B bucketed by factor in
column X in a data.frame. lapply or aggregate operates on a single column. I
found dapply function in some package which doesn't seem to exist any more.
Is there anyway that I can accomplish something like this? Thank you so much
in
2009 Aug 30
2
POSIX time conversion doesn't display digit
Hi,
I have the following string that I converted to a POSIXct:
> a <- "2009-08-24 10:00:00.213"
> a.p <- strptime(a,"%Y-%m-%d %H:%M:%OS")
> as.double(as.POSIXct(a.p))
[1] 1251122400
I can't seem to get the decimal fraction of .213 out by casting to
double or numeric. Is there anyway to make sure that POSIXct spits
that out? Thank you.
adschai
2009 Jun 28
1
Defining class as a member of another class
Hi,
When I define a new class (through setClass), members defined in
representation argument doesn't seem to like a class. For example, if
I do the following:
setClass("NotWork",representation=(x="zoo"))
It seems to me that representation members will take in only primitive
type to R. Is there any way to stuff a class as a member in another
class? Thank you.
- adschai
2009 Jun 21
1
Need help installing xts package
Hi,
I am trying to install package xts. I am using OPENSUSE 11 64 bit. When I
invoke:
install.pacakges("xts",dependencies=T)
I received a lot of "ERROR: compilation failed for package" errors when R
tries to install xts dependencies. I do not understand this behavior.
I notice one thing. It complains.
ERROR: compilation failed for package 'Hmisc'
** Removing
2009 Jun 23
1
Smart way to check if a column with certain name exists in a data.frame
Hi,
I have a matrix or data.frame (df). When I would like to check if a column
named "x" exists, it becomes my habit to do the following:
if (length(which(colnames(df)=="x"))>0)
Is there any smarter way to do this? Thank you.
adschai
[[alternative HTML version deleted]]
2009 Aug 12
1
Smart way to sum a column in a matrix across all members in a list
Hi,
I have a list that contains about 100 elements. Each element contains
the following matrix structure
a b
1 1 4
2 2 5
3 3 6
I'd like to sum column b across all elements. I'm thinking of using
lapply or sapply but cannot get it to work. Any help would be really
appreciated. Thank you.
adschai
2000 Mar 10
1
variable name to hist within apply?
Hello,
After spending sometime trying to generate histograms of all the
numeric variables in a data frame using a for loop, I realized I could
use apply to create the histograms. This was one of those few moments
when I `see' the alternative to looping.
So, I can generate all the histograms with this command:
apply(toblo.df[,-c(40,52)],2,hist) # 40 and 52 are ID's
When I do this, the
2010 Dec 01
2
How to draw a rect() behind a hist() ?
Hi,
I have the following code:
hist(gps$heartpercent, breaks=5)
rect(90, par("usr")[3], 100, par("usr")[4], col = "red")
How do I get the rectangle to appear behind the histogram. Barring that,
how can I make certain bars of the histogram to be a certain color?
Thanks,
Jason
2003 Sep 18
2
hist will not use parameter xaxs (PR#4219)
Full_Name: Mark Wall
Version: 1.6.0
OS: linux
Submission from: (NULL) (63.251.119.254)
I want to plot a histogram of a *subset* of some data:
>t = c(0:9)
>hist(t,right=FALSE,breaks=10,xlim=c(0,5),xaxs="i")
This means I should plot a histogram from 0 to 5 with breaks at 1,2,3,4. This
should produce exactly 5 bars of frequency=1. Instead I get 5 and 1/4 bars. I
do not want the
2009 Jun 04
3
Understanding R Hist() Results...
Think I'm missing something to understand what is going on with hist(...)
http://n2.nabble.com/What-is-going-on-with-Histogram-Plots-td3022645.html
For my example I count 7 unique years, however, on the histogram there only 6. It looks like the bin to the left of the tic mark on the x-axis represents the number of entries for that year, i.e. Frequency.
I guess it looks like the bin for
2005 Nov 02
2
breaks in hist()
Dear listers,
A quick question about breaks in hist().
The histogram is highly screwed to the right, say, the range of the vector is [0, 2], but 95% of the value is squeezed in the interval (0.01, 0.2). My question is : how to set the breaks then make the histogram look even?
Thanks in advance,
Leaf
2000 Mar 23
1
Some "new" stuff for hist.R
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.
--0-201145637-953833073=:7710
Content-Type: TEXT/PLAIN; charset=US-ASCII
Dear all,
I've been hacking on histograms the past couple of days. I wanted to do
two things, add
2005 Nov 02
1
Visualizing a Data Distribution -- Was: breaks in hist()
> > Leaf Sun wrote:
> > The histogram is highly screwed to the right, say, the range
> > of the vector is [0, 2], but 95% of the value is squeezed in
> > the interval (0.01, 0.2).
I guess the histogram is as you wrote. See
http://web.maths.unsw.edu.au/~tduong/seminars/intro2kde/
for a short explanation.
> -----Original Message-----
> From: Berton Gunter
2004 Nov 26
2
hist and truehist
Hello!
Up to now I have been using hist() to display the distributions.
Howevere, I noteiced strange numbers on y (vertical) axis, if I used
probability = T or freq = F option. I thought it is a bug and launched
the R-bug system and found some posts on that matter. Brian Ripley
responded to one, that one should look at truehist() for that. Ok I can
use truehist() if I want to see the ratios
2007 Apr 13
3
labels cut partially on hist
Dear List,
I have the following function where I plot on one page a histogram and a boxplot.
I use option labels = TRUE in hist to show labels. However the label on the highest bar in the
histogram is not showing entirely. How can I correct this?
Thanks for any suggestions?
histtst <-
function(n = 100,...){
set.seed(15) # makes rnorm reproducible
par(mfrow = c(2,1))
x <-
2005 Dec 11
1
(PR#8376 inconsistency between plot(hist(...)) and hist(...)
On Sun, 11 Dec 2005 clausen at econ.upenn.edu wrote:
> Full_Name: Andrew Clausen
> Version: 2.1.0
> OS: Debian GNU/Linux
> Submission from: (NULL) (71.242.192.73)
>
>
> Hi,
>
> When I type
>
> hist(x, freq=F)
>
> I get a density function, as I expect. However, if I type
>
> plot(hist(x, freq=F))
>
> then I get the same output as if I had
2010 Jan 03
3
Thin bars in R hist !!??
Hi,
I am trying to plot a histogram with my dataset that has 68 elements, 67 of
which are zero and the last one is 18. It can be reproduced as follows:
x<-array(0, dim=(68))
x[1] = 18
I am trying to plot its histogram using:
hist(x, breaks=10, xlim=c(0, 100), axes=F)
axis(2, at=seq(0, 70, 5)) # for the y-axis
axis(1, at=seq(0, 100, 10)) # for the x-axis
As you would also see if you
2001 May 07
1
unexpected breaks in hist
Hello R-list,
I've been using hist to plot histograms of some data, but I get variable
numbers of bins. I understood from reading the help file that breaks will
set the number of bins. Please correct me if I'm wrong.
I'm plotting measures from subsets of a larger data set. Depending on the
data subset the number of bins varies despite having set breaks to 5 in
all cases.
See
2008 May 19
2
How hist() decides breaks?
Hi Folks,
I'd like to know how hist() decides how many cells to use
when it ignores my "suggestion" to use say 'hist(...,breaks=50)'.
More specifically, I have the results of 10000 simulations,
each returning an 8-vector, therefore 8 variables each with
10000 values. Some of these 8 have somewhat skew distributions.
Say one of these 8 variables is X.
I ask for H <-