[R] Chemical Names in Data Frames

Spencer Graves spencer.graves at structuremonitoring.com
Fri Sep 2 22:02:31 CEST 2011


possibly with unique = TRUE:

> make.names(c("'", "'"))
[1] "X." "X."
> make.names(c("'", "'"), unique=TRUE)
[1] "X."   "X..1"
>

       Spencer


On 9/2/2011 12:28 PM, Gustavo Carvalho wrote:
> ?make.names perhaps.
>
> On Fri, Sep 2, 2011 at 4:13 PM, Durant, James T. (ATSDR/DTEM/PRMSB)
> <hzd3 at cdc.gov>  wrote:
>> Greetings -
>>
>> I am working on some data that contain chemical names with air concentrations, and I am creating a data frame with date/time and each chemical having its own column. However, these are organic chemicals (e.g. 1-butene, 2,3,4-trimethylbenzene etc). The package I am going to be using the data with is openair, and many of the great functions require you to specify a column name which does not seem to work with improper column names- e.g. smoothTrend(mydata, pollutant="1-Butene" and smoothTrend(mydata, pollutant=mydata[,"1-Butene"])
>>
>> I was wondering if there was a function to automatically convert these chemical names (with all sorts of numbers and minuses in the beginning) to something openair can handle?  Or am I going to be stuck recoding several hundred chemical names in my database?
>>
>> VR
>>
>> Jim
>>
>> James T. Durant, MSPH CIH
>> Emergency Response Coordinator
>> US Agency for Toxic Substances and Disease Registry
>> Atlanta, GA 30341
>> 770-378-1695
>>
>>
>>
>>
>>
>>         [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at 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.
>>


-- 
Spencer Graves, PE, PhD
President and Chief Technology Officer
Structure Inspection and Monitoring, Inc.
751 Emerson Ct.
San José, CA 95126
ph:  408-655-4567
web:  www.structuremonitoring.com



More information about the R-help mailing list