Re: [R] HISTOGRAM

2018-11-10 Thread Medic
Rui Barradas, thank you for your prompt response, your code will be useful to me in the future! Rick Bilonick ("your data appear to be categorical"), thank you very much for your comment (I would have to more correctly express my task). JIM Lemon, THANKS!!! THIS IS EXACTLY what I needed! ___

Re: [R] HISTOGRAM

2018-11-10 Thread Jim Lemon
Hi Medic, Perhaps this: medic_df<-read.table(text="name number ds6277 lk 24375 ax46049 dd70656 az216544 df 220620 gh641827", header=TRUE) library(plotrix) options(scipen=10) barp(medic_df$number,names.arg=medic_df$name,width=0.5) As others have noted, this is really a

Re: [R] HISTOGRAM

2018-11-09 Thread Rick Bilonick
First, a histogram would not be appropriate (your data appear to be categorical - a histogram is for continuous numeric vales) - you would need a bar plot. You should make two vectors (one for the category names and the other for the frequencies) and use the barplot function. On Fri, Nov 9, 2018 a

Re: [R] HISTOGRAM

2018-11-09 Thread Rui Barradas
Hello, You probably want a bar plot, not a histogram. old.sci <- options(scipen=999) with(mydata, barplot(number, space = 0, names.arg = name, beside = TRUE)) options(scipen = old.sci) #- mydata <- read.table(text = " name number ds6277 lk 24375 ax46049 dd70656

Re: [R] histogram in GNU R....

2018-09-07 Thread Peter Langfelder
A simpler short term solution is to execute dev.off() and look for the plot in file Rplots.pdf in the current directory. Depending on the OS of the local computer, you should be able to point a file browser at the EC instance and simply click the file to open in in a pdf viewer on the local machine

Re: [R] histogram in GNU R....

