First of all when read in you can define the class of each column. It sounds like you have a non-numeric in that column. If you are not using factors, then putting 'as.is=TRUE' will make sure that they are read in as characters. If you want to convert a column to numeric, do the following:
df$col <- as.numeric(as.character(df$col)) On Mon, Feb 23, 2009 at 8:35 AM, Mao Jianfeng <jianfeng....@gmail.com> wrote: > Hello dear R-users, > > I have a tricky problem of data manipulation with R. Although it seems > > very easy, I can not solve it by myselves. > > The problem is a variable in my dataset is usually be readed as > > "factor" (variable mode), however I want it be a "numeric" one. I want > > to know how can I define an variable/column in a dataframe as numeric > > mode, after I imported a large dataset using read.delim() from a txt > > file. > > Thanks a lot in advance. > > Mao J-F > State Key Lab of Systematics and Evolutionary Botany > Institute of Botany > Chinese Academy of Sciences > Beijing, China > > [[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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ 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.