R data.frame with 0 values -


my pos_tat data frame contains 7 rows last 1 appears when summary because value 0.

summary(pos_tat) delayed$position.type  delayed$tat                jf     :1            s20     :1            s40     :1            s60     :1       specials     :1            s70     :1             14-19     :0    pos_tat   delayed$position.type delayed$tat 1                    jf    45.10965 2                   s20    44.37831 3                   s40    44.18750 4                   s60    45.40698 5              specials    43.30079 6                   s70    42.44444     

that poses problem if want add column count example tells me there's different number of rows 6, 7.

i've spent hours looking problem can't find answer. thank you.

this possible when there unused levels factor columns in dataset. either convert column character or if need keep factor class, use droplevels or call factor again.

df2 <- droplevels(pos_tat) 

or

df2 <- transform(pos_tat, delayed$position.type= as.character(delayed$position.type)) 

the summary give unused levels op showed

summary(pos_tat[1]) # delayed$position.type # jf      :1            # s20     :1            # s40     :1            # s60     :1            # specials:1            # s70     :1            # 14-19   :0       

data

pos_tat <- structure(list(`delayed$position.type` = structure(1:6, .label = c("jf",  "s20", "s40", "s60", "specials", "s70", "14-19"), class = "factor"),  delayed.tat = c(45.10965, 44.37831, 44.1875, 45.40698, 43.30079,  42.44444)), .names = c("delayed$position.type", "delayed.tat" ), row.names = c("1", "2", "3", "4", "5", "6"), class = "data.frame") 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -