Discussion:
[R] [survMisc]: error message in examples of comp()
Gerrit Eichner
2014-10-17 20:39:26 UTC
Permalink
Hello, list members,

I have tried to contact the maintainer of the survMisc package, but my
message could not be delivered. I can't get survMisc package to work as
expected or documented, respectively. Maybe one of you has an idea
regarding the following problem:

When, e.g., trying to executed the first few lines of code in the examples
section of comp() (one of the package functions), i.e.,
data(kidney,package="KMsurv")
s1 <- survfit(Surv(time=time, event=delta) ~ type, data=kidney)
comp(s1)
I receive the following error message:

Error in parse(text = t2) : <text>:1:8: unexpected input
1: paste( ``
^


Could this be an encoding-related issue inside the code? Does somebody
have an idea where to look for a solution for this problem?

Below you'll find my survMisc version and R session info. Thanks for any
support!

Kind regards -- Gerrit

---------------------------------------------------------------------
Dr. Gerrit Eichner Mathematical Institute, Room 212
gerrit.eichner at math.uni-giessen.de Justus-Liebig-University Giessen
Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany
Fax: +49-(0)641-99-32109 http://www.uni-giessen.de/cms/eichner
---------------------------------------------------------------------
citation( "survMisc")
To cite package .survMisc. in publications use:

Chris Dardis (2014). survMisc: Miscellaneous functions for survival
data.. R package version 0.4.2.
http://CRAN.R-project.org/package=survMisc
sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252

attached base packages:
[1] splines stats graphics grDevices utils datasets methods
[8] base

other attached packages:
[1] survMisc_0.4.2 rpart_4.1-8 data.table_1.9.2 ggplot2_1.0.0
[5] survival_2.37-7 fortunes_1.5-2

loaded via a namespace (and not attached):
[1] colorspace_1.2-4 digest_0.6.4 gam_1.09.1 grid_3.1.1
[5] gtable_0.1.2 km.ci_0.5-2 KMsurv_0.1-5 MASS_7.3-33
[9] munsell_0.4.2 plyr_1.8.1 proto_0.3-10 Rcpp_0.11.2
[13] reshape2_1.4 scales_0.2.4 stringr_0.6.2 tools_3.1.1
David Winsemius
2014-10-18 00:34:34 UTC
Permalink
Post by Gerrit Eichner
Hello, list members,
When, e.g., trying to executed the first few lines of code in the examples section of comp() (one of the package functions), i.e.,
data(kidney,package="KMsurv")
s1 <- survfit(Surv(time=time, event=delta) ~ type, data=kidney)
comp(s1)
Error in parse(text = t2) : <text>:1:8: unexpected input
1: paste( ``
^
I get the same error on a Mac in an English locale. I'm afraid the code in the offending function `.getTne` appears somewhat cobbled together. When I try to debug, I get a single row, 1920 column matrix for n1 which is numeric with all entries == 1. Object `t1` cannot be found.

{
s <- Es <- .SD <- NULL
n1 <- names(dt1)
f1 <- function(x) paste(dQuote(paste(x, "=", sep = "")),
", get(", dQuote(x), ")", sep = "")
t1 <- paste(sapply(n1, f1), sep = ",")
if (length(t1) > 1) {
t1[2:length(t1)] <- sub("\"", "\"_", t1[2:length(t1)],
fixed = TRUE)
}
t1 <- paste(t1, collapse = ",")
t2 <- paste("paste(", t1, ", sep='')")

# next line throw the error.

p1 <- parse(text = t2)
q <- quote(eval(p1))
dt1[, `:=`("s", as.factor(eval(q, envir = .SD)))]
stopifnot(attr(model.response(mf), "type") == "right")
y <- data.table(unclass(model.response(mf, "numeric")))

I'm afraid I have been o help.
--
David.
Post by Gerrit Eichner
Could this be an encoding-related issue inside the code? Does somebody have an idea where to look for a solution for this problem?
Below you'll find my survMisc version and R session info. Thanks for any support!
Kind regards -- Gerrit
---------------------------------------------------------------------
Dr. Gerrit Eichner Mathematical Institute, Room 212
gerrit.eichner at math.uni-giessen.de Justus-Liebig-University Giessen
Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany
Fax: +49-(0)641-99-32109 http://www.uni-giessen.de/cms/eichner
---------------------------------------------------------------------
citation( "survMisc")
Chris Dardis (2014). survMisc: Miscellaneous functions for survival
data.. R package version 0.4.2.
http://CRAN.R-project.org/package=survMisc
sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
[1] splines stats graphics grDevices utils datasets methods
[8] base
[1] survMisc_0.4.2 rpart_4.1-8 data.table_1.9.2 ggplot2_1.0.0
[5] survival_2.37-7 fortunes_1.5-2
[1] colorspace_1.2-4 digest_0.6.4 gam_1.09.1 grid_3.1.1
[5] gtable_0.1.2 km.ci_0.5-2 KMsurv_0.1-5 MASS_7.3-33
[9] munsell_0.4.2 plyr_1.8.1 proto_0.3-10 Rcpp_0.11.2
[13] reshape2_1.4 scales_0.2.4 stringr_0.6.2 tools_3.1.1
______________________________________________
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.
David Winsemius
Alameda, CA, USA
William Dunlap
2014-10-18 00:57:26 UTC
Permalink
If you execute the command
options(useFancyQuotes=FALSE)
before calling comp(s1) that error should go away.

dQuote() was being used inappropriately - its value depends on the
option "useFancyQuotes" so should really only be used for messages or
text that machines don't have to parse.

Bill Dunlap
TIBCO Software
wdunlap tibco.com
Post by David Winsemius
Post by Gerrit Eichner
Hello, list members,
When, e.g., trying to executed the first few lines of code in the examples section of comp() (one of the package functions), i.e.,
data(kidney,package="KMsurv")
s1 <- survfit(Surv(time=time, event=delta) ~ type, data=kidney)
comp(s1)
Error in parse(text = t2) : <text>:1:8: unexpected input
1: paste( ``
^
I get the same error on a Mac in an English locale. I'm afraid the code in the offending function `.getTne` appears somewhat cobbled together. When I try to debug, I get a single row, 1920 column matrix for n1 which is numeric with all entries == 1. Object `t1` cannot be found.
{
s <- Es <- .SD <- NULL
n1 <- names(dt1)
f1 <- function(x) paste(dQuote(paste(x, "=", sep = "")),
", get(", dQuote(x), ")", sep = "")
t1 <- paste(sapply(n1, f1), sep = ",")
if (length(t1) > 1) {
t1[2:length(t1)] <- sub("\"", "\"_", t1[2:length(t1)],
fixed = TRUE)
}
t1 <- paste(t1, collapse = ",")
t2 <- paste("paste(", t1, ", sep='')")
# next line throw the error.
p1 <- parse(text = t2)
q <- quote(eval(p1))
dt1[, `:=`("s", as.factor(eval(q, envir = .SD)))]
stopifnot(attr(model.response(mf), "type") == "right")
y <- data.table(unclass(model.response(mf, "numeric")))
I'm afraid I have been o help.
--
David.
Post by Gerrit Eichner
Could this be an encoding-related issue inside the code? Does somebody have an idea where to look for a solution for this problem?
Below you'll find my survMisc version and R session info. Thanks for any support!
Kind regards -- Gerrit
---------------------------------------------------------------------
Dr. Gerrit Eichner Mathematical Institute, Room 212
gerrit.eichner at math.uni-giessen.de Justus-Liebig-University Giessen
Tel: +49-(0)641-99-32104 Arndtstr. 2, 35392 Giessen, Germany
Fax: +49-(0)641-99-32109 http://www.uni-giessen.de/cms/eichner
---------------------------------------------------------------------
citation( "survMisc")
Chris Dardis (2014). survMisc: Miscellaneous functions for survival
data.. R package version 0.4.2.
http://CRAN.R-project.org/package=survMisc
sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
[1] splines stats graphics grDevices utils datasets methods
[8] base
[1] survMisc_0.4.2 rpart_4.1-8 data.table_1.9.2 ggplot2_1.0.0
[5] survival_2.37-7 fortunes_1.5-2
[1] colorspace_1.2-4 digest_0.6.4 gam_1.09.1 grid_3.1.1
[5] gtable_0.1.2 km.ci_0.5-2 KMsurv_0.1-5 MASS_7.3-33
[9] munsell_0.4.2 plyr_1.8.1 proto_0.3-10 Rcpp_0.11.2
[13] reshape2_1.4 scales_0.2.4 stringr_0.6.2 tools_3.1.1
______________________________________________
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.
David Winsemius
Alameda, CA, USA
______________________________________________
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.
Loading...