![]() ![]() The help files show the arguments listed for the seq() function. The most basic use of seq() does exactly the same thing as the : operator. Often, we’ll desire more control over a sequence we’re creating than what the : operator gives us. ![]() If you don’t have a backtick key, you can use regular quotes.) (NOTE: The backtick (`) key is generally located in the top left corner of a keyboard, above the Tab key. However, in the case of an operator like the colon used above, you must enclose the symbol in backticks like this: ?. Remember that if you have questions about a particular R function, you can access its documentation with a question mark followed by the function name: ?function_name_here. It counted backwards in increments of 1! This is sometimes useful for plotting coefficients from models in reverse order. What happens if we do 15:1? Give it a try to find out. Note also that pi is one of the few constants built in to R. The upper limit of 10 is never reached, since the next number in our sequence would be greater than 10. The result is a vector of real numbers starting with pi (3.142…) and increasing in increments of 1. We could also use it to create a sequence of real numbers (a real number is a positive, negative, or 0 with an infinite or finite sequence of digits after the decimal place). That gave us every integer between (and including) 1 and 20 (an integer is a positive or negative counting number, including 0). The simplest way to create a sequence of numbers in R is by using the : operator. Sequences of numbers are used in many different tasks, from plotting the axes of graphs to generating simulated data. In this lesson, you’ll learn how to create sequences of numbers in R. ![]()
0 Comments
Leave a Reply. |