Dear Shivi

On 17/06/2015 13:15, Shivi82 wrote:
Hi Petr,

The solution you shared worked though it does not show any decimal values.
The output is
Group.1             x
1    1/1/2015    309450
2   1/10/2015   332780

Instead of mean i used sum & i think that should be fine.
aggr<-aggregate(retail$weight,list(retail$ship.date),function(x)
round(sum(x,0)))


That adds all the elements of x and zero and then rounds it

So if i change above code to x,1 it changes values to

That will add all the elements of x and unity and then round it. Notice that your result has increased by unity each time.

I think you meant to write round(sum(x), 0) or round(sum(x), 1) as the case may be

Group.1             x
1    1/1/2015    309451
2   1/10/2015   332781

Thanks, Shivi




--
View this message in context: 
http://r.789695.n4.nabble.com/Restricting-Decimal-Places-in-the-Output-tp4708739p4708755.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@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.


--
Michael
http://www.dewey.myzen.co.uk/home.html

______________________________________________
R-help@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.

Reply via email to