If 'just' is the object with the character strings, then your expression:

as.numeric(gsub("\\$ <file://$/>", "", ("just")))

was trying to substitute for the "$" in the string 'just' and then convert
it to numeric and of course you get NA.

This is probably want you wanted. (notice no quotes around 'just')


> just <- scan("", what='')
1: $23,060  $124,800 $125,000 $28,140  $24,000  $23,400  $24,000  $149,720
9:
Read 8 items
> just
[1] "$23,060"  "$124,800" "$125,000" "$28,140"  "$24,000"  "$23,400"
"$24,000"  "$149,720"
> gsub("[$,]", '', just)
[1] "23060"  "124800" "125000" "28140"  "24000"  "23400"  "24000"  "149720"
> as.numeric(gsub("[$,]", '', just))
[1]  23060 124800 125000  28140  24000  23400  24000 149720
>


On Tue, Apr 6, 2010 at 4:21 PM, cavalier33901 <cavalier33901@yahoo.com>wrote:

>
> Thanks I tried it with your values and it works, but when I try it with my
> values, plugging in "just" (not sure if i'm doing it right):
>
> > as.numeric(gsub("\\$", "", ("just")))
>
> This is what I get:
>
> [1] NA
> Warning message:
> NAs introduced by coercion
>
> Btw here are the values im wokring with under "just"
>
>  [1] $23,060  $124,800 $125,000 $28,140  $24,000  $23,400  $24,000
>  $149,720
> $92,000  $35,000  $35,430  $40,100  $10,000  $25,000
> Levels: $10,000 $124,800 $125,000 $149,720 $23,060 $23,400 $24,000 $25,000
> $28,140 $35,000 $35,430 $40,100 $92,000
> --
> View this message in context:
> http://n4.nabble.com/read-numeric-values-with-thousands-seperator-from-csv-file-tp1477704p1753432.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?

	[[alternative HTML version deleted]]

