[R] Splitting the Elements of character vector

2013-04-16 Thread Katherine Gobin
Dear R forum I have a data.frame df = data.frame(currency_type = c(EURO_o_n, EURO_o_n, EURO_1w, EURO_1w, USD_o_n, USD_o_n, USD_1w, USD_1w), rates = c(0.47, 0.475, 0.461, 0.464, 1.21, 1.19, 1.41, 1.43))   currency_type rates 1  EURO_o_n   0.470 2  EURO_o_n   0.475 3   EURO_1w  

Re: [R] Splitting the Elements of character vector

2013-04-16 Thread Gabor Grothendieck
On Tue, Apr 16, 2013 at 8:38 AM, Katherine Gobin katherine_go...@yahoo.com wrote: Dear R forum I have a data.frame df = data.frame(currency_type = c(EURO_o_n, EURO_o_n, EURO_1w, EURO_1w, USD_o_n, USD_o_n, USD_1w, USD_1w), rates = c(0.47, 0.475, 0.461, 0.464, 1.21, 1.19, 1.41, 1.43))

Re: [R] Splitting the Elements of character vector

2013-04-16 Thread arun
Message - From: Katherine Gobin katherine_go...@yahoo.com To: r-help@r-project.org Cc: Sent: Tuesday, April 16, 2013 8:38 AM Subject: [R] Splitting the Elements of character vector Dear R forum I have a data.frame df = data.frame(currency_type = c(EURO_o_n, EURO_o_n, EURO_1w, EURO_1w

Re: [R] Splitting the Elements of character vector

2013-04-16 Thread arun
Subject: Re: [R] Splitting the Elements of character vector Hi, Try: df = data.frame(currency_type = c(EURO_o_n, EURO_o_n, EURO_1w, EURO_1w, USD_o_n, USD_o_n, USD_1w, USD_1w), rates = c(0.47, 0.475, 0.461, 0.464, 1.21, 1.19, 1.41, 1.43),stringsAsFactors=FALSE)  df$currency-unlist(lapply(str_split(df