Sri krishna Devarayalu Balanagu
2012-Aug-01 06:58 UTC
[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).
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).
I assume "result" means the invalid variable. works with sample data frame i made, so please provide an example of cdb_frame. You can use dput(cdb_frame) for that, or dput(head(cdb_frame)) if you have a lot of data. For example it could be that $Publication is a string, not numeric. On 01.08.2012, at 08:58, Sri krishna Devarayalu Balanagu wrote:> 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). > ______________________________________________ > R-help at 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.
Possibly Parallel Threads
- Why the error is coming while extracting the data from sheet?
- Error: level sets of factors are different?
- How can I get the Ids with Duplicated key and corresponding Ids with original key?
- Not able to filter factor, class
- Why the error is coming, can anyone help?