This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
7
Is there a built in way to assign multiple variables in one line of code?
Post Body
I wrote a function that returns four calculated variables and want to assign each of them to a specific name. The way I have it now is with four lines: itβs
x1 = as.numeric(do_thing(inputs)[1]
x2 = as.numeric(do_thing(inputs)[2]
x3 = as.numeric(do_thing(inputs)[3]
x4 = as.numeric(do_thing(inputs)[4]
and I want to make it one line. I know in Python you can do it such as βx1, x2, x3, x4 = do_thing(inputs) and all four are assigned in one swing. Can I do this with R?
Author
Account Strength
100%
Account Age
7 years
Verified Email
Yes
Verified Flair
No
Total Karma
357,018
Link Karma
96,428
Comment Karma
259,578
Profile updated: 6 days ago
Posts updated: 6 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 1 year ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/rprogrammin...