[R] Help on Histogram ~ Barplot

David Winsemius dwinsemius at comcast.net
Thu May 28 17:00:18 CEST 2015

Adding back context which was omitted by this Nabble user who still does not understand the mailing list conventions:

> On May 27, 2015, at 2:28 AM, Shivi82 wrote:
>> Hello All,
>> I need help on creating a histogram for one of my data. The data is as below
>> (sample):
>> MFST_WT	Hours	PROCESS	Month	Weekday	Day of the Month
>> 6,828	13	       INBOUND	Mar	             Fri	13
>> 2,504	16	       INBOUND	Mar	             Fri	27
>> 20	        16	       INBOUND	Mar	             Fri	27
>> 10,262	16	       INBOUND	Mar	             Fri	27
>> 2,500	17	       INBOUND	Mar	             Fri	13
>> 3,938	16	       INBOUND	Feb	            Thu	26
>> 798	        10	       INBOUND	Feb	            Sat	14
>> 5,439	15	       INBOUND	Feb	            Mon	16
> D.Winsemius wrote:
> What I'm seeing here is the likelihood that the data object has been input incorrectly (or is a mess in the original file?) There appear to be commas in what would presumably be a numeric column and a column name with spaces in it. There is also misregistration of some lines of data possible with tab-characters that were eaten by Nabble's interface.  If you want help under these circumstances you should either respond with the first 20 lines of the original data file posted through a mail-client bypassing Nabble or post dput( head(objname, 20))

On May 28, 2015, at 6:13 AM, Shivi82 wrote:

> HI David,
> So if I understand from your post below, when we import a file in R- we need
> to make sure that the variable names do not have any space nor they should
> be in special characters or not in comma format.

Well .... perhaps. I asked to see the first several lines of the data. If it really were a csv file, then there should not have been any commas in the first column when the R data-object was printed. Any spaces in the header row should have been converted to periods. That's what the `make.names` function does when it encounters spaces or special characters.


> Please correct me I am wrong.
> Now I have changed the file to a new file as RData.csv file and now when I
> use the below code it gives me an error 
> graph<- read.csv("RData.csv", header = TRUE)
> MonthlyWeight<-by(RData$Weight,names.arg = RData$Month,sum)
> The error is : Error in by(RData$Weight, names.arg = RData$Month, sum) : 
>  object 'RData' not found. Whereas I checked using "getwd()" this file is
> saved in the working directory. 
> Please suggest. 
> --
> View this message in context: http://r.789695.n4.nabble.com/Help-on-Histogram-Barplot-tp4707739p4707839.html
> Sent from the R help mailing list archive at Nabble.com.
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

More information about the R-help mailing list