2018-09-07 Thread William Dunlap via R-help
You may have to install X11 stuff to your ec2 instance. E.g., googling for "ec2 X11 forwarding" showed things like the following: Re: X11 forwarding to access AWS EC2 Linux instance Posted by: wilderfield Posted on: Apr 5, 2018 11:31 AM [

Re: [R] histogram in GNU R....

2018-09-07 Thread MacQueen, Don via R-help
In addition to the other suggestions, try typing x11() before using hist(). That *should* start a graphics window. If it does not, then type capabilities() and see if "X11" is TRUE. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-

Re: [R] histogram in GNU R....

2018-09-07 Thread peter dalgaard
You are most likely plotting to a non-screen device. Check dev.list() after the hist(), and then the documentation for that device. It's probably pdf, and after quitting R, you should find that a file Rplots.pdf has been created. -pd > On 7 Sep 2018, at 10:26 , akshay kulkarni wrote: > > dear

Re: [R] histogram in GNU R....

2018-09-07 Thread Ivan Krylov
On Fri, 7 Sep 2018 08:26:22 + akshay kulkarni wrote: > when I type hist(xht), it goes to the next prompt. More importantly, > there is no error message. So, the most probable conclusion is that > the command gets executed Yes, hist() returns its value invisibly (try typing "? invisible" in t

Re: [R] Histogram of character elements

2018-06-07 Thread Luigi Marongiu
Thank you Ben, this also works! I have a copy of the Sarkar but, usually, I don't work with histograms. I'll brush it up, then. Best regards, Luigi On Thu, Jun 7, 2018 at 1:43 PM Ben Tupper wrote: > > Hi again, > > I'm sort of pre-coffee still, but does this do it? The data frame only has > one

Re: [R] Histogram of character elements

2018-06-07 Thread Ben Tupper
Hi again, I'm sort of pre-coffee still, but does this do it? The data frame only has one variable, a factor where the order of the levels is specified. library(lattice) group <- c("a", "b", "c", "d", "e") freq<- c(1, 2, 2, 5, 3) x <- rep(group, freq) df <- data.frame(group = fa

Re: [R] Histogram of character elements

2018-06-07 Thread Luigi Marongiu
also, with this approach, I need to re-arrange the data. Is it possible to work directly on a dataframe? On Thu, Jun 7, 2018 at 12:48 PM Ben Tupper wrote: > > Hi, > > Is this what you are after? > > group <- c("a", "b", "c", "d", "e") > freq <-c(1, 2, 2, 5, 3) > x = rep(group, freq) > barplot(tabl

Re: [R] Histogram of character elements

2018-06-07 Thread Luigi Marongiu
exactly! Thank you! but it is possible to do it with lattice? I might have an extra level of information, for instance super-group, and in that case, I could plot all the supergroup easily together. On Thu, Jun 7, 2018 at 12:48 PM Ben Tupper wrote: > > Hi, > > Is this what you are after? > > group

Re: [R] Histogram of character elements

2018-06-07 Thread Ben Tupper
Hi, Is this what you are after? group <- c("a", "b", "c", "d", "e") freq <-c(1, 2, 2, 5, 3) x = rep(group, freq) barplot(table(x)) Cheers, Ben > On Jun 7, 2018, at 6:00 AM, Luigi Marongiu wrote: > > Dear all, > I have a dataframe with a column representing the names of the > elements (a, b

Re: [R] Histogram plots in Lattice with spatialgrid dataframe data

2017-07-09 Thread Thomas Adams
Jeff, Thank you! I know what I did was very inelegant and I understand about providing a reproducible example; I just could not do it with my data -- I guess I was too lazy to make up a toy one. I apologize about the email formatting. I would never have known to use 'stack', 'levels' 'gather' and

Re: [R] Histogram plots in Lattice with spatialgrid dataframe data

2017-07-09 Thread Jeff Newmiller
Glad you found an answer, though it looks more self-educational than efficient (see suggestions below). In the future, follow the recommendations of the Posting Guide: use plain text, and provide a reproducible example. Some elaborations on what "reproducible" means are [1][2][3]. One issue here

Re: [R] Histogram plots in Lattice with spatialgrid dataframe data

2017-07-09 Thread Thomas Adams
Hello all, After more digging I was able to find out how to do this. The answer came from an example here: https://stackoverflow.com/questions/3541713/how-to-plot-two-histograms-together-in-r yr_1997<-data.frame(bias=ann_bias$bias1997) yr_1998<-data.frame(bias=ann_bias$bias1998) yr_1999<-data.f

Re: [R] histogram first bar wrong position

2016-12-23 Thread peter dalgaard
> On 22 Dec 2016, at 18:08 , William Dunlap via R-help > wrote: > > As a practical matter, 'continuous' data must be discretized, so if you > have long vectors of it you will run into this problem. Yep, and it is a bit unfortunate that hist() tries to use "pretty" breakpoints, so that you wil

Re: [R] histogram first bar wrong position

2016-12-23 Thread Martin Maechler
> William Dunlap > on Thu, 22 Dec 2016 09:08:35 -0800 writes: > As a practical matter, 'continuous' data must be discretized, so if you > have long vectors of it you will run into this problem. > Bill Dunlap > TIBCO Software > wdunlap tibco.com Yes, it is true th

Re: [R] histogram first bar wrong position

2016-12-22 Thread Ted Harding
Willam has listed the lid on the essence of the problem, which is that in R the way that breaks (and therefore counts) in a histogram are evaluated is an area of long grass with lurking snakes! To get a glimpse of this, have a look at ?hist and in the seaction "Arguments", look at "breaks", "fre

Re: [R] histogram first bar wrong position

2016-12-22 Thread William Dunlap via R-help
As a practical matter, 'continuous' data must be discretized, so if you have long vectors of it you will run into this problem. Bill Dunlap TIBCO Software wdunlap tibco.com On Thu, Dec 22, 2016 at 8:19 AM, Martin Maechler wrote: > > itpro > > on Thu, 22 Dec 2016 16:17:28 +0300 wri

Re: [R] histogram first bar wrong position

2016-12-22 Thread William Dunlap via R-help
Looking at the return value of hist will show you what is happening: > x <- rep(1:6,10*(6:1)) > z <- hist(x, freq=TRUE) > z $breaks [1] 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 $counts [1] 60 50 0 40 0 30 0 20 0 10 ... The the first bin is [1-1.5], including both endpoints, while the ot

Re: [R] histogram first bar wrong position

2016-12-22 Thread Martin Maechler
> itpro > on Thu, 22 Dec 2016 16:17:28 +0300 writes: > Hi, everyone. > I stumbled upon weird histogram behaviour. > Consider this "dice emulator": > Step 1: Generate uniform random array x of size N. > Step 2: Multiply each item by six and round to next bigger in

Re: [R] Histogram using Sturges' Bining Errors

2016-10-02 Thread Jim Lemon
Hi Elysa, This is pretty much a guess. If you understand the first error, i.e. that there are nine rows in your input data frame (?) that contain NA, NaN, or Inf values, have you tried manually removing those rows and feeding the remainder to your code? Jim On Sun, Oct 2, 2016 at 7:19 PM, Elysa

Re: [R] Histogram with a wide range of numbers.

2016-01-21 Thread Jim Lemon
Hi Sema, I trimmed your file to the first 220 lines. ads<-read.table("all_data_scor.txt",header=TRUE,sep="\t") ads.tab<-table(cut(all_data_scor[,2],breaks=c(0,1e-100,1e-10,1e-1,1,10))) barplot(adt.tab) This gives you a basic idea of what can be done. If this is not clear, ask again. Jim On Thu

Re: [R] Histogram for Left Censored Data

2015-12-31 Thread Jim Lemon
Hi Steve, Maybe something like this: Sconc<-matrix(c(1450,1800,1840,1820,1860,1780,1760,1800,1900, 1770,1790,1780,1850,1760,1450,1710,1575,1475,1780,1790, 1780,1450,1790,1800,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0), 24,2) hist(Sconc[,1],breaks=c(1450,1550,1650,1750,1900)) abline(v=1450

Re: [R] Histogram from a single column of a data frame

2014-09-26 Thread Rolf Turner
On 27/09/14 05:57, Richard Lerner wrote: Column 7 of "oded" is "Breed". If I enter summary(Breed) I get the counts of the numbers in each breed. However, if I enter I have tried hist($Breed) Error: unexpected '$' in "hist($" hist(Breed) Error in hist(Breed) : object 'Breed' not found

Re: [R] Histogram from a single column of a data frame

2014-09-26 Thread William Dunlap
Try hist(oded$Breed) (I suspect that summary(Breed) does not work in your current session either - perhaps you had a dataset named just Breed or had attached the data.frame oded in the session where summary(Breed) works.) Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Sep 26, 2014 at 10

Re: [R] Histogram

2013-09-05 Thread Duncan Murdoch
to the See Also section. David Carlson -Original Message- From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] Sent: Wednesday, September 4, 2013 7:00 PM To: dcarl...@tamu.edu Cc: 'philippe massicotte'; 'Rui Barradas'; 'r-help@R-project.org' Subject: Re: [R] H

Re: [R] Histogram

2013-09-05 Thread David Carlson
com] Sent: Wednesday, September 4, 2013 7:00 PM To: dcarl...@tamu.edu Cc: 'philippe massicotte'; 'Rui Barradas'; 'r-help@R-project.org' Subject: Re: [R] Histogram On 13-09-04 4:44 PM, David Carlson wrote:> Good question. It turns out that the manual page does not t

Re: [R] Histogram

2013-09-04 Thread philippe massicotte
Thank you everyone for your help. > Date: Wed, 4 Sep 2013 20:00:02 -0400 > From: murdoch.dun...@gmail.com > To: dcarl...@tamu.edu > CC: pmassico...@hotmail.com; ruipbarra...@sapo.pt; r-help@r-project.org > Subject: Re: [R] Histogram > > On 13-09-04 4:44 PM, David Carlson

Re: [R] Histogram

2013-09-04 Thread Duncan Murdoch
p-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of philippe > massicotte > Sent: Wednesday, September 4, 2013 3:02 PM > To: Rui Barradas > Cc: r-help@R-project.org > Subject: Re: [R] Histogram > > Thank you everyone. > Try executing this: > replica

Re: [R] Histogram

2013-09-04 Thread philippe massicotte
il.com > CC: r-help@r-project.org > Subject: Re: [R] Histogram > > Hello, > > See the arguments 'right' and 'include.lowest' of ?hist. > To give what you want, try instead > > h1 <- hist(1:10, 10) # counts are 2, 1, 1, ... > h2 <- hist(1

Re: [R] Histogram

2013-09-04 Thread David Carlson
apo.pt > To: pmassico...@hotmail.com > CC: r-help@r-project.org > Subject: Re: [R] Histogram > > Hello, > > See the arguments 'right' and 'include.lowest' of ?hist. > To give what you want, try instead > > h1 <- hist(1:10, 10) # counts are 2, 1, 1, ...

Re: [R] Histogram

2013-09-04 Thread arun
10 10 10 10 10 10 10  #[76] 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 A.K. - Original Message - From: philippe massicotte To: Rui Barradas Cc: "r-help@R-project.org" Sent: Wednesday, September 4, 2013 4:02 PM Subject: Re: [R] Hist

Re: [R] Histogram

2013-09-04 Thread Ista Zahn
Wed, 4 Sep 2013 20:27:36 +0100 >> From: ruipbarra...@sapo.pt >> To: pmassico...@hotmail.com >> CC: r-help@r-project.org >> Subject: Re: [R] Histogram >> >> Hello, >> >> See the arguments 'right' and 'include.lowest' of ?hist. >> To

Re: [R] Histogram

2013-09-04 Thread Duncan Murdoch
elp@r-project.org > Subject: Re: [R] Histogram > > Hello, > > See the arguments 'right' and 'include.lowest' of ?hist. > To give what you want, try instead > > h1 <- hist(1:10, 10) # counts are 2, 1, 1, ... > h2 <- hist(1:10, breaks = 0:

Re: [R] Histogram

2013-09-04 Thread Rui Barradas
Hello, See the arguments 'right' and 'include.lowest' of ?hist. To give what you want, try instead h1 <- hist(1:10, 10) # counts are 2, 1, 1, ... h2 <- hist(1:10, breaks = 0:10) # all counts are 1 and see the difference between h1 and h2, components 'breaks' and 'counts'. Hope this helps,

Re: [R] Histogram

2013-09-04 Thread David Carlson
We can just ask hist(): ? hist . . . breaks one of: a vector giving the breakpoints between histogram cells, a function to compute the vector of breakpoints, a single number giving the number of cells for the histogram, =

Re: [R] histogram with bars colored according to a vector of values

2013-07-25 Thread Jim Lemon
On 07/26/2013 12:13 PM, john d wrote: Dear all, Let's say I have the following data.frame: dat<-data.frame(x=rnorm(100), y=rnorm(100,2)) and I plot a histogram of variable x, somethink like: hist(dat$x, breaks=-5:5) Now, I'd like to color each bar according to the mean of the cases according

Re: [R] histogram

2013-03-05 Thread arun
Hi, I guess this is what you wanted. Attaching a plot from a subset (lstSub) dat1<- read.csv("rightest.csv",sep=",",header=TRUE,check.names=FALSE) label1=c("0-25","25-50","50-75") Name1<-unlist(lapply(0:123,function(i) rep(i+1,i))) dat1New<- dat1[,-1] vec1<- unlist(lapply(seq_len(nrow(dat1

Re: [R] histogram

2013-03-05 Thread arun
HI Elisa, Just noticed the order of elements in vec1: You have to replace `vec1` dat2<- as.dist(dat1[,-1],upper=F,diag=F) vec1<- as.vector(dat2)  head(vec1) #[1]  5.796656 43.523023 38.193750 44.730182  6.511703  2.904954 #the order is based on columns #with dat1<- read.csv("rightest.csv",sep=",

Re: [R] histogram

2013-03-04 Thread arun
Hi, If you meant to get the array index from `res1`, then this will do it.  But, if it is from 'dat3`, it will  be huge as each index is unique. indx<-which(apply(res1,1,function(x) x!=0) ,arr.ind=TRUE)  Names2<-do.call(rbind,lapply(1:3,function(i) {x<-indx[indx[,2]==i,]; paste(apply(x,1,functio

Re: [R] histogram

2013-03-04 Thread arun
Hi, dat1<- read.csv("rightest.csv",sep=",",header=TRUE,check.names=FALSE)  dat2<- as.dist(dat1[,-1],upper=F,diag=F) vec1<- as.vector(dat2) label1=c("0-25","25-50","50-75") Name1<-unlist(lapply(0:123,function(i) rep(i+1,i))) dat3<-data.frame(Name1,vec1) res<-t(aggregate(.~Name1,data=dat3,function(x

Re: [R] histogram

2013-03-04 Thread arun
Hi, Sorry, I forgot names(which() Names2<-apply(res1,1,function(x) paste(names(which(x!=0)),collapse=",")) res2<- data.frame(Frequency=apply(res1,1,function(x) sum(1*(x!=0))), stations=Names2,stringsAsFactors=FALSE)  res2  #     Frequency #0-25    121 #25-50   122 #50-75    76    

Re: [R] histogram

2013-03-04 Thread arun
Hi Elisa, I am not sure about the output you wanted. dat1<- read.csv("rightest.csv",sep=",",header=TRUE,check.names=FALSE)  dat2<- as.dist(dat1[,-1],upper=F,diag=F) vec1<- as.vector(dat2) label1=c("0-25","25-50","50-75") Count1<- as.data.frame(table(cut(vec1,breaks=seq(0,75,25),labels=label1))) #

Re: [R] histogram

2013-02-17 Thread arun
HI Elisa, You could use ?cut() vec1<-c(33,18,13,47,30,10,6,21,39,25,40,29,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45) label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),

Re: [R] Histogram plot spacing

2013-01-15 Thread Uwe Ligges
On 15.01.2013 12:35, Julie Collet wrote: Dear all, I'd like to remove the space between the x-axis and the 0 of the y-axis in the hist function. I saw the previous post https://stat.ethz.ch/pipermail/r-help/2012-September/324177.html suggesting adding the x-axis at position 0 (or the lowest

Re: [R] Histogram plot help

2012-12-04 Thread YAddo
Thanks, Rui and David! -- View this message in context: http://r.789695.n4.nabble.com/Histogram-plot-help-tp4651958p4652065.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailma

Re: [R] Histogram plot help

2012-12-03 Thread David L Carlson
Does it work the way you want if you add prob=TRUE to the second and third hist() commands and run do.call() before abline()? -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Mess

Re: [R] Histogram plot help

2012-12-03 Thread Rui Barradas
Hello, I can't say I understand your graph but as for the abline not showing up, it's outside the clipped region so it shouldn't. If you want it to show up, in the previous line, and after the hist() call, include clip(2, -2, usr[3], usr[4]) As for the decimals, those are normal, have you se

Re: [R] histogram help

2012-11-22 Thread Jim Lemon
On 11/22/2012 05:15 AM, Rosario Scandurra wrote: Hi, I want to generate an histogram and plot on the y axis the percentage of a categorical variable and on the x axis a nominal variable. I want to move the origin to have 2 categories below 0. Hope somebody could help me. Thanks. Hi Rosario, If

Re: [R] histogram help

2012-11-21 Thread John Kane
i think we need some sample data. I would not have thought that you could calculate the percentage of a categorical data so perhaps a simple example of what you are doing would help. John Kane Kingston ON Canada > -Original Message- > From: rosario.scandu...@gmail.com > Sent: Wed, 21

Re: [R] histogram & corelation plots

2012-10-10 Thread David L Carlson
4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of R. Michael Weylandt > Sent: Wednesday, October 10, 2012 3:04 PM > To: sagarnikam123 > Cc: r-help@r-project.org > Subject: Re: [R] histogram & corelation pl

Re: [R] histogram & corelation plots

2012-10-10 Thread R. Michael Weylandt
On Wed, Oct 10, 2012 at 4:47 PM, sagarnikam123 wrote: > i want to show histogram in innovative way (good if interactive) in html > report..is threre any tutorials/hint > also there is any package to show correalation plot The histogram is well defined, so I'm not really sure how much innovation y

Re: [R] histogram plot spacing problem

2012-09-19 Thread Rui Barradas
Hello, Try the following. x <- rnorm(100) hist(x, xaxt = "n") axis(1, at = pretty(x), pos = 0) Hope this helps, Rui Barradas Em 19-09-2012 18:51, firespot escreveu: Hi, So I plot a histogram using the built-in hist function: hist(rnorm(100), ...). Now the y-axis starts at its lower end at

Re: [R] Histogram to KDE

2012-09-06 Thread Tim Hesterberg
To bootstrap from a histogram, use sample(bins, replace = TRUE, prob = counts) Note that a kernel density estimate is biased, so some bootstrap confidence intervals have poor coverage properties. Furthermore, if the kernel bandwidth is data-driven then the estimate is not functional, so some boo

Re: [R] Histogram to KDE

2012-09-05 Thread firdaus.janoos
On Fri, Aug 31, 2012 at 12:15 PM, David L Carlson wrote: > Using a data.frame x with columns bins and counts: > > x <- structure(list(bins = c(3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, > 11.5, 12.5, 13.5, 14.5, 15.5), counts = c(1, 1, 2, 3, 6, 18, > 19, 23, 8, 10, 6, 2, 1)), .Names = c("bi

Re: [R] Histogram to KDE

2012-08-31 Thread David L Carlson
Using a data.frame x with columns bins and counts: x <- structure(list(bins = c(3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5), counts = c(1, 1, 2, 3, 6, 18, 19, 23, 8, 10, 6, 2, 1)), .Names = c("bins", "counts"), row.names = 4:16, class = "data.frame") This

Re: [R] Histogram

2012-07-30 Thread David Winsemius
On Jul 30, 2012, at 9:29 AM, Jim Silverton wrote: I have the following codes: Now, suppose I have x = runif(1000,0,1, rep(1, 250), rep(0, 100) and I want to create a 'bin' for the 0's and the 1's and put the rest of the values in say about 20 bins. How can this be done? ?cut -- David.

Re: [R] Histogram

2012-07-30 Thread Jim Silverton
I have the following codes: Now, suppose I have x = runif(1000,0,1, rep(1, 250), rep(0, 100) and I want to create a 'bin' for the 0's and the 1's and put the rest of the values in say about 20 bins. How can this be done? Jim On Thu, Jul 5, 2012 at 4:08 PM, Sarah Goslee wrote: > Which gives

Re: [R] histogram of time-stamp data

2012-07-17 Thread e-letter
On 17/07/2012, Rui Barradas wrote: > Hello, > > That's not the error I've had. You must be aware that read.table creates > a data.frame and therefore the object 'timestamps' is NOT holding time > stamps, it's holding a vector, 'V1', of time stamps. > Was not aware of the significance of the data

Re: [R] histogram of time-stamp data

2012-07-17 Thread Rui Barradas
wrote: > -- > > Message: 77 > Date: Mon, 16 Jul 2012 10:48:39 +0100 > From: Rui Barradas > To: e-letter > Cc: r-help@r-project.org > Subject: Re: [R] histogram of time-stamp data > Message-ID: <5003e377.3

Re: [R] histogram of time-stamp data

2012-07-16 Thread e-letter
12 10:48:39 +0100 >> > From: Rui Barradas >> > To: e-letter >> > Cc: r-help@r-project.org >> > Subject: Re: [R] histogram of time-stamp data >> > Message-ID: <5003e377.3000...@sapo.pt> >> > Content-Type: text/plain; cha

Re: [R] histogram of time-stamp data

2012-07-16 Thread Rui Barradas
Hello, Em 16-07-2012 22:45, e-letter escreveu: On 16/07/2012, r-help-requ...@r-project.org wrote: > -- > > Message: 77 > Date: Mon, 16 Jul 2012 10:48:39 +0100 > From: Rui Barradas > To: e-letter > Cc: r-help@r-project.or

Re: [R] histogram of time-stamp data

2012-07-16 Thread e-letter
On 16/07/2012, r-help-requ...@r-project.org wrote: > -- > > Message: 77 > Date: Mon, 16 Jul 2012 10:48:39 +0100 > From: Rui Barradas > To: e-letter > Cc: r-help@r-project.org > Subject: Re: [R] histogram of time-stamp data >

Re: [R] histogram of time-stamp data

2012-07-16 Thread Rui Barradas
Hello, Try the following. timestamps <- as.POSIXct(Sys.Date()) + sample(24*60*60, 1e3, TRUE) h1 <- cut(timestamps, breaks="hour") h2 <- cut(timestamps, breaks="15 mins") op <- par(mfrow=c(1, 2)) hist(as.integer(h1)) hist(as.integer(h2)) par(op) Hope this helps, Rui Barradas Em 16-07-2012

Re: [R] histogram of time-stamp data

2012-07-16 Thread Jessica Streicher
pDates<-as.POSIXct(times,format="%H:%M:%S") > hist(pDates,"hours") On 16.07.2012, at 10:47, e-letter wrote: > Readers, > > A data set consists of time-stamp values: > > 00:00:00 > 23:11:00 > 06:22:00 > > The data set was imported: > > timestamps<-read.table("path/to/timestampsvalues") > hist(

Re: [R] Histogram

2012-07-05 Thread Sarah Goslee
Which gives Jim two ways to arrive at exactly the same result, just different means of specifying the probs for quantile(). Sarah On Thu, Jul 5, 2012 at 4:01 PM, Rui Barradas wrote: > Hello, > > With the confusion between bin size and width the OP started, I'll repost my > answer with a final li

Re: [R] Histogram

2012-07-05 Thread Rui Barradas
Hello, With the confusion between bin size and width the OP started, I'll repost my answer with a final line. Sorry for the repetition. h <- hist(x, breaks=quantile(x, probs=seq(0, 1, by=1/20))) h$counts [1] 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 Hope this helps, Rui B

Re: [R] Histogram

2012-07-05 Thread Duncan Murdoch
On 05/07/2012 3:34 PM, Sarah Goslee wrote: Hi Jim, You can't specify both number of bins and bin size. You can specify breaks: either the number of bins or the location of breakpoints. A histogram with 20 bins of 50 observations each must by definition come from a uniform distribution. Only if

Re: [R] Histogram

2012-07-05 Thread Sarah Goslee
There's no reason you can't do that with normally-distributed data, though I'm not sure why you'd want to. My point was rather that you can't specify the bin width and size both. If you let the bin size vary, this will work: set.seed(1234) mydata <- rnorm(1000, mean = 2, sd = 4) mydata.hist <- his

Re: [R] Histogram

2012-07-05 Thread Rui Barradas
Hello, Try the following. x <- rnorm(1000, mean=2, sd=2) p <- seq(0, 1, by=1/20) quant <- quantile(x, probs=p) hist(x, breaks=quant) The method is absolutely general, that's why I've separated the several steps, to make it clear. Hope this helps, Rui Barradas Em 05-07-2012 20:29, Jim Silv

Re: [R] Histogram

2012-07-05 Thread Sarah Goslee
Hi Jim, You can't specify both number of bins and bin size. You can specify breaks: either the number of bins or the location of breakpoints. A histogram with 20 bins of 50 observations each must by definition come from a uniform distribution. What are you trying to accomplish? Sarah On Thu, Ju

Re: [R] Histogram

2012-07-05 Thread Jim Silverton
I have a column of 1000 datapoints from the normal distribution with mean 2 and variance 4. How can I get a histogram of these observations with 20 bins with each bin having 50 observations? -- Thanks, Jim. [[alternative HTML version deleted]] ___

Re: [R] histogram fill lattice

2012-06-15 Thread David Winsemius
includes "col", so perhaps I'm out of luck? Why didn't you say so ... here ya' go. ?grid.pattern -- David With regards, Jeff -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: woensdag 13 juni 2012 16:40 To: Powell, Jeff Cc: R-help@r-pr

Re: [R] histogram fill lattice

2012-06-15 Thread Powell, Jeff
uck? With regards, Jeff -Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: woensdag 13 juni 2012 16:40 To: Powell, Jeff Cc: R-help@r-project.org Subject: Re: [R] histogram fill lattice On Jun 13, 2012, at 9:55 AM, Powell, Jeff wrote: > > Dear all, > &

Re: [R] histogram fill lattice

2012-06-15 Thread Deepayan Sarkar
On Wed, Jun 13, 2012 at 8:10 PM, David Winsemius wrote: > > On Jun 13, 2012, at 9:55 AM, Powell, Jeff wrote: > >> >> Dear all, >> >> I would like to change the "fill" pattern of a histogram using histogram() >> in the lattice package.  I know how to do so using hist(), but would prefer >> to stay

Re: [R] histogram fill lattice

2012-06-13 Thread David Winsemius
On Jun 13, 2012, at 9:55 AM, Powell, Jeff wrote: Dear all, I would like to change the "fill" pattern of a histogram using histogram() in the lattice package. I know how to do so using hist(), but would prefer to stay within lattice. dt1 <- rnorm(100,0,1) hist(dt1, density=3, angle=45)

Re: [R] Histogram classwise

2012-04-05 Thread Greg Snow
You might want to look at the lattice or ggplot2 packages, both of which can create a graph for each of the classes. On Tue, Apr 3, 2012 at 6:20 AM, arunkumar wrote: > Hi > I have a data class wise. I want to create a histogram class wise without > using for loop as it takes a long time > my

Re: [R] Histogram from a table in R

2012-04-03 Thread Robert Baer
intv = c('0-19','10-19','20-29','30-39') cnts = c(0, 3117, 4500, 2330) barplot(cnts, space=0, names = intv, xlab='Age Range', ylab = 'Counts', main='My Histogram') -Original Message- From: gina_alessa Sent: Tuesday, April 03, 2012 4:08 PM To: r-help@r-project.org Subject: [R] Histogra

Re: [R] Histogram from a table in R

2012-04-03 Thread Peter Alspach
Tena koe Possibly barplot() is what you are after. ?barplot HTH Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of gina_alessa Sent: Wednesday, 4 April 2012 9:08 a.m. To: r-help@r-project.org Subject: [R] Histogr

Re: [R] Histogram classwise

2012-04-03 Thread Sarah Goslee
I'm not entirely sure what you mean, but maybe split() and lapply() would help? Sarah On Tue, Apr 3, 2012 at 8:20 AM, arunkumar wrote: > Hi > I have a data class wise. I want to create a histogram class wise without > using for loop as it takes a long time > my data looks like this > > x    

Re: [R] histogram break width

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 10:12 AM, Sarah Goslee wrote: See below: On Thu, Mar 29, 2012 at 10:05 AM, Vihan Pandey wrote: Hi all, I am generating histograms with the following R script : #!/usr/bin/Rscript out_file = "histo.png" png(out_file) scan("values.csv") -> myvalues hist(myvalues, brea

Re: [R] histogram break width

2012-03-29 Thread Sarah Goslee
See below: On Thu, Mar 29, 2012 at 10:05 AM, Vihan Pandey wrote: > Hi all, > > I am generating histograms with the following R script : > > #!/usr/bin/Rscript > > out_file = "histo.png" > png(out_file) > > scan("values.csv") -> myvalues > hist(myvalues, breaks = 50) > > dev.off() > > print(paste(

Re: [R] histogram

2012-02-06 Thread David Winsemius
On Feb 6, 2012, at 9:46 PM, Francis Keyes wrote: ok here are two 1-column data files. sample1 and sampleRef (the reference distribution) > dat1 <- read.table(file="~/Downloads/sample1") > datRef <- read.table(file="~/Downloads/sampleRef") > str(dat1) 'data.frame': 11378 obs. of 1 variabl

Re: [R] histogram

2012-02-06 Thread David Winsemius
On Feb 6, 2012, at 5:26 PM, Francis Keyes wrote: Hi David, I have 2 tables, each with several columns and rows of data. I am only interested in the data from column 6, which contains values in the range -PI to PI. I want to plot the data from tableD with the y axis denoting percentage with r

Re: [R] histogram

2012-02-06 Thread Francis Keyes
Hi David, I have 2 tables, each with several columns and rows of data. I am only interested in the data from column 6, which contains values in the range -PI to PI. I want to plot the data from tableD with the y axis denoting percentage with respect to tableR. So if data points in the break 2 -

Re: [R] histogram

2012-02-06 Thread David Winsemius
On Feb 6, 2012, at 12:23 PM, Francis Keyes wrote: Thanks. How do you suggest I use the reference population? Sorry, I'm new to R and just don't see it. If i can get a plot that is counts or density relative to my reference data it would be ideal. It is difficult to specify "how" when we

Re: [R] histogram

2012-02-06 Thread Francis Keyes
Thanks. How do you suggest I use the reference population? Sorry, I'm new to R and just don't see it. If i can get a plot that is counts or density relative to my reference data it would be ideal. On Mon, Feb 6, 2012 at 1:12 AM, David Winsemius wrote: > > On Feb 5, 2012, at 8:31 PM, Francis Ke

Re: [R] histogram

2012-02-05 Thread David Winsemius
On Feb 5, 2012, at 8:31 PM, Francis Keyes wrote: 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? hist() returns an object with both "counts" and "densit

Re: [R] Histogram: plot by group

2012-01-03 Thread Jim Lemon
> I want to make a histogram in R of the data in attached excel file called > 'cbt'. However, I need the histogram to show a separation for Group 1 and > Group 2, as in attached image. > > How do I do this in R? I know how to make a histogram for a single group, > but how can I separate the 2 group

Re: [R] Histogram: plot by group

2012-01-03 Thread ONKELINX, Thierry
Nameless, http://had.co.nz/ggplot2/geom_histogram.html has a few examples ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium thierry.

Re: [R] Histogram omitting/collapsing groups

2012-01-01 Thread Aren Cambre
Thanks. That did it! And I get it now--in your original example, aes(x = x, y = Freq), x refers to the column name in as.data.frame(table(x)), not the x vector(?) you created. Aren On Sun, Jan 1, 2012 at 4:44 PM, Joshua Wiley wrote: > Sorry, that was probably a really confusing example...too ma

Re: [R] Histogram omitting/collapsing groups

2012-01-01 Thread Joshua Wiley
Sorry, that was probably a really confusing example...too many xs floating around. set.seed(10) rawdata <- sample(0:23, 1, TRUE, prob = sin(0:23)+1) ## do theis step first for your data tableddata <- as.data.frame(table(rawdata)) ## use these names in ggplot colnames(tableddata) require(ggpl

Re: [R] Histogram omitting/collapsing groups

2012-01-01 Thread Aren Cambre
This is helpful, although I can't seem to adapt it to my own data. If I run your sample as is, I do get the nice graphs. However, this doesn't work: (Assume you already have a data frame "dallas" with 2057980 rows. It has column "offense_hour", and each row has a value between 0 and 23, inclusive

Re: [R] Histogram omitting/collapsing groups

2012-01-01 Thread Joshua Wiley
Hi Aren, I was busy thinking about how to make what you wanted, and I missed that you were working with hours from a day. That being the case, you may think about a circular graph. The attached plots show two different ways of working with the same data. Cheers, Josh set.seed(10) x <- sample(

Re: [R] Histogram omitting/collapsing groups

2012-01-01 Thread Aren Cambre
On Sun, Jan 1, 2012 at 5:29 AM, peter dalgaard wrote: > Exactly. If what you want is a barplot, make a barplot; histograms are for > continuous data.   Just remember that you may need to set the levels > explicitly in case of empty groups: barplot(table(factor(x,levels=0:23))). > (This is irrel

Re: [R] Histogram omitting/collapsing groups

2012-01-01 Thread peter dalgaard
On Jan 1, 2012, at 07:40 , Joshua Wiley wrote: > If you just want a plot of the frequencies at each hour why not just call > barplot on the output of table? Histograms create bins and count in those, > which doesn't sound like what you're after. > Exactly. If what you want is a barplot, make

Re: [R] Histogram omitting/collapsing groups

2011-12-31 Thread Joshua Wiley
If you just want a plot of the frequencies at each hour why not just call barplot on the output of table? Histograms create bins and count in those, which doesn't sound like what you're after. Cheers, Josh On Dec 31, 2011, at 21:37, jim holtman wrote: > Fast fingers; notice that there is s

  1   2   3   >