Can the use of return() after a magrittr pipeline to write an object break something?how to feed the result of a pipe chain (magrittr) to an objectUse $ dollar sign at end of of an R magrittr pipeline to return a vectordata.table vs dplyr: can one do something well the other can't or does poorly?how to feed the result of a pipe chain (magrittr) to an objectmagrittr and date objectsHow to build a pipeline from data.table to magrittr and back to data.tableHow to write a subsetting operation in magrittr/dplyr: x[!is.na(x)]How can I achieve partial application of a function before using it within a magrittR pipeline?Writing non-standard evaluation syntax with use of magrittr reverse pipeUse $ dollar sign at end of of an R magrittr pipeline to return a vectorHow to call an element of an object created with a magrittr pipe?enquo() inside a magrittr pipeline

There is only s̶i̶x̶t̶y one place he can be

What defines a dissertation?

Curses work by shouting - How to avoid collateral damage?

What would be the benefits of having both a state and local currencies?

How will losing mobility of one hand affect my career as a programmer?

apt-get update is failing in debian

Have I saved too much for retirement so far?

Time travel short story where a man arrives in the late 19th century in a time machine and then sends the machine back into the past

The baby cries all morning

Hide Select Output from T-SQL

Bash method for viewing beginning and end of file

How to be diplomatic in refusing to write code that breaches the privacy of our users

Can I convert a rim brake wheel to a disc brake wheel?

Opposite of a diet

Should my PhD thesis be submitted under my legal name?

What will be the benefits of Brexit?

HashMap containsKey() returns false although hashCode() and equals() are true

Print name if parameter passed to function

Cynical novel that describes an America ruled by the media, arms manufacturers, and ethnic figureheads

Valid Badminton Score?

What to do with wrong results in talks?

How does residential electricity work?

Will it be accepted, if there is no ''Main Character" stereotype?

What are the ramifications of creating a homebrew world without an Astral Plane?



Can the use of return() after a magrittr pipeline to write an object break something?


how to feed the result of a pipe chain (magrittr) to an objectUse $ dollar sign at end of of an R magrittr pipeline to return a vectordata.table vs dplyr: can one do something well the other can't or does poorly?how to feed the result of a pipe chain (magrittr) to an objectmagrittr and date objectsHow to build a pipeline from data.table to magrittr and back to data.tableHow to write a subsetting operation in magrittr/dplyr: x[!is.na(x)]How can I achieve partial application of a function before using it within a magrittR pipeline?Writing non-standard evaluation syntax with use of magrittr reverse pipeUse $ dollar sign at end of of an R magrittr pipeline to return a vectorHow to call an element of an object created with a magrittr pipe?enquo() inside a magrittr pipeline













0















I often have to manually clean up entries in datasets.
For flexibility and readability, I like to use pipes.
Sometimes I later come across another thing I need to clean up, so I keep a copy-paste'able line in my magrittr pipeline.



In ggplot2, calling an empty theme() at the end helps me to keep coding flexible for later additions. I never encountered problems with that and thought I could do the same with return() in a pipeline.



I think return() is not be meant to use outside functions, so: is there a conceivable way this could break my code?



I also stumbled upon . ans an alternative, but I don't really know what it does and searching info (even using advanced search on SO) is not helping.



Example:



starwars %<>% 
mutate(hair_color = ifelse(name == "Captain Phasma", "blond", hair_color)) %>%
mutate(skin_color = ifelse(name == "Captain Phasma", "fair", hair_color)) %>%
mutate(hair_color = ifelse(name == "Zam Wesell", "blond", hair_color)) %>%
#mutate(var = ifelse(name == "cond", "replacement", var)) %>% ### for future c/p
return() #


NB: I realise this is borderline the tag "coding-style", so I like point out I'm not interested in an opinion-based discussion but advice if this could break my code in certain circumstances. Examples where it does break code are welcome, as are alternative suggestions.



I think these topics/threads are related:




  • https://github.com/tidyverse/magrittr/issues/32

  • Use $ dollar sign at end of of an R magrittr pipeline to return a vector

  • how to feed the result of a pipe chain (magrittr) to an object









share|improve this question

















  • 1





    Well, it might break as soon as the first example in issue 32 returns a different result, i.e., the issue gets fixed. I believe . just calls the { function. You could probably also use identity instead.

    – Roland
    Mar 8 at 9:44






  • 1





    for your purpose, identity indeed is the appropriate function rather than return

    – RolandASc
    Mar 8 at 10:01















0















I often have to manually clean up entries in datasets.
For flexibility and readability, I like to use pipes.
Sometimes I later come across another thing I need to clean up, so I keep a copy-paste'able line in my magrittr pipeline.



In ggplot2, calling an empty theme() at the end helps me to keep coding flexible for later additions. I never encountered problems with that and thought I could do the same with return() in a pipeline.



I think return() is not be meant to use outside functions, so: is there a conceivable way this could break my code?



I also stumbled upon . ans an alternative, but I don't really know what it does and searching info (even using advanced search on SO) is not helping.



Example:



starwars %<>% 
mutate(hair_color = ifelse(name == "Captain Phasma", "blond", hair_color)) %>%
mutate(skin_color = ifelse(name == "Captain Phasma", "fair", hair_color)) %>%
mutate(hair_color = ifelse(name == "Zam Wesell", "blond", hair_color)) %>%
#mutate(var = ifelse(name == "cond", "replacement", var)) %>% ### for future c/p
return() #


NB: I realise this is borderline the tag "coding-style", so I like point out I'm not interested in an opinion-based discussion but advice if this could break my code in certain circumstances. Examples where it does break code are welcome, as are alternative suggestions.



I think these topics/threads are related:




  • https://github.com/tidyverse/magrittr/issues/32

  • Use $ dollar sign at end of of an R magrittr pipeline to return a vector

  • how to feed the result of a pipe chain (magrittr) to an object









share|improve this question

















  • 1





    Well, it might break as soon as the first example in issue 32 returns a different result, i.e., the issue gets fixed. I believe . just calls the { function. You could probably also use identity instead.

    – Roland
    Mar 8 at 9:44






  • 1





    for your purpose, identity indeed is the appropriate function rather than return

    – RolandASc
    Mar 8 at 10:01













0












0








0








I often have to manually clean up entries in datasets.
For flexibility and readability, I like to use pipes.
Sometimes I later come across another thing I need to clean up, so I keep a copy-paste'able line in my magrittr pipeline.



In ggplot2, calling an empty theme() at the end helps me to keep coding flexible for later additions. I never encountered problems with that and thought I could do the same with return() in a pipeline.



I think return() is not be meant to use outside functions, so: is there a conceivable way this could break my code?



I also stumbled upon . ans an alternative, but I don't really know what it does and searching info (even using advanced search on SO) is not helping.



Example:



starwars %<>% 
mutate(hair_color = ifelse(name == "Captain Phasma", "blond", hair_color)) %>%
mutate(skin_color = ifelse(name == "Captain Phasma", "fair", hair_color)) %>%
mutate(hair_color = ifelse(name == "Zam Wesell", "blond", hair_color)) %>%
#mutate(var = ifelse(name == "cond", "replacement", var)) %>% ### for future c/p
return() #


NB: I realise this is borderline the tag "coding-style", so I like point out I'm not interested in an opinion-based discussion but advice if this could break my code in certain circumstances. Examples where it does break code are welcome, as are alternative suggestions.



I think these topics/threads are related:




  • https://github.com/tidyverse/magrittr/issues/32

  • Use $ dollar sign at end of of an R magrittr pipeline to return a vector

  • how to feed the result of a pipe chain (magrittr) to an object









share|improve this question














I often have to manually clean up entries in datasets.
For flexibility and readability, I like to use pipes.
Sometimes I later come across another thing I need to clean up, so I keep a copy-paste'able line in my magrittr pipeline.



In ggplot2, calling an empty theme() at the end helps me to keep coding flexible for later additions. I never encountered problems with that and thought I could do the same with return() in a pipeline.



I think return() is not be meant to use outside functions, so: is there a conceivable way this could break my code?



I also stumbled upon . ans an alternative, but I don't really know what it does and searching info (even using advanced search on SO) is not helping.



Example:



starwars %<>% 
mutate(hair_color = ifelse(name == "Captain Phasma", "blond", hair_color)) %>%
mutate(skin_color = ifelse(name == "Captain Phasma", "fair", hair_color)) %>%
mutate(hair_color = ifelse(name == "Zam Wesell", "blond", hair_color)) %>%
#mutate(var = ifelse(name == "cond", "replacement", var)) %>% ### for future c/p
return() #


NB: I realise this is borderline the tag "coding-style", so I like point out I'm not interested in an opinion-based discussion but advice if this could break my code in certain circumstances. Examples where it does break code are welcome, as are alternative suggestions.



I think these topics/threads are related:




  • https://github.com/tidyverse/magrittr/issues/32

  • Use $ dollar sign at end of of an R magrittr pipeline to return a vector

  • how to feed the result of a pipe chain (magrittr) to an object






r tidyverse magrittr






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 8 at 9:30









R'n'ER'n'E

137214




137214







  • 1





    Well, it might break as soon as the first example in issue 32 returns a different result, i.e., the issue gets fixed. I believe . just calls the { function. You could probably also use identity instead.

    – Roland
    Mar 8 at 9:44






  • 1





    for your purpose, identity indeed is the appropriate function rather than return

    – RolandASc
    Mar 8 at 10:01












  • 1





    Well, it might break as soon as the first example in issue 32 returns a different result, i.e., the issue gets fixed. I believe . just calls the { function. You could probably also use identity instead.

    – Roland
    Mar 8 at 9:44






  • 1





    for your purpose, identity indeed is the appropriate function rather than return

    – RolandASc
    Mar 8 at 10:01







1




1





Well, it might break as soon as the first example in issue 32 returns a different result, i.e., the issue gets fixed. I believe . just calls the { function. You could probably also use identity instead.

– Roland
Mar 8 at 9:44





Well, it might break as soon as the first example in issue 32 returns a different result, i.e., the issue gets fixed. I believe . just calls the { function. You could probably also use identity instead.

– Roland
Mar 8 at 9:44




1




1





for your purpose, identity indeed is the appropriate function rather than return

– RolandASc
Mar 8 at 10:01





for your purpose, identity indeed is the appropriate function rather than return

– RolandASc
Mar 8 at 10:01












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55060276%2fcan-the-use-of-return-after-a-magrittr-pipeline-to-write-an-object-break-somet%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55060276%2fcan-the-use-of-return-after-a-magrittr-pipeline-to-write-an-object-break-somet%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to get text form Clipboard with JavaScript in Firefox 56?How to validate an email address in JavaScript?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do you get a timestamp in JavaScript?How do I copy to the clipboard in JavaScript?How do I include a JavaScript file in another JavaScript file?Get the current URL with JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?How do I remove a particular element from an array in JavaScript?

Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

List of MPs elected to the English parliament in 1640 (April) Contents List of constituencies and members See also Notes References Navigation menueNational Archives – The Glynde Place ArchivesCobbett's Parliamentary history of England, from the Norman Conquest in 1066 to the year 1803'Aldermen in Parliament', The Aldermen of the City of London: Temp. Henry III – 1912onepage&q&f&#61, false 229