Bob Green
2006-Jun-06 11:52 UTC
[R] Error in inherits(x, "data.frame") : object "Dataset" not found
I have been trying to run a logistic regression using a number of studies.
Below is the syntax, error message & data.
Any advice regarding what I am doing wrong or solutions are appreciated,
regards
Bob Green
> logreg <- read.csv("c:\\logregtest.csv",header=T)
> attach(logreg)
> names(logreg)
[1] "medyear" "where" "who"
"dxbroad" "firstep" "standard"
[7] "age" "sex" "successes"
"failures"
> model <- glm(cbind(successes, failures) ~medyear + age + sex + where +
who + dxbroad + firstep + standard, family=binomial, data=Dataset)
Error in inherits(x, "data.frame") : object "Dataset" not
found
medyear where who dxbroad firstep standard age sex successes failures
89 3 2 1 0 0 31.5 71 28 117
98 2 2 1 0 1 48 62 15 72
98 4 1 1 0 0 45.2 61 42 57
89 3 0 1 0 1 28.7 63 19 48
99 2 2 1 0 1 34.7 73 27 73
88 3 0 1 0 1 30.6 58 26 57
94 1 1 1 0 1 36.3 81 70 124
96 3 1 1 0 1 40 57 27 40
96 2 2 1 0 1 33.1 64 9 41
88 2 0 1 1 0 29.5 47 30 202
98 1 2 0 0 1 39.3 60 246 734
97 4 0 0 0 1 38.4 67 17 85
92 3 0 1 0 1 34.3 67 15 127
88 2 0 1 0 1 NA 46 9 90
85 3 0 1 0 1 30.3 64 58 87
94 3 0 1 0 1 38.8 47 47 126
88 3 0 1 0 1 33.8 54 25 134
92 3 0 1 1 1 NA NA 67 157
90 3 0 1 1 1 26 52 17 101
90 3 0 1 0 0 NA NA 39 32
90 2 0 1 0 1 36.1 38 10 173
90 2 0 1 0 1 38.9 53 64 383
97 2 0 1 0 1 31.5 61 12 52
99 1 1 1 0 1 NA NA 25 56
100 4 1 1 0 1 45 62 46 270
101 2 0 1 0 1 32.4 100 33 92
Dimitris Rizopoulos
2006-Jun-06 12:11 UTC
[R] Error in inherits(x, "data.frame") : object "Dataset" not found
you probably want to use:
model <- glm(cbind(successes, failures) ~ medyear + age + sex + where
+ who + dxbroad + firstep + standard, family = binomial, data =
logreg)
since you store the data you imported in the data.frame 'logreg' not
'Dataset'.
I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
http://www.student.kuleuven.be/~m0390867/dimitris.htm
----- Original Message -----
From: "Bob Green" <bgreen at dyson.brisnet.org.au>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, June 06, 2006 1:52 PM
Subject: [R] Error in inherits(x, "data.frame") : object
"Dataset" not
found
>I have been trying to run a logistic regression using a number of
>studies.
> Below is the syntax, error message & data.
>
> Any advice regarding what I am doing wrong or solutions are
> appreciated,
>
> regards
>
> Bob Green
>
>
> > logreg <- read.csv("c:\\logregtest.csv",header=T)
> > attach(logreg)
> > names(logreg)
> [1] "medyear" "where" "who"
"dxbroad" "firstep"
> "standard"
> [7] "age" "sex" "successes"
"failures"
> > model <- glm(cbind(successes, failures) ~medyear + age + sex +
> > where +
> who + dxbroad + firstep + standard, family=binomial, data=Dataset)
> Error in inherits(x, "data.frame") : object "Dataset"
not found
>
>
> medyear where who dxbroad firstep standard age sex successes
> failures
> 89 3 2 1 0 0 31.5 71 28 117
> 98 2 2 1 0 1 48 62 15 72
> 98 4 1 1 0 0 45.2 61 42 57
> 89 3 0 1 0 1 28.7 63 19 48
> 99 2 2 1 0 1 34.7 73 27 73
> 88 3 0 1 0 1 30.6 58 26 57
> 94 1 1 1 0 1 36.3 81 70 124
> 96 3 1 1 0 1 40 57 27 40
> 96 2 2 1 0 1 33.1 64 9 41
> 88 2 0 1 1 0 29.5 47 30 202
> 98 1 2 0 0 1 39.3 60 246 734
> 97 4 0 0 0 1 38.4 67 17 85
> 92 3 0 1 0 1 34.3 67 15 127
> 88 2 0 1 0 1 NA 46 9 90
> 85 3 0 1 0 1 30.3 64 58 87
> 94 3 0 1 0 1 38.8 47 47 126
> 88 3 0 1 0 1 33.8 54 25 134
> 92 3 0 1 1 1 NA NA 67 157
> 90 3 0 1 1 1 26 52 17 101
> 90 3 0 1 0 0 NA NA 39 32
> 90 2 0 1 0 1 36.1 38 10 173
> 90 2 0 1 0 1 38.9 53 64 383
> 97 2 0 1 0 1 31.5 61 12 52
> 99 1 1 1 0 1 NA NA 25 56
> 100 4 1 1 0 1 45 62 46 270
> 101 2 0 1 0 1 32.4 100 33 92
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
Prof Brian Ripley
2006-Jun-06 12:18 UTC
[R] Error in inherits(x, "data.frame") : object "Dataset" not found
On Tue, 6 Jun 2006, Bob Green wrote:> I have been trying to run a logistic regression using a number of studies. > Below is the syntax, error message & data. > > Any advice regarding what I am doing wrong or solutions are appreciated,I suspect you wanted logreg <- read.csv("c:\\logregtest.csv", header=TRUE) model <- glm(cbind(successes, failures) ~ ., family=binomial, data=logreg)> > regards > > Bob Green > > > > logreg <- read.csv("c:\\logregtest.csv",header=T) > > attach(logreg) > > names(logreg) > [1] "medyear" "where" "who" "dxbroad" "firstep" "standard" > [7] "age" "sex" "successes" "failures" > > model <- glm(cbind(successes, failures) ~medyear + age + sex + where + > who + dxbroad + firstep + standard, family=binomial, data=Dataset) > Error in inherits(x, "data.frame") : object "Dataset" not found[...] -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595