I have created an empty data frame using another data frame with the below code.
compare<-data.frame(nrow=nrow(test_email),ncol=ncol(test_data))
colnames(compare)<-c("email", "gender")
Now, I am trying to assign value to the columns of compare data frame based on some conditions using simple assignment statement.
compare[1,1]<-test_email[1,1]
compare[1,2]<-test_data[1,2]
In the above, test_email[1,1] has an email ID like"abc@gmail.com"
But, after assignment compare[1,1] has value 81 and not the email ID.
I am not able to get it why the email is not getting assigned and some numeric vlaue is getting assigned. Can anyone let me know this reason and how to solve. Structure of test_email is below:
structure(list(email = structure(c(81L, 75L, 57L, 61L, 79L, 76L),
.Label = "ajay.bansal@siemens.com", "amanmeet.bhalla@gmail.com",
"aoneshp@gmail.com", "aparna_anand@msn.com", "ar.ashwani@gmail.com",
"ar.parulbansal@gmail.com", "ar.preet02@gmail.com",
"asdawsd@yahoo.com", "assd@yopmail.com",
"avijeet_yadav@rediffmail.com", "avneng1.negi@gmail.com",
"avnihatnagar@yahoo.com", "bansalanuj007@yahoo.com.au",
"bhanu5877@yahoo.co.in"), class = "factor")), .Names = "email",
w.names = c(NA, 6L), class = "data.frame")
I am not able to find out why R is converting email into some numeric values during assignment.