In this sort of post it would help if we knew the package that was being used for the example. I found one option. https://cran.r-project.org/web/packages/pivottabler/vignettes/v00-vignettes.html
There may be a way to create a custom data type that would be a date but restricted to a yyyy-mm format. I do not know how to do this. Could you work with the date as a string with a yyyy-mm format. The issue is that R will not handle the string as a date. A third option would be to look at the lubridate package that can be installed by itself or as part of tidyverse. I do not promise that this is a solution, but it could be. -----Original Message----- From: R-help <r-help-boun...@r-project.org> On Behalf Of John Kane Sent: Saturday, September 30, 2023 7:11 AM To: Rui Barradas <ruipbarra...@sapo.pt> Cc: Paul Bernal <paulberna...@gmail.com>; R <r-help@r-project.org> Subject: Re: [R] Grouping by Date and showing count of failures by date [External Email] To follow up on Rui Barradas's post, I do not think PivotTable is an R command. You may be thinking og the "pivot_longer" and "pivot_wider" functions in the {tidyr} package which is part of {tidyverse}. On Sat, 30 Sept 2023 at 07:03, Rui Barradas <ruipbarra...@sapo.pt> wrote: > Às 21:29 de 29/09/2023, Paul Bernal escreveu: > > Dear friends, > > > > Hope you are doing great. I am attaching the dataset I am working > > with because, when I tried to dput() it, I was not able to copy the > > entire result from dput(), so I apologize in advance for that. > > > > I am interested in creating a column named Failure_Date_Period that > > has > the > > FAILDATE but formatted as YYYY_MM. Then I want to count the number > > of failures (given by column WONUM) and just have a dataframe that > > has the FAILDATE and the count of WONUM. > > > > I tried this: > > pt <- PivotTable$new() > > pt$addData(failuredf) > > pt$addColumnDataGroups("FAILDATE") > > pt <- PivotTable$new() > > pt$addData(failuredf) > > pt$addColumnDataGroups("FAILDATE") > > pt$defineCalculation(calculationName = "FailCounts", > > summariseExpression="n()") > > pt$renderPivot() > > > > but I was not successful. Bottom line, I need to create a new > > dataframe that has the number of failures by FAILDATE, but in YYYY-MM > > format. > > > > Any help and/or guidance will be greatly appreciated. > > > > Kind regards, > > Paul > > ______________________________________________ > > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://st/ > > at.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=05%7C01%7Ctebert%40ufl > > .edu%7C7647cf60560f40177c9908dbc1a63d9a%7C0d4da0f84a314d76ace60a6233 > > 1e1b84%7C0%7C0%7C638316691975258863%7CUnknown%7CTWFpbGZsb3d8eyJWIjoi > > MC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C > > %7C%7C&sdata=LNhXDb%2Bv5MGVc9SiL7KrJCMvD1Wkp4pQ14iScfZqxtk%3D&reserv > > ed=0 > > PLEASE do read the posting guide > http://www.r/ > -project.org%2Fposting-guide.html&data=05%7C01%7Ctebert%40ufl.edu%7C76 > 47cf60560f40177c9908dbc1a63d9a%7C0d4da0f84a314d76ace60a62331e1b84%7C0% > 7C0%7C638316691975258863%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiL > CJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=I8 > QM8BE7EdpXzfFuwe93IqqL4JS7wWGgfr24XRH5LHs%3D&reserved=0 > > and provide commented, minimal, self-contained, reproducible code. > Hello, > > No data is attached. Maybe try > > dput(head(failuredf, 30)) > > ? > > And where can we find non-base PivotTable? Please start the scripts > with calls to library() when using non-base functionality. > > Hope this helps, > > Rui Barradas > > > -- > Este e-mail foi analisado pelo software antivírus AVG para verificar a > presença de vírus. > http://www.a/ > vg.com%2F&data=05%7C01%7Ctebert%40ufl.edu%7C7647cf60560f40177c9908dbc1 > a63d9a%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638316691975258863 > %7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6I > k1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=zBgPdOLZNvCOa4n2GXWWjLh4wg > 3L4TdGXBMaGJ6n%2BsI%3D&reserved=0 > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat/ > .ethz.ch%2Fmailman%2Flistinfo%2Fr-help&data=05%7C01%7Ctebert%40ufl.edu > %7C7647cf60560f40177c9908dbc1a63d9a%7C0d4da0f84a314d76ace60a62331e1b84 > %7C0%7C0%7C638316691975258863%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw > MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sda > ta=LNhXDb%2Bv5MGVc9SiL7KrJCMvD1Wkp4pQ14iScfZqxtk%3D&reserved=0 > PLEASE do read the posting guide > http://www.r/ > -project.org%2Fposting-guide.html&data=05%7C01%7Ctebert%40ufl.edu%7C76 > 47cf60560f40177c9908dbc1a63d9a%7C0d4da0f84a314d76ace60a62331e1b84%7C0% > 7C0%7C638316691975258863%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiL > CJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=I8 > QM8BE7EdpXzfFuwe93IqqL4JS7wWGgfr24XRH5LHs%3D&reserved=0 > and provide commented, minimal, self-contained, reproducible code. > -- John Kane Kingston ON Canada [[alternative HTML version deleted]] ______________________________________________ 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. ______________________________________________ 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.