1
Trying to convert some results into new column
Post Body
Hi guys, recently I made a post about creating a new data frame, and I got that settled.
Now, I'm trying to use the new column to store results for each row.
For example: let's say I have two existing columns (time and interval) and a 3rd empty column.
I want to find the difference of time by subtracting consecutive values.
df[i, 3] <- df[i, 1] - df[i-1, 1]
by itself, for example, I can use it. For example:
df[4,1] - df[3,1] will give me a result.
I want to input this answer into the same row of the new column. And do this for all rows.
But it won't let me because it says:
replacement has length zero.
what should I do to solve this issue? thank you.
Author
Account Strength
100%
Account Age
10 years
Verified Email
Yes
Verified Flair
No
Total Karma
27,185
Link Karma
10,908
Comment Karma
15,877
Profile updated: 1 week ago
Posts updated: 10 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
- 7 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/RStudio/com...