Displaying 20 results from an estimated 10000 matches similar to: "Bug in hist() when working with Dates ?"
2009 Jul 26
2
problems hist() and density
Hello,
I have a problem with the hist() function and showing densities. The
densities sum to 50 and not to 1! I use R version 2.9.1 (2009-06-26) and
I load the seqinR library.
My data is the following vector:
[1] 0.1400000 0.2000000 0.2200000 0.2828283 0.1600000 0.1600000
0.3600000
[8] 0.1600000 0.2200000 0.2600000 0.2000000 0.3000000 0.2200000
0.2342342
[15] 0.1800000 0.2200000 0.1600000
2006 Aug 25
1
How to get back POSIXct format after calculating with hist() results
Hi,
I have a casting/formatting question on hist.POSIXt:
The histogram plot from POSIXct works perfect (with help of Prof. Ripley
-thanks!).
When processing the hist(plot=FALSE) output and then plotting the
results over the x-axis (bins) coming from hist(), I lose the date/time
labels, getting instead integers displayed.
Trying to cast the $breaks with as.POSIXct gives silly results with
2007 Aug 15
4
Possible to "import" histograms in R?
Hi,
I have a large amount of data that I would like to create a histogram of and
plot and do things with in R. It is pretty much impossible to read the data
into R, so I have written a program to bin the data and now have a list of
counts in each bin. Is it possible to somehow import this into R and use
hist(), so I can, for instance, plot the probability density? I have looked
at the help page
2008 Sep 01
3
another histogram question
Hi there,
I hope this question is not as stupid as the one before ...
I tried to shorten my histogram (because the distribution is quite skewed and I
simply don't want to see the long tail but still use the histogram plot). How
can I do something like this? (The example does not work but I don't know why...)
data <- rnorm(100) # as example, of course this is not skewed...
h <-
2008 Nov 15
1
Rename objects based on list
Hi all,
I am trying to find a way to rename R objects with names pulled from a
vector of names. For example, I have a data frame, my.data.frame, and
a list of names, my.names. My.names is simply the column names of
my.data.frame.
I want save the histogram with the column name as the name of the object.
for (i in 1:ncol(my.data.frame) {
tmp<-hist(my.data.frame[,i])
2004 Aug 19
3
probability histogram question
Hello, all;
I get an unexpected result when trying to plot a probability histogram
with R1.9.1 on windows xp:
#with the following code:
> x <- runif(100,0,1)
> hist(x)
> hist(x, freq=F)
> h <- hist(x, freq=F)
> summary(h)
# Length Class Mode
#breaks 11 -none- numeric
#counts 10 -none- numeric
#intensities 10 -none- numeric
#density 10
2006 Apr 05
1
hist function: freq=FALSE for standardised histograms
Dear All,
I am a undergraduate using R for the first time. It seems like an excellent
program and one that I look forward to using a lot over the next few years,
but I have hit a very basic problem that I can't solve.
I want to produce a standardised histogram, i.e. one where the area under
the graph is equal to 1. I look at the manual for the histogram function and
find this:
freq:
2011 Dec 31
1
Histogram omitting/collapsing groups
I have two large datasets (156K and 2.06M records). Each row has the
hour that an event happened, represented by an integer from 0 to 23.
R's histogram is combining some data.
Here's the command I ran to get the histogram:
> histinfo <- hist(crashes$hour, right=FALSE)
Here's histinfo:
> histinfo
$breaks
?[1] ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 10 11 12 13 14 15 16 17 18 19 20 21
2012 Feb 06
2
histogram
With R and the hist function, is there a way to make a histogram in which
the y axis denotes propotion with respect to a separate sample dataset of
the same range instead of frequency?
[[alternative HTML version deleted]]
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
2003 Jan 08
1
Determining the break points by hist() leads to errors (PR#2432)
Hi,
if I dermine the break points using the hist() function and then try
to re-use these in a new histogram, R fails. Here is an example of the
problem:
##First, plot a histogram:
data(islands)
foo <- hist(islands,freq=T)
##Now, try plot it again, with the previously determined break points:
hist(islands,breaks=foo$breaks,freq=T)
##... this lead to the warning message:
Warning message:
2019 Oct 01
1
Improvement in hist command documentation
Hi all,
In the histogram created with the `hist` command, the label of the y axis reads "Frequency ?.
Finding that the ylab key is used to change (localize) that word may seem difficult for people
who are beginners either in R or in english.
I suggest very minor modifications of the file hist.Rd at https://svn.r-project.org/R/trunk/src/library/graphics/man/hist.Rd.
1) make the default value
2011 Oct 24
3
Creating a histogram properly
Hello all,
I'm trying to make a histogram of the data contained in my dataframe.
The summary of the data gives me exactly what I want
summary (Data)
V1 V2
first001: 3 last001: 9
first002: 3 last002: 7
first003: 2 last003: 6
(Other) :52 (Other): 27
But how do I capture the names and values in vectors so I can plot them?
2008 Feb 16
3
how to specify the location of tick mark on x axies
Dear:
I want to plot barplot and let bar be in the middle of each x axis category.
Do you have this experience?
Many Thanks!
Xin
[[alternative HTML version deleted]]
2000 Nov 17
2
hist() and density
There were some questions about hist() a couple of days ago which
triggered this post. My question/suggestion is about the y-axis in hist.
There are reasons to prefer making the y-axis density=relative
frequency/bin width. One reason is that the height of the plot does not
depend on the bin width; another is that if your histogram is in density
then you can easily superimpose a smooth theoretical
2007 Feb 15
3
Working with temporal data
Hi,
I have several files with data in this format:
20070102
20070102
20070106
20070201
...
The data is sorted and each line represents a date (YYYYMMDD). I would
like to analyze this data using R. For instance, I would like to have
a histogram by year, month or day.
I've already made a simple Perl script that aggregates this data but I
believe that R can be much more powerful and easy on
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]
1998 Jan 23
2
hist: rel.freqs
In R0.61,
In hist(), should the line
rel.freqs <- counts/(sum(x) * diff(breaks))
computing the relative frequencies or height of the rectangles
in a histogram not be
rel.freqs <- counts/(sum(counts) * diff(breaks))
instead, or do I misunderstand something?
Thanks,
Philippe
--
--------------------------------------------------------
Philippe Lambert Tel:
2007 Feb 16
1
Working with temporal data [Solved]
Just for the record, here are my steps for producing a date based histogram.
Data is stored in a file where each line only has a date - 2007/02/16
>d<-readLines("filename.dat")
>d<-as.Date(d, format="%Y/%m/%d")
>pdf(yearly.pdf)
>hist(d, "years")
>dev.off()
Instead of "years" you can also use "days", "weeks",
2007 Jun 20
2
Averaging dates?
Hi,
What's the best way to average dates?
I though mean.POISXct would work fine but...
> a
[1] "2007-04-02 19:22:00 WEST"
> b
[1] "2007-03-17 16:23:00 WET"
> class(a)
[1] "POSIXt" "POSIXct"
> class(b)
[1] "POSIXt" "POSIXct"
> mean(a,b)
[1] "2007-04-02 19:22:00 WEST"
> mean(b,a)
[1] "2007-03-17