I have a data-frame which looks like this:
date_tmp efficiency smb rmrf hml rmw cma Returns
2010-11-04.Stock1 2010-11-04 0.4469618 0.87430339 0.7337814 0.00000000 0 0.60769928 1.245834
2010-11-04.Stock2 2010-11-04 0.6608003 0.65057967 2.2088113 0.00000000 0 0.10672836 1.659817
2010-11-04.Stock3 2010-11-04 0.3878181 0.88259984 0.2530008 0.04665325 0 1.38739047 1.388948
2010-11-04.Stock4 2010-11-04 0.4781154 0.93226537 0.0000000 0.16319179 0 1.43025290 1.331511
2010-11-04.Stock5 2010-11-04 0.4809276 0.56507215 1.9185010 0.00000000 0 0.09270075 1.441663
2010-11-04.Stock6 2010-11-04 0.4619094 0.06452728 1.8513120 0.00000000 0 0.40841138 1.251019
The first column shows the row names.
What i need is to remove the date part on all rows eg( "Stock1" instead of "2010-11-04.Stock1"
I basically need the reverse of this function which keeps the first n characters instead of deleting them.
x <- "some text in a string"
substrRight <- function(x, n){
substr(x, 1, n)
}
substrRight(x, 4)
[1] "some"