can you give the line you are using to import the data. On Sun, 14 Aug 2005 [EMAIL PROTECTED] wrote:
> Well, you were right. When I check with str() or summary(), > the data frame appears as having a factor for that column. > However, if I ask is.factor(C2), I get FALSE, and if I ask > is.numeric(C2) I get TRUE. This seems strange. > So I decided to reimport the dataframe, this time with NA as > undefined values, and not ?. C2 was imported as a numeric > variable, as checked with str() and is.numeric(). But I still > get the indexes and not the values when I use C2 for any > purpose, just as happened before. How can this be possible? > All the other columns in the table behave properly. > The only difference I see between this columns ans the others > is that it contains NA values. > > Thanks again, > Francisco Torreira > > > > > ---- Original message ---- > >Date: Sun, 14 Aug 2005 10:11:15 +0100 > >From: Patrick Burns <[EMAIL PROTECTED]> > >Subject: Re: [R] Problem with numeric variable > >To: [EMAIL PROTECTED] > > > >I think your problem is that you have a factor rather > >than a numeric vector (even though you say you checked > >with 'is.numeric'). Missing values should be represented > >by 'NA' and not by '?' which is what makes me think you > >have a factor. > > > >Patrick Burns > >[EMAIL PROTECTED] > >+44 (0)20 8525 0696 > >http://www.burns-stat.com > >(home of S Poetry and "A Guide for the Unwilling S User") > > > >[EMAIL PROTECTED] wrote: > > > >>Hello all, > >> > >>I posted a question some days ago without getting any answers, > >>perhaps, as one of you kindly pointed out, because the > >>question was not clearly stated. Let me reformulate it: > >>In a frame, a column named C2 represents a numeric variable > >>(checked with is.numeric(C2)). Some rows in the frame have an > >>undefined value for C2, represented in the table by a ? sign. > >>The remaining rows have numeric values with 2 decimals. For > >>example, row 10 has 43.70 for C2, while row 1 has ?. The > >>problem is that when I list C2 values (or when I try to plot > >>them, etc), these values are not the ones that appeared in the > >>table. Below are the first 3 lines of what I get when I list C2: > >> > >> > >>>C2 > >>> > >>> > >>[1] 43 47 96 62 87 55 1 98 121 1 1 1 67 1 112 1 93 44 > >>[19] 85 569 52 110 126 95 92 60 36 383 373 298 274 406 208 175 > >>293 306 > >>[37] 305 172 134 115 94 84 104 99 64 271 269 310 268 359 443 > >>248 204 345 > >> > >>These are not the correct values for C2, and I guess that they > >>are just row numbers. How can I get the correct C2 values > >>ready for analysis? Is this problem related to the fact that > >>some rows have a ? value for C2? > >> > >>Thanks in advance, > >>Francisco Torreira > >>Francisco Torreira > >>Spanish, Italian and Portuguese > >>Univ. of Illinois at Urbana-Champaign > >>707 South Mathews Aven. > >>4031 FLB > >>Urbana, IL, 61801 > >> > >>______________________________________________ > >>[email protected] mailing list > >>https://stat.ethz.ch/mailman/listinfo/r-help > >>PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > >> > >> > >> > >> > >> > > > Francisco Torreira > Spanish, Italian and Portuguese > Univ. of Illinois at Urbana-Champaign > 707 South Mathews Aven. > 4031 FLB > Urbana, IL, 61801 > > ______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
