Answers for "creating vector in r"

R
1

create vector in r

#Use the c() function to store data in a vector. 
c(2.5, 48.5, 101.5)

#To create a vector of integers using the c() function, 
#you must place the letter "L" directly after each number.
c(1L, 5L, 15L)

#To create a vector containing characters aka strings 
c("Sara" , "Lisa" , "Anna")

#To create a vector containing logicals aka logicals
c(TRUE, FALSE, TRUE)
Posted by: Guest on September-21-2021
1

what is a vector in r

#A vector is the simplest type of data structure in R.
#A vector as “a single entity consisting of a collection of things.” 
#A collection of numbers, for example, is a numeric vector.
c('a', 'b', 'c') #This is a character(string) vector.
Posted by: Guest on September-21-2021

Browse Popular Code Answers by Language