Error: level sets of factors are different?
Hello, The message is not about lengths, it's about sets. It means that the two factors, compkey and armkey don't have the same levels, which you can see with levels(compkey) levels(armkey) and test for equality. Also, your post's prologue doesn't have a direct relation with the error, you could have skipped the lines up to, including, sink(). It's much better to provide an actual data example: dput( head(outcome, 50) ) # paste the output of this in a post. Hope this helps, Rui Barradas Em 17-08-2012 14:01, Sri krishna Devarayalu Balanagu escreveu:
Why the error is coming? even though the length of outcome.new$compkey and outcome.new$armkey were exactly same.
Can anyone help?
setwd("D:/AZ")
library("RODBC")
cdb_cnct <- odbcConnectExcel("AZIF_DC_GVK_NSCLC_MSALL_287papers_02072012_141450_v1_4.xls")
outcomes <- sqlFetch(cdb_cnct, "Outcomes_info")
odbcClose(cdb_cnct)
rm(cdb_cnct)
sink("Dependency checks.log")
outcomes[(outcomes$Comparator != 9999), ] -> outcome
compkey <- paste(outcome$Comparator, outcome$Comparator_Subarm, sep='_')
armkey <- paste(outcome$Arm_ID, outcome$SubArm_ID, sep='_')
outcome.new <- cbind(outcome, compkey, armkey)
invalid.ids <- outcome.new[outcome.new$compkey == outcome.new$armkey, c("Assessment_record_ID")]
Error in Ops.factor(outcome.new$compkey, outcome.new$armkey) :
level sets of factors are different
________________________________ 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). [[alternative HTML version deleted]] ______________________________________________ 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.