What do you want to save?
Add Code snippet
New code examples in category R
-
Awgiedawgie 2022-03-02 14:00:04
r find elements in common between vectors
# Basic syntax: intersect(vector_1, vector_2) # For two vectors Reduce(intersect, list(vector_1, vector_2, vector_3)) # For multiple vectors # Example usage: vector_1 = c(1,2,3,4,5) vector_1 = c(2,4,6,8) intersect(vector_1, vector_2) --> 2 4 # Note, ... Add solution -
-
Phoenix Logan 2022-02-27 18:20:36
r exit loop
# Short answer: # In R you can completely exit from a loop with "break", or skip to the # next iteration of a loop with "next" # Example of next and break: for (i in 1:5) { if (i == 2) { # Skip to next iteration if i = 2 next ... Add solution -
A-312 2022-02-19 18:25:25
comment in r
# comment statement : no multiline comments in R Add solution