Thomsen
2008-Mar-10 14:15 UTC
[R] re moving parentheses/square brackets from data frame numbers
Dear list, I am importing data consisting of numbers into dataframes. Some of the numbers are flanked by parentheses or square brackets. Thus, they are not recognized as numeric and the corresponding column is of class "factor" which makes it hard/impossible use in plotting functions. Is there a way to remove brackets from numbers in a column/row/dataframe? Kind regards, Stefan -- View this message in context: http://www.nabble.com/removing-parentheses-square-brackets-from-data-frame-numbers-tp15950774p15950774.html Sent from the R help mailing list archive at Nabble.com.
Charles C. Berry
2008-Mar-10 16:27 UTC
[R] re moving parentheses/square brackets from data frame numbers
On Mon, 10 Mar 2008, Thomsen wrote:> > Dear list, > > I am importing data consisting of numbers into dataframes. Some of the > numbers are flanked by parentheses or square brackets. Thus, they are not > recognized as numeric and the corresponding column is of class "factor" > which makes it hard/impossible use in plotting functions. > > Is there a way to remove brackets from numbers in a column/row/dataframe?Oh yes! But you have not followed this dictum provide commented, minimal, self-contained, reproducible code so we can't suggest specific solutions. Suggest you see ?gsub ?regexp HTH, Chuck> > Kind regards, > > Stefan > -- > View this message in context: http://www.nabble.com/removing-parentheses-square-brackets-from-data-frame-numbers-tp15950774p15950774.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. >Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:cberry at tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
Maybe Matching Threads
- for loop; lm() regressions; list of vectors - lapply - accolades and square brackets??
- Unbalanced parentheses printed by warnings() crash text editor
- Why LLVM doesn't have debug information of function right parentheses?
- Why LLVM doesn't have debug information of function right parentheses?
- Using square brackets in a ploted expression