Hello R Community.
I recently started to learn R, this is my first post.
I'm trying to add values to a list, and eventually plot the list. I tried using the c() function, but this doesn't seem to be working. How can values be appended to a list?
Keep in mind I'm very new to R, comments in the code and extra resources would be very helpful.
Thank you.
my_data <- 5
counter_var <- 0
repeat {
counter_var <- counter_var + 1 # counts each loop
my_data <- my_data * 2
list_var <- c(counter_var, my_data)
if (counter_var == 7) { # break on the 7th loop
break
}
}
print(list_var) # Trying to get this as a list: 1,10 2,20 3,30 4,40 5,50 6,60 7,70