I have a vector of values (about 8000 obs between 0 and 1). I want to display a histogram as follows: value of vector ( bw 0 and 1) | | | | | |______________________________________ all 8000 obs. So that each section of the x axis corresponds to a certain value... When I use hist(vector) it outputs out a frequency histogram. I tried transposing it with no luck. Any ideas?? Also, I'm told I have a missing value in my vector, how do I remove that observation??? (i.e. how do I search within my vector to find it???) thank you in advance,,,, [[alternative HTML version deleted]]
Augusto.Sanabria at ga.gov.au
2006-Apr-04 23:06 UTC
[R] DISPLAYING A HISTOGRAM + finding NAs
Mark, To solve your problem I would get rid of missing values in the obs vector 'obsv' first: obsv <- obsv[!is.na(obsv)] I would then set up the x-axis: xval <- max(obsv) Then I would plot a probabilistic histogram: Hist(obsv,breaks=xval,freq=FALSE) Notice that the probabilities in the y-axis are calc. as: prob yi = Freq obs(i)/(all obs) Hope it helps. Augusto -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of mark salsburg Sent: Wednesday, 5 April 2006 3:59 AM To: R-help at stat.math.ethz.ch Subject: [R] DISPLAYING A HISTOGRAM + finding NAs I have a vector of values (about 8000 obs between 0 and 1). I want to display a histogram as follows: value of vector ( bw 0 and 1) | | | | | |______________________________________ all 8000 obs. So that each section of the x axis corresponds to a certain value... When I use hist(vector) it outputs out a frequency histogram. I tried transposing it with no luck. Any ideas?? Also, I'm told I have a missing value in my vector, how do I remove that observation??? (i.e. how do I search within my vector to find it???) thank you in advance,,,, [[alternative HTML version deleted]] ______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Seemingly Similar Threads
- Histograms, density, and relative frequencies
- pipe data from plot(). was: ROCR.plot methods, cross validation averaging
- histogram with NAs
- function to display histogram fails to do so when histogram is not the last expression in the function
- Scaling Statistical