Frederic Ntirenganya
2014-Aug-05 11:33 UTC
[R] object of type 'closure' is not subsettable
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]]
On Tue, Aug 5, 2014 at 7:33 AM, Frederic Ntirenganya <ntfredo at gmail.com> wrote:> Dear All, > > I am getting this error: Error in boxplot$Month : object of type 'closure' > is not subsettableprobably because your dataframe is box_plot while boxplot is the name of a function. Try box_plot$Month Sarah> 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. >-- Sarah Goslee http://www.functionaldiversity.org
"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:<jdnewmil at 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 <ntfredo at
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 at 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.