From mrjefftoyou at gmail.com  Wed Apr  2 02:51:28 2014
From: mrjefftoyou at gmail.com (Jeff Johnson)
Date: Tue, 1 Apr 2014 17:51:28 -0700
Subject: [Rd] Typeof for character vector in dataframe returns integer
In-Reply-To: <CAGSjAUCx7B3_vavmXQrQTtgAF1BO03YZXuutE3hdb7rJcjfS3Q@mail.gmail.com>
References: <CAGSjAUCx7B3_vavmXQrQTtgAF1BO03YZXuutE3hdb7rJcjfS3Q@mail.gmail.com>
Message-ID: <D4D4BDC9-394C-489B-83C1-E158E93D0EB3@gmail.com>

Perhaps because indexes start at 0?

Sent from my iPhone

> On Apr 1, 2014, at 5:46 PM, Sandip Nandi <sannandi at umail.iu.edu> wrote:
> 
> Hi ,
> 
> I want to know is this behavior expected and why is that ? Need some help
> 
> gender <- c("F", "M", "M", "F", "F", "M", "F", "F")
>> age    <- c(23, 25, 27, 29, 31, 33, 35, 37)
>> df<- data.frame(gender,age)
>> typeof(df[[1]])
> [1] "integer"   >>>>>>>>>>>>>  Why is this integer . *Should not it be
> character ?*
>> typeof(df[[2]])
> [1] "double"
> 
>> typeof(gender)
> [1] "character"
>> typeof(age)
> [1] "double"
> 
> In my code i am trying to do some thing based on typeof and the type for
> character column is strange.
> 
> Thanks,
> Sandip
> 
>    [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Typeof for character vector in dataframe returns integer
Jeff Johnson