about the series of numbers

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

about the series of numbers

Bogdan Tanasa
Dear all,

if I may ask please a question that is likely very naive :

shall I write in R > "1:9", it will generate "1 2 3 4 5 6 7 8 9"

shall I write > "0.1:0.9", why does it generate only 0.1 ?

thank you !

-- bogdan

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: about the series of numbers

Albrecht Kauffmann-2
Dear Bogdan,

for increments <>1, it needs "by". Try

seq(.1,.9,.1)

Best,
Albrecht

--
  Albrecht Kauffmann
  [hidden email]

Am Do, 20. Sep 2018, um 09:26, schrieb Bogdan Tanasa:

> Dear all,
>
> if I may ask please a question that is likely very naive :
>
> shall I write in R > "1:9", it will generate "1 2 3 4 5 6 7 8 9"
>
> shall I write > "0.1:0.9", why does it generate only 0.1 ?
>
> thank you !
>
> -- bogdan
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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 | Threaded
Open this post in threaded view
|

Re: about the series of numbers

PIKAL Petr
In reply to this post by Bogdan Tanasa
Hi

> -----Original Message-----
> From: R-help <[hidden email]> On Behalf Of Bogdan Tanasa
> Sent: Thursday, September 20, 2018 9:26 AM
> To: r-help <[hidden email]>
> Subject: [R] about the series of numbers
>
> Dear all,
>
> if I may ask please a question that is likely very naive :
>
> shall I write in R > "1:9", it will generate "1 2 3 4 5 6 7 8 9"
>
> shall I write > "0.1:0.9", why does it generate only 0.1 ?

Because it is said in help page!!!

"For other arguments from:to is equivalent to seq(from, to), and generates a sequence from *from* to *to* in steps of 1 or -1."

sequence from 0.1 to 0.9 in steps 1 starts at 0.1 but the second item is 1.1 which is bigger than 0.9 therefore the result is only one item 0.1.

Cheers
Petr

>
> thank you !
>
> -- bogdan
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních partnerů PRECHEZA a.s. jsou zveřejněny na: https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about processing and protection of business partner’s personal data are available on website: https://www.precheza.cz/en/personal-data-protection-principles/
Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: https://www.precheza.cz/01-dovetek/ | This email and any documents attached to it may be confidential and are subject to the legally binding disclaimer: https://www.precheza.cz/en/01-disclaimer/

______________________________________________
[hidden email] 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.