Re: [R] how to add a calculated column into a data frame

2020-06-05 Thread Ravi Jeyaraman
-help-boun...@r-project.org] On Behalf Of Charles Thuo Sent: Friday, June 05, 2020 12:18 AM To: r-help@r-project.org Subject: [R] how to add a calculated column into a data frame Dear Sirs, I have a data frame that has a column that shows the transaction date. How do i add another column that

Re: [R] how to add a calculated column into a data frame

2020-06-04 Thread Jeff Newmiller
This should get you started: x <- "2009-03-21" substr( x, 1, 4 ) y <- as.integer( substr( x, 1, 4 ) ) y or yy <- as.POSIXlt( x )$year + 1900 yy RShowDoc( "R-intro" ) On June 4, 2020 9:18:00 PM PDT, Charles Thuo wrote: >Dear Sirs, > >I have a data frame that has a column that shows the transa

[R] how to add a calculated column into a data frame

2020-06-04 Thread Charles Thuo
Dear Sirs, I have a data frame that has a column that shows the transaction date. How do i add another column that extracts the year of transaction from the transaction date. Charles [[alternative HTML version deleted]] __ R-help@r-project.