خرید بک لینک

Vote count: 0

I have a list of variables, like a1, a2, a3. Then I want to do a loop for these variable, for instance, assign values. I tried paste, which just gave character like "a1", that was not what I am really look for. Can anyone provide a solution?

asked 2 mins ago

1 Answer

Vote count: 1

We can use mget to get the values in a list

lst <- mget(paste0("a", 1:3))

and then loop through the list and apply the function

lapply(lst, yourFunction)

answered 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 21 خرداد 1395 ساعت: 10:08

صفحه بندی