Thank you very much for the support. I have just used the reshape library and my problem was solved. Kind regards, Peter -----Original Message----- From: Jeff Newmiller [mailto:jdnewmil at dcn.davis.ca.us] Sent: 10 July 2017 03:52 PM To: r-help at r-project.org; Mangalani Peter Makananisa; r-help at r-project.org Cc: Vito Ricci (vito_ricci at yahoo.com) Subject: Re: [R] dplyr help I am pretty sure that this is not a question about dplyr... it is a question about tidyr. Look at the help file ?tidyr::spread. If I understand your question (I may not, because you gave no example of input/output data), the answer is no, the column names come from the column named by the key parameter and the values that fill those columns come from the column named by the value parameter. Modify your data frame to contain both columns before using this function. When the function is used outside a pipe chain there is also the first argument, the data frame that is being reshaped. Please post using plain text in the future... this is a plain text mailing list, and HTML email is what-you-see-is-not-what-we-see. -- Sent from my phone. Please excuse my brevity. On July 10, 2017 1:29:41 AM PDT, Mangalani Peter Makananisa <pmakananisa at sars.gov.za> wrote:>HI all, > >Is it possible to use one column spread on multiple columns values. > >example >spread( Key_col, value1:value7) > >spreading Key_col to variable value1, value2, ....... Value7 > >Please advise, > >Kind regards > >Mangalani Peter Makananisa (5786) >South African Revenue Service (SARS) - HO >+2782 456 4669 / +2712 422 7357 > >Please Note: This email and its contents are subject to our email legal >notice which can be viewed at >http://www.sars.gov.za/Pages/Email-disclaimer.aspx > > [[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.Please Note: This email and its contents are subject to our email legal notice which can be viewed at http://www.sars.gov.za/Pages/Email-disclaimer.aspx [[alternative HTML version deleted]]
A better thanks would be to post the solution that met your needs... particularly since in spite of our efforts it appears we may not have understood your problem. A small sample data set generated with dput along with your code would be helpful in making sure others learn along with you. -- Sent from my phone. Please excuse my brevity. On July 11, 2017 12:56:45 AM PDT, Mangalani Peter Makananisa <pmakananisa at sars.gov.za> wrote:>Thank you very much for the support. I have just used the reshape >library and my problem was solved. > >Kind regards, > >Peter > >-----Original Message----- >From: Jeff Newmiller [mailto:jdnewmil at dcn.davis.ca.us] >Sent: 10 July 2017 03:52 PM >To: r-help at r-project.org; Mangalani Peter Makananisa; >r-help at r-project.org >Cc: Vito Ricci (vito_ricci at yahoo.com) >Subject: Re: [R] dplyr help > >I am pretty sure that this is not a question about dplyr... it is a >question about tidyr. Look at the help file ?tidyr::spread. > >If I understand your question (I may not, because you gave no example >of input/output data), the answer is no, the column names come from the >column named by the key parameter and the values that fill those >columns come from the column named by the value parameter. Modify your >data frame to contain both columns before using this function. > >When the function is used outside a pipe chain there is also the first >argument, the data frame that is being reshaped. > >Please post using plain text in the future... this is a plain text >mailing list, and HTML email is what-you-see-is-not-what-we-see. >-- >Sent from my phone. Please excuse my brevity. > >On July 10, 2017 1:29:41 AM PDT, Mangalani Peter Makananisa ><pmakananisa at sars.gov.za> wrote: >>HI all, >> >>Is it possible to use one column spread on multiple columns values. >> >>example >>spread( Key_col, value1:value7) >> >>spreading Key_col to variable value1, value2, ....... Value7 >> >>Please advise, >> >>Kind regards >> >>Mangalani Peter Makananisa (5786) >>South African Revenue Service (SARS) - HO >>+2782 456 4669 / +2712 422 7357 >> >>Please Note: This email and its contents are subject to our email >legal >>notice which can be viewed at >>http://www.sars.gov.za/Pages/Email-disclaimer.aspx >> >> [[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. > >Please Note: This email and its contents are subject to our email legal >notice which can be viewed at >http://www.sars.gov.za/Pages/Email-disclaimer.aspx
Hi all, I have just used the reshape library and not dplyr to addressed the problem on the emails below, see the attached pdf document. Regards, Peter -----Original Message----- From: Jeff Newmiller [mailto:jdnewmil at dcn.davis.ca.us] Sent: 11 July 2017 01:45 PM To: Mangalani Peter Makananisa; r-help at r-project.org Cc: Vito Ricci (vito_ricci at yahoo.com) Subject: RE: [R] dplyr help A better thanks would be to post the solution that met your needs... particularly since in spite of our efforts it appears we may not have understood your problem. A small sample data set generated with dput along with your code would be helpful in making sure others learn along with you. -- Sent from my phone. Please excuse my brevity. On July 11, 2017 12:56:45 AM PDT, Mangalani Peter Makananisa <pmakananisa at sars.gov.za> wrote:>Thank you very much for the support. I have just used the reshape >library and my problem was solved. > >Kind regards, > >Peter > >-----Original Message----- >From: Jeff Newmiller [mailto:jdnewmil at dcn.davis.ca.us] >Sent: 10 July 2017 03:52 PM >To: r-help at r-project.org; Mangalani Peter Makananisa; >r-help at r-project.org >Cc: Vito Ricci (vito_ricci at yahoo.com) >Subject: Re: [R] dplyr help > >I am pretty sure that this is not a question about dplyr... it is a >question about tidyr. Look at the help file ?tidyr::spread. > >If I understand your question (I may not, because you gave no example >of input/output data), the answer is no, the column names come from the >column named by the key parameter and the values that fill those >columns come from the column named by the value parameter. Modify your >data frame to contain both columns before using this function. > >When the function is used outside a pipe chain there is also the first >argument, the data frame that is being reshaped. > >Please post using plain text in the future... this is a plain text >mailing list, and HTML email is what-you-see-is-not-what-we-see. >-- >Sent from my phone. Please excuse my brevity. > >On July 10, 2017 1:29:41 AM PDT, Mangalani Peter Makananisa ><pmakananisa at sars.gov.za> wrote: >>HI all, >> >>Is it possible to use one column spread on multiple columns values. >> >>example >>spread( Key_col, value1:value7) >> >>spreading Key_col to variable value1, value2, ....... Value7 >> >>Please advise, >> >>Kind regards >> >>Mangalani Peter Makananisa (5786) >>South African Revenue Service (SARS) - HO >>+2782 456 4669 / +2712 422 7357 >> >>Please Note: This email and its contents are subject to our email >legal >>notice which can be viewed at >>http://www.sars.gov.za/Pages/Email-disclaimer.aspx >> >> [[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. > >Please Note: This email and its contents are subject to our email legal >notice which can be viewed at >http://www.sars.gov.za/Pages/Email-disclaimer.aspxPlease Note: This email and its contents are subject to our email legal notice which can be viewed at http://www.sars.gov.za/Pages/Email-disclaimer.aspx -------------- next part -------------- A non-text attachment was scrubbed... Name: regw solution.pdf Type: application/pdf Size: 143443 bytes Desc: regw solution.pdf URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20170711/7fc2edf2/attachment.pdf>