Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • Just a general note about your approach: you should not grow lists like this inside a for loop, if you can avoid it. When you add something to the end of a list, R has to copy the whole list. This is fine for small cases, but if your list is big (and it's getting bigger and bigger, in your case) this can be quite inefficient. Commented Apr 27, 2017 at 15:55
  • 2
    For your data construction, you could have used lapply like this: vectorList <- lapply(1:5, function(x) c(x, sqrt(x))). Commented Jul 6, 2017 at 16:55