2

everyone. I just started learning r programming with swirl.

I just learned seq. On the actual practice, the argument for setting a desired length of the sequence was noted as length . Yet, when I read the help document relating to seq, I found that length.out is the argument noted with the same definition. And there were no mentioning of length as an argument within seq.

I know this is very elementary for most of you, but I wanted to know why that was different on the swirl module.

I googled the title of this posting to see if anyone has asked the same question. But I wasn't able to find anything on it.

Thank you so much for reading and I hope to hear from someone soon.

Henrik
  • 65,555
  • 14
  • 143
  • 159
Eli Y. Park
  • 21
  • 1
  • 1
  • 3
  • 1
    Please see https://cran.r-project.org/doc/manuals/R-lang.html#Argument-matching – Henrik Aug 21 '15 at 18:05
  • @Henrik I wasn't aware that my question was directly related to partial matching due to my lack of knowledge in R. The answer was based on a different question which dealt with argument-matching. I'll check the materials you recommended. Thank you for your input. – Eli Y. Park Aug 21 '15 at 18:16

1 Answers1

5

You are correct upon looking at ?seq - the argument is actually named length.out. R allows you to use "partial matching". This means you can abbreviate names of arguments:

seq(f = 1, b = 5, leng = 10)
# [1]  1  6 11 16 21 26 31 36 41 46

seq(from = 1, by = 2, length.out = 10)
# [1]  1  3  5  7  9 11 13 15 17 19
JasonAizkalns
  • 20,243
  • 8
  • 57
  • 116