Dear R-helpers,

I want to split the following vector into 2 vectors by the last occurance
of a .

> dput(rownames(sensext))
c("pat", "cash_bank_bal", "invest_abroad", "pat.1", "cash_bank_bal.1",
"invest_abroad.1", "pat.2", "cash_bank_bal.2", "invest_abroad.2",
"pat.3", "cash_bank_bal.3", "invest_abroad.3", "pat.4", "cash_bank_bal.4",
"invest_abroad.4", "Market.Capitalisation", "Market.Capitalisation.1",
"Market.Capitalisation.2", "Market.Capitalisation.3",
"Market.Capitalisation.4"
)

My attempt :
I tried strsplit(rownames(sensext),"\\.") but that splits it into 3 parts
sometimes,the logic of which I can see,since there are 2 dots sometimes.

Can someone tell me how to split this ?

Many thanks,
Ashim

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to