Search
 
SCRIPT & CODE EXAMPLE
 

R

r create a vector

# Basic syntax:
c(11, 23, 42) # Vector of numerics
c(TRUE, FALSE, TRUE) # Vector of booleans/logicals
c("aa", "bb", "cc") # Vector of strings

# Note, in R, list and vectors (aka atomic vectors) are both 
#	one-dimensional objects, but lists can contain mixed type data 
#	whereas vectors can only contain one type of data
# Note, to make a list, use: list(11, 23, 42)
Comment

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)
Comment

PREVIOUS NEXT
Code Example
R :: filter only NA column in R 
R :: r replace space with 
R :: r number of blanks in the data 
R :: reorder factors in r 
R :: find row with na r 
R :: remove column from matrix r 
R :: reduce ggtitle size 
R :: how to wait for a key press in R 
R :: r delete rowif number higher than 
R :: infinite in r 
R :: finding chi square value in r 
R :: bar plot r 
R :: how to rename variables in r dplyr 
R :: absolute value in r 
R :: return the name of the dataset in r 
R :: list variables r 
R :: R language get help on a dataset 
R :: base R change axis line width 
R :: add padding to number r 
R :: conditional mean statement r 
Rust :: how to clear the console rust 
Rust :: vector in rust 
Rust :: rust write to file 
Rust :: enum rust 
Rust :: armanriazi•rust•smartpointer•box 
Rust :: armanriazi•rust•error•[E0106]: missing lifetime specifier -- src/main.rs:5:16 | 5 | fn dangle() - &String { | ^ expected named lifetime parameter 
Rust :: armanriazi•rust•collection•hashmap•avoid_of_duplicate 
Rust :: rust program name 
Rust :: armanriazi•substrate•call•dispatchable•func#ensure_signed#frame_system 
Rust :: initializing array rust 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =