shahab
2016-Mar-17 18:01 UTC
[R] Warning message: Computation failed in `stat_bin()`: attempt to apply non-function
Hi, I am trying to plot a sample dataset using ggplot2, but I am keep getting the following error message and an empty plot! Apparently something is wrong in the dataset, but what? R : pf<-read.csv('pseudo_facebook.tsv', sep='\t') ggplot(x=aes(friend_count), data=pf) + geom_histogram() stat_bin()` using `bins = 30`. Pick better value with `binwidth`. Warning message: Computation failed in `stat_bin()`: attempt to apply non-function The dataset can be found at : https://s3.amazonaws.com/udacity-hosted-downloads/ud651/pseudo_facebook.tsv thanks, /Shahab [[alternative HTML version deleted]]
John Kane
2016-Mar-18 16:39 UTC
[R] Warning message: Computation failed in `stat_bin()`: attempt to apply non-function
> ggplot(x=aes(friend_count), data=pf) + geom_histogram()The x= in the above statement is wrong ggplot(aes(friend_count), data=pf) + geom_histogram() will work but it looks funny. The more common way to write the command would likely be: ggplot(pf, aes(friend_count)) + geom_histogram() The tat_bin() message is just a warning. Your data set has ~ 99,000 rows of data and geom_histogram() 's default is 30 bins which is probably too few to for you to see what is happening. Come to Change the default binwidth to something a bit more manageable or perhaps use geom_density() to look at the distribution. John Kane Kingston ON Canada> -----Original Message----- > From: shahab.mokari at gmail.com > Sent: Thu, 17 Mar 2016 19:01:19 +0100 > To: r-help at r-project.org > Subject: [R] Warning message: Computation failed in `stat_bin()`: attempt > to apply non-function > > Hi, > > I am trying to plot a sample dataset using ggplot2, but I am keep getting > the following error message and an empty plot! > Apparently something is wrong in the dataset, but what? > > R : > pf<-read.csv('pseudo_facebook.tsv', sep='\t') > > ggplot(x=aes(friend_count), data=pf) + geom_histogram() > > stat_bin()` using `bins = 30`. Pick better value with `binwidth`. > Warning message: > Computation failed in `stat_bin()`: > attempt to apply non-function > > The dataset can be found at : > https://s3.amazonaws.com/udacity-hosted-downloads/ud651/pseudo_facebook.tsv > > thanks, > /Shahab > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.____________________________________________________________ FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!
shahab
2016-Mar-18 18:01 UTC
[R] Warning message: Computation failed in `stat_bin()`: attempt to apply non-function
Thanks all for the help. Yes it works now, my stupid mistake. On Friday, 18 March 2016, John Kane <jrkrideau at inbox.com> wrote:> > ggplot(x=aes(friend_count), data=pf) + geom_histogram() > > The x= in the above statement is wrong > > ggplot(aes(friend_count), data=pf) + geom_histogram() > will work but it looks funny. > > > The more common way to write the command would likely be: > ggplot(pf, aes(friend_count)) + geom_histogram() > > > The tat_bin() message is just a warning. > Your data set has ~ 99,000 rows of data and geom_histogram() 's default is > 30 bins which is probably too few to for you to see what is happening. > Come to > > Change the default binwidth to something a bit more manageable or perhaps > use geom_density() to look at the distribution. > > John Kane > Kingston ON Canada > > > > -----Original Message----- > > From: shahab.mokari at gmail.com <javascript:;> > > Sent: Thu, 17 Mar 2016 19:01:19 +0100 > > To: r-help at r-project.org <javascript:;> > > Subject: [R] Warning message: Computation failed in `stat_bin()`: attempt > > to apply non-function > > > > Hi, > > > > I am trying to plot a sample dataset using ggplot2, but I am keep getting > > the following error message and an empty plot! > > Apparently something is wrong in the dataset, but what? > > > > R : > > pf<-read.csv('pseudo_facebook.tsv', sep='\t') > > > > ggplot(x=aes(friend_count), data=pf) + geom_histogram() > > > > stat_bin()` using `bins = 30`. Pick better value with `binwidth`. > > Warning message: > > Computation failed in `stat_bin()`: > > attempt to apply non-function > > > > The dataset can be found at : > > > https://s3.amazonaws.com/udacity-hosted-downloads/ud651/pseudo_facebook.tsv > > > > thanks, > > /Shahab > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at r-project.org <javascript:;> 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. > > ____________________________________________________________ > FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop! > Check it out at http://www.inbox.com/earth > > >[[alternative HTML version deleted]]