On 25.01.2012 02:16, R. Michael Weylandt wrote:
I think you are getting stuck on the same regexp problem as before
(i.e., once again the dollar sign is being interpreted as the
beginning
You meant "end".
Uwe
of the line rather than an actual dollar sign)
If I understand your question, mi
I think you are getting stuck on the same regexp problem as before
(i.e., once again the dollar sign is being interpreted as the
beginning of the line rather than an actual dollar sign)
If I understand your question, might I suggest something much easier?
x = data.frame(a = c("$1034.23","1,230"),
On Jan 24, 2012, at 11:07 AM, Dan Abner wrote:
Hi everyone,
I am using Michael's approach (grepl()) to identify which columns
containing $ signs. I was hoping to incorporate this into a line of
code that would automatically 1) find which columns contain $ signs,
2) strip the $ and commas, and
Hi everyone,
I am using Michael's approach (grepl()) to identify which columns
containing $ signs. I was hoping to incorporate this into a line of
code that would automatically 1) find which columns contain $ signs,
2) strip the $ and commas, and 3) convert the result to a numeric
vector.
I have
On 01/24/2012 03:49 PM, Dan Abner wrote:
> Hello everyone,
>
> I am writing my own function to return the column index of all variables
> (these are currently character vectors) in a data frame that contain a
> dollar sign($). A small piece of the data look like this:
>
> can_sta can_zip ind_
Either
any(grepl("$",x, fixed = TRUE)) # You probably want grepl not grep
any(grepl("\\$",x) )
? regexpr # $ has a special value
Michael
PS -- Stop with HTML postings (seriously, it actually does mess up
what the rest of us see and I think it causes trouble for the archives
as well)
On Tue, Jan
Hello everyone,
I am writing my own function to return the column index of all variables
(these are currently character vectors) in a data frame that contain a
dollar sign($). A small piece of the data look like this:
can_sta can_zip ind_ite_con ind_uni_con AL 36106 $251,895.80 $22,874.43
AL
7 matches
Mail list logo