[R] Why the result is coming as NULL?

Julien Moeys julien.moeys at slu.se
Wed Aug 1 09:36:58 CEST 2012


Not sure, but maybe check the name of the column(s) you are retrieving

you may get a NULL value if the column name is misspelled

R example:
## --------------------------------------
df <- data.frame( 
    "Publication" = 1991:2000, 
    "Reference"   = LETTERS[1:10] )   

df[ 2, "References" ]
# NULL
## Notice the extra 's'
## --------------------------------------

If that does not fix your error, can you send us the output from

head(x)
# and
dput(head(x))

So we have an idea what your table looks like?

All the best

Julien

________________________________________
From: r-help-bounces at r-project.org [r-help-bounces at r-project.org] On Behalf Of Sri krishna Devarayalu Balanagu [balanagudevarayulu at gvkbio.com]
Sent: 01 August 2012 08:58
To: r-help at r-project.org
Subject: [R] Why the result is coming as NULL?

Why the result is coming as NULL. Can anyone help. I want to find the outliers for a reference


setwd("D:/AZ")

library("RODBC")
cdb_cnct <- odbcConnectExcel("Book1.xls")
cdb_frame <- sqlFetch(cdb_cnct, "Sheet1")
odbcClose(cdb_cnct)
rm(cdb_cnct)

x<- cdb_frame$Publication >=1990 & cdb_frame$Publication <=2012
invalid <- cdb_frame[!x, c("Reference")]
invalid

________________________________
Notice: The information contained in this electronic mail message is intended only for the use of the designated recipient. This message is privileged and confidential. and the property of GVK BIO or its affiliates and subsidiaries. If the reader of this message is not the intended recipient or an agent responsible for delivering it to the intended recipient, you are hereby notified that you have received this message in error and that any review, dissemination, distribution, or copying of this message is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone +91-40-66929999<tel:%2B91-40-66929999> and destroy any and all copies of this message in your possession (whether hard copies or electronically stored copies).



More information about the R-help mailing list