The major problem is that I am using the same code in another dataset and
it is working perfectly.

I do not understand why in this dataset (bungoma_rain) is not working. The
following is the new code I have:

## reading the data
rm(list=ls(all=TRUE))
Bungoma=read.csv("/home/fredo/Documents/Maseno/Data/Bungoma_2.csv")
attach(Bungoma)
head(Bungoma)
tail(Bungoma)
summary(Bungoma)
# removing missing values
Bungoma <- na.omit(Bungoma)
summary(Bungoma)

###### split the data by month and boxplot for 0.85mm as the threshold
rain_bungoma=Bungoma[Bungoma$Rain>0.85,]
head(rain_bungoma)
bungoma_rain=split(rain_bungoma$Rain,rain_bungoma$Month)
head(bungoma_rain)

boxplot(bungoma_rain,
names=c("J","F","M","A","M","J","J","A","S","O","N","D"),width =
table(boxplot$Month))
title(main="Boxplot of Rain for each month")
#####################################################################

The error is :

> boxplot(bungoma_rain, 
> names=c("J","F","M","A","M","J","J","A","S","O","N","D"),width = 
> table(boxplot$Month))Error in boxplot$Month : object of type 'closure' is not 
> subsettable

>

Thanks for your help.


On Wed, Aug 6, 2014 at 8:50 AM, Frederic Ntirenganya <ntfr...@gmail.com>
wrote:

> Thanks for the idea.
>
> I tried by changing avoiding confusion about boxplot function but I still
> have the same problem.
>
> > boxplot(bungoma_rain, 
> > names=c("J","F","M","A","M","J","J","A","S","O","N","D"),width = 
> > table(boxplot$Month))
> Error in boxplot$Month : object of type 'closure' is not subsettable
>
>
>
> On Tue, Aug 5, 2014 at 7:12 PM, Jeff Newmiller <jdnew...@dcn.davis.ca.us>
> wrote:
>
>> "boxplot" is a function ("closure"). You probably meant
>> "bungoma_boxplot$Month"?
>>
>> Please read the Posting Guide. One point it mentions is that this is a
>> plain text mailing list... HTML format email is not a
>> what-you-see-is-what-we-see format.
>>
>> ---------------------------------------------------------------------------
>> Jeff Newmiller                        The     .....       .....  Go
>> Live...
>> DCN:<jdnew...@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live
>> Go...
>>                                       Live:   OO#.. Dead: OO#..  Playing
>> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
>> /Software/Embedded Controllers)               .OO#.       .OO#.
>>  rocks...1k
>>
>> ---------------------------------------------------------------------------
>> Sent from my phone. Please excuse my brevity.
>>
>> On August 5, 2014 4:33:33 AM PDT, Frederic Ntirenganya <ntfr...@gmail.com>
>> wrote:
>> >Dear All,
>> >
>> >I am getting this error: Error in boxplot$Month : object of type
>> >'closure'
>> >is not subsettable
>> >
>> >The following is the codes i am using to produce the boxplot I need for
>> >this daily rainfall data.
>> >
>> >## reading the data
>> >rm(list=ls(all=TRUE))
>> >Bungoma=read.csv("/home/fredo/Documents/Maseno/Data/Bungoma_2.csv")
>> >attach(Bungoma)
>> >head(Bungoma)
>> >tail(Bungoma)
>> >summary(Bungoma)
>> ># removing missing values
>> >Bungoma <- na.omit(Bungoma)
>> >summary(Bungoma)
>> >###### split the data by month and boxplot for 0.85mm as the threshold
>> >box_plot=Bungoma[Bungoma$Rain>0.85,]
>> >head(box_plot)
>> >bungoma_boxplot=split(box_plot$Rain,box_plot$Month)
>> >head(bungoma_boxplot)
>> >boxplot(bungoma_boxplot,
>> >names=c("J","F","M","A","M","J","J","A","S","O","N","D"),width =
>> >table(boxplot$Month))
>> >title(main="Boxplot of Rain for each month")
>> >
>> >Any idea is welcome on how I can make it and overcome the error.
>> >Thanks.
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> >______________________________________________
>> >R-help@r-project.org mailing list
>> >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.
>>
>>
>
>
> --
> Frederic Ntirenganya
> Maseno University,
> Kenya.
> Mobile:(+254)718492836
> Email: fr...@aims.ac.za
> https://sites.google.com/a/aims.ac.za/fredo/
>



-- 
Frederic Ntirenganya
Maseno University,
Kenya.
Mobile:(+254)718492836
Email: fr...@aims.ac.za
https://sites.google.com/a/aims.ac.za/fredo/

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
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.

Reply via email to