When I try this all I get is NULL Chris Anderson Data Analyst Medical Affairs wk: 925-677-4870 cell: 707-315-8486 Fax:925-677-4670
-----Original Message----- From: Henrique Dallazuanna [mailto:www...@gmail.com] Sent: Thursday, January 07, 2010 11:45 AM To: Anderson, Chris Cc: r-help@R-project.org Subject: Re: [R] Help formating data to display commas Try this: gsub("\\s", "", format(upper, big.mark = ",")) On Thu, Jan 7, 2010 at 5:31 PM, Anderson, Chris <chris.ander...@paradigmcorp.com> wrote: > I'm using the following code to create quartile intervals of my dataset and > it is working like it is suppose too. In my final output of the data I would > like currency amounts to be displayed with commas. I have not found an option > either through FormatC or sprintf that will display the data with commas, > they only seem to add decimals. Is there a format that will display commas > without me reverting to the labels statement. This is an ongoing process > where the values are updated, so using the labels statement would be too much > to manage. > > > Benchparaq<-levels(quantcut(benchmarkPara$Benchmark_Total, > q=seq(0,1,by=0.25), na.rm=TRUE)) >> >> #,labels=c("$267,000-<$436,000","$436,000-<$559,000","$559,000-<$836,000","$836,000-<$1,590,000")) >> lower <-as.numeric(sub("\\((.+),.*", "\\1", Benchparaq)) > Warning: NAs introduced by coercion >> upper <- as.numeric(sub("[^,]*,([^]]*)\\]", "\\1", Benchparaq)) >> lower<-ifelse(is.na(lower),0,as.numeric(lower)) >> upper<-ifelse(is.na(upper),0,as.numeric(upper)) >> lower > [1] 0 436000 559000 836000 >> upper > [1] 436000 559000 836000 1590000 >> Benchparaq<-paste("$",lower,"-<","$",upper,sep="") >> lower<-NULL >> upper<-NULL >> Benchparaq > [1] "$0-<$436000" "$436000-<$559000" "$559000-<$836000" > "$836000-<$1590000" > > > Chris Anderson > Data Analyst > Medical Affairs > wk: 925-677-4870 > cell: 707-315-8486 > Fax:925-677-4670 > > > > > > This electronic message transmission, including any attachments, contains > information which may be confidential, privileged and/or otherwise exempt > from disclosure under applicable law. The information is intended to be for > the > use of the individual(s) or entity named above. If you are not the intended > recipient or the employee or agent responsible for delivering the message > to the intended recipient, you are hereby notified that any disclosure, > copying, > distribution or use of the contents of this information is strictly > prohibited. If > you have received this electronic transmission in error, please notify the > sender > immediately by telephone (800-676-6777) or by a "reply to sender only" > message and destroy all electronic and hard copies of the communication, > including attachments. Thank you. > > For more information on Paradigm Management Services, LLC, please visit > http://www.paradigmcorp.com > > [[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. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O This electronic message transmission, including any attachments, contains information which may be confidential, privileged and/or otherwise exempt from disclosure under applicable law. The information is intended to be for the use of the individual(s) or entity named above. If you are not the intended recipient or the employee or agent responsible for delivering the message to the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of the contents of this information is strictly prohibited. If you have received this electronic transmission in error, please notify the sender immediately by telephone (800-676-6777) or by a "reply to sender only" message and destroy all electronic and hard copies of the communication, including attachments. Thank you. For more information on Paradigm Management Services, LLC, please visit http://www.paradigmcorp.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 and provide commented, minimal, self-contained, reproducible code.