[R] R: Some days missing using xtabs

2013-07-23 Thread Stefano Sofia
e: [R] Some days missing using xtabs Hello, Something I've just noticed, stringsAsFactors is not an argument to merge(). And, without changing the class I g a warning: Warning message: In `[<-.factor`(`*tmp*`, ri, value = 1:31) : invalid factor level, NA generated Rui Barradas Em 23-

Re: [R] Some days missing using xtabs

2013-07-23 Thread arun
HONE=C    [11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C   attached base packages: [1] stats graphics  grDevices utils     datasets  methods   base other attached packages: [1] stringr_0.6.2  reshape2_1.2.2 loaded via a namespace (and not attached): [1] plyr

Re: [R] Some days missing using xtabs

2013-07-23 Thread Rui Barradas
F-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] stringr_0.6.2 reshape2_1.2.2 loaded via a namespace (and not attached): [1] plyr_1.8 A.K. - Original Message - From: Rui Barradas To: St

Re: [R] Some days missing using xtabs

2013-07-23 Thread Rui Barradas
Hello, As for your second question, before merge(), try the following. release_freq$d_release <- as.integer(as.character(release_freq$d_release)) release_freq$m_release <- as.integer(as.character(release_freq$m_release)) release_freq$y_release <- as.integer(as.character(release_freq$y_release))

Re: [R] Some days missing using xtabs

2013-07-23 Thread Rui Barradas
Hello, Why should those numbers show up in the final result? They are missing in the original data frame. A hack could be fac <- factor(hospital_2004$d_release, levels = seq_len(max(hospital_2004$d_release))) as.data.frame(xtabs( ~ fac + m_release + y_release, data=hospital_2004)) And th

Re: [R] Some days missing using xtabs

2013-07-23 Thread Pascal Oettli
Hello, Please use dput() to provide useful dataset and avoid the use of HTML when sending a e-mail to this list. Regards, Pascal 2013/7/23 Stefano Sofia > Dear R-users, > given the following data frame called hospital_2004 > > gender d_birth m_birth y_birth address d_admittance m_admittance

[R] Some days missing using xtabs

2013-07-23 Thread Stefano Sofia
Dear R-users, given the following data frame called hospital_2004 gender d_birth m_birth y_birth address d_admittance m_admittance y_admittance yard_admittance d_release m_release y_release yard_release diaprinc diasec1 diasec2 diasec3 diasec4 diasec5 2 13 12 1929 42002 30 3 2004 3003 6 5 2004 4