[R] I have Problem using the Pipe Command
Eric Berger
er|cjberger @end|ng |rom gm@||@com
Wed Jun 19 09:27:39 CEST 2024
So all is good. You are successfully using the R pipe %>% (before it
became part of R).
If you want to use the newer pipe that is part of R, i.e. |> instead of %>%
you will have to install a more recent version of R.
Your previous email with sessionInfo() showed that you are using R version
3.4.4 from 2018.
As other people have already told you, you will need to install R version
4.1.0 or later.
Good luck
On Wed, Jun 19, 2024 at 10:00 AM Ogbos Okike <giftedlife2014 using gmail.com>
wrote:
> The output of the command is, indeed, 55. See below:
>
> > library(magrittr)
> > 1:10 %>% sum()
> [1] 55
>
> On Wed, Jun 19, 2024 at 7:52 AM Eric Berger <ericjberger using gmail.com> wrote:
>
>> In your R session do
>>
>> library(magrittr)
>> 1:10 %>% sum()
>>
>> This should output 55.
>> If that does not work send the results, include the output of
>> sessionInfo() showing that you have loaded magrittr.
>>
>>
>>
>> On Wed, Jun 19, 2024 at 9:43 AM Ogbos Okike <giftedlife2014 using gmail.com>
>> wrote:
>>
>>> Dear Eric,
>>> Good morning from Nigeria.
>>>
>>> Please, see the output of the session below:
>>>
>>> > sessionInfo()
>>> R version 3.4.4 (2018-03-15)
>>> Platform: x86_64-pc-linux-gnu (64-bit)
>>> Running under: Ubuntu 18.04.6 LTS
>>>
>>> Matrix products: default
>>> BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
>>> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1
>>>
>>> locale:
>>> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
>>> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
>>> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
>>> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
>>> [9] LC_ADDRESS=C LC_TELEPHONE=C
>>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>>
>>> attached base packages:
>>> [1] stats graphics grDevices utils datasets methods base
>>>
>>> loaded via a namespace (and not attached):
>>> [1] compiler_3.4.4
>>>
>>> On Tue, Jun 18, 2024 at 8:31 PM Eric Berger <ericjberger using gmail.com>
>>> wrote:
>>>
>>>> Please show the output of
>>>> > sessionInfo()
>>>>
>>>>
>>>> On Tue, Jun 18, 2024 at 7:49 PM Ogbos Okike <giftedlife2014 using gmail.com>
>>>> wrote:
>>>>
>>>>> Thanks, Duncan for contributing. I quickly tried entering the command
>>>>> on a
>>>>> new line. But the error pointed specifically to the point. It didn't
>>>>> run.
>>>>> Best regards
>>>>> Ogbos
>>>>>
>>>>> On Tue, Jun 18, 2024 at 5:38 PM Duncan Murdoch <
>>>>> murdoch.duncan using gmail.com>
>>>>> wrote:
>>>>>
>>>>> > On 2024-06-18 12:17 p.m., Ben Bolker wrote:
>>>>> > > You probably have to update your R version. The native pipe |>
>>>>> wasn't
>>>>> > > introduced until R version 4.4. R.version.string (among others)
>>>>> will
>>>>> > > tell you what version you have.
>>>>> >
>>>>> > Typo: it was introduced in R 4.1.0.
>>>>> >
>>>>> > Another possible problem is with line breaks. This works:
>>>>> >
>>>>> > 1:10 |>
>>>>> > mean()
>>>>> >
>>>>> > but this fails:
>>>>> >
>>>>> > 1:10
>>>>> > |> mean()
>>>>> >
>>>>> > Duncan Murdoch
>>>>> >
>>>>> > >
>>>>> > > If you don't want to do that, install and load the 'magrittr'
>>>>> package
>>>>> > > and change |> to %>% everywhere.
>>>>> > >
>>>>> > > On 2024-06-18 12:13 p.m., Ogbos Okike wrote:
>>>>> > >> Greetings to everyone and thank you for your readiness to help.
>>>>> > >>
>>>>> > >> I have problems using the pipe command (|>).
>>>>> > >>
>>>>> > >> Once I have it in any script on my system, it won't.
>>>>> > >>
>>>>> > >> The error message will say:
>>>>> > >>
>>>>> > >> unexpected '>'
>>>>> > >> I loaded the two packages below to see if it would handle it. But
>>>>> the
>>>>> > >> problem remains.
>>>>> > >> library(magrittr)
>>>>> > >> library(dplyr)
>>>>> > >>
>>>>> > >> I searched to see if there was a way to install the command. But
>>>>> I was
>>>>> > not
>>>>> > >> successful.
>>>>> > >>
>>>>> > >> Please tell me what to do to be able to use the pipe command on my
>>>>> > system.
>>>>> > >> I would be grateful for any help.
>>>>> > >> Thank you.
>>>>> > >>
>>>>> > >> Sincerely yours
>>>>> > >> Ogbos
>>>>> > >>
>>>>> > >> [[alternative HTML version deleted]]
>>>>> > >>
>>>>> > >> ______________________________________________
>>>>> > >> R-help using 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 using 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 using 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.
>>>>> >
>>>>>
>>>>> [[alternative HTML version deleted]]
>>>>>
>>>>> ______________________________________________
>>>>> R-help using 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.
>>>>>
>>>>
[[alternative HTML version deleted]]
More information about the R-help
mailing list