List and vector

Lists and vectors in R are written in brackets prefixed by the letter c. They can be used interchangeably.

Input:

source_code/appendix_b_r/example05_list_vector.r
some_primes = c(2, 3, 5, 7)
cat("The primes less than 10 are:", some_primes,"
")

Output:

$ Rscript example05_list_vector.r 
The primes less than 10 are: 2 3 5 7 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset