[R] Error in family$family : $ operator is invalid for atomic vectors

2009-10-11 Thread romunov
Dear List,

I'm having problem with an exercise from The R book (M.J. Crawley) on page
567.
Here is the entire code upto the point where I get an error.

data(UCBAdmissions)
x - aperm(UCBAdmissions, c(2, 1, 3))
names(dimnames(x)) - c(Sex, Admit?, Department)
ftable(x)
fourfoldplot(x, margin = 2)
dept-gl(6,4)
sex-gl(2,1,24)
admit-gl(2,2,24)
model1-glm(as.vector(x) ~dept*sex*admit,poisson)

This last line returns:

Error in family$family : $ operator is invalid for atomic vectors

I've searched older posts but found nothing that would help resolve my
problem. Has anyone encountered anything similar and/or knows a fix?

Cheers,
Roman

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Error in family$family : $ operator is invalid for atomic vectors

2009-10-11 Thread Barry Rowlingson
On Sun, Oct 11, 2009 at 4:54 PM, romunov romu...@gmail.com wrote:
 Dear List,

 I'm having problem with an exercise from The R book (M.J. Crawley) on page
 567.
 Here is the entire code upto the point where I get an error.

 data(UCBAdmissions)
 x - aperm(UCBAdmissions, c(2, 1, 3))
 names(dimnames(x)) - c(Sex, Admit?, Department)
 ftable(x)
 fourfoldplot(x, margin = 2)
 dept-gl(6,4)
 sex-gl(2,1,24)
 admit-gl(2,2,24)
 model1-glm(as.vector(x) ~dept*sex*admit,poisson)

 This last line returns:

 Error in family$family : $ operator is invalid for atomic vectors

 I've searched older posts but found nothing that would help resolve my
 problem. Has anyone encountered anything similar and/or knows a fix?


 Works for me:

 model1-glm(as.vector(x) ~dept*sex*admit,poisson)
 model1

Call:  glm(formula = as.vector(x) ~ dept * sex * admit, family = poisson)

Coefficients:
  (Intercept)  dept2  dept3  dept4
  6.23832   -0.37186   -1.45083   -1.31107
 [etc]

What's your version:

 version
   _
platform   i486-pc-linux-gnu
arch   i486
os linux-gnu
system i486, linux-gnu
status
major  2
minor  9.2
year   2009
month  08
day24
svn rev49384
language   R
version.string R version 2.9.2 (2009-08-24)

Barry

__
R-help@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.


Re: [R] Error in family$family : $ operator is invalid for atomic vectors

2009-10-11 Thread Jorge Ivan Velez
Hi Romain,
It works for me:

model1 - glm(as.vector(x) ~dept*sex*admit,poisson)
model1

Call:  glm(formula = as.vector(x) ~ dept * sex * admit, family = poisson)

Coefficients:
  (Intercept)  dept2  dept3  dept4
   dept5
  6.23832   -0.37186   -1.45083   -1.31107
-2.26803
dept6   sex2 admit2 dept2:sex2
  dept3:sex2

[trimmed]

Here is my sessionInfo():

R version 2.9.2 RC (2009-08-23 r49375)
i386-pc-mingw32

locale:
LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
States.1252;LC_MONETARY=English_United
States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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

other attached packages:
[1] lattice_0.17-25 combinat_0.0-6

loaded via a namespace (and not attached):
[1] grid_2.9.0  tools_2.9.0


HTH,
Jorge


On Sun, Oct 11, 2009 at 11:54 AM, romunov  wrote:

 Dear List,

 I'm having problem with an exercise from The R book (M.J. Crawley) on page
 567.
 Here is the entire code upto the point where I get an error.

 data(UCBAdmissions)
 x - aperm(UCBAdmissions, c(2, 1, 3))
 names(dimnames(x)) - c(Sex, Admit?, Department)
 ftable(x)
 fourfoldplot(x, margin = 2)
 dept-gl(6,4)
 sex-gl(2,1,24)
 admit-gl(2,2,24)
 model1-glm(as.vector(x) ~dept*sex*admit,poisson)

 This last line returns:

 Error in family$family : $ operator is invalid for atomic vectors

 I've searched older posts but found nothing that would help resolve my
 problem. Has anyone encountered anything similar and/or knows a fix?

 Cheers,
 Roman

[[alternative HTML version deleted]]

 __
 R-help@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.


[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Error in family$family : $ operator is invalid for atomic vectors

2009-10-11 Thread romunov
Thank you Jorge and Barry for your input.

I've fiddled around a bit and as a result, am even more confused. If I start
R console via Notepad++ (I use Npp2R) and execute the model1, it goes
through just fine. Here is the sessionInfo() for this working session:

 sessionInfo()
R version 2.9.2 (2009-08-24)
i386-pc-mingw32

locale:
LC_COLLATE=Slovenian_Slovenia.1250;LC_CTYPE=Slovenian_Slovenia.1250;LC_MONETARY=Slovenian_Slovenia.1250;LC_NUMERIC=C;LC_TIME=Slovenian_Slovenia.1250

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

loaded via a namespace (and not attached):
[1] tools_2.9.2

And if I run R normally, via an icon from the desktop (Rgui.exe) it gives
the aforementioned error. Here is the sessionInfo() for non-working
session. Is it possible that grid, reshape, plyr, ggplot2 and proto could be
causing this? If so, how can I prevent them from loading automatically or
unloading from a live session?

 sessionInfo()
R version 2.9.2 (2009-08-24)
i386-pc-mingw32

locale:
LC_COLLATE=Slovenian_Slovenia.1250;LC_CTYPE=Slovenian_Slovenia.1250;LC_MONETARY=Slovenian_Slovenia.1250;LC_NUMERIC=C;LC_TIME=Slovenian_Slovenia.1250

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

other attached packages:
[1] reshape_0.8.3 plyr_0.1.9proto_0.3-8

loaded via a namespace (and not attached):
[1] ggplot2_0.8.3


Cheers,
Roman



On Sun, Oct 11, 2009 at 6:32 PM, Jorge Ivan Velez
jorgeivanve...@gmail.comwrote:

 Hi Romain,
 It works for me:

 model1 - glm(as.vector(x) ~dept*sex*admit,poisson)
 model1

 Call:  glm(formula = as.vector(x) ~ dept * sex * admit, family = poisson)

 Coefficients:
   (Intercept)  dept2  dept3  dept4
  dept5
   6.23832   -0.37186   -1.45083   -1.31107
   -2.26803
 dept6   sex2 admit2 dept2:sex2
 dept3:sex2

 [trimmed]

 Here is my sessionInfo():

 R version 2.9.2 RC (2009-08-23 r49375)
 i386-pc-mingw32

 locale:
 LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
 States.1252;LC_MONETARY=English_United
 States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252

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

 other attached packages:
 [1] lattice_0.17-25 combinat_0.0-6

 loaded via a namespace (and not attached):
 [1] grid_2.9.0  tools_2.9.0


 HTH,
 Jorge


 On Sun, Oct 11, 2009 at 11:54 AM, romunov  wrote:

 Dear List,

 I'm having problem with an exercise from The R book (M.J. Crawley) on page
 567.
 Here is the entire code upto the point where I get an error.

 data(UCBAdmissions)
 x - aperm(UCBAdmissions, c(2, 1, 3))
 names(dimnames(x)) - c(Sex, Admit?, Department)
 ftable(x)
 fourfoldplot(x, margin = 2)
 dept-gl(6,4)
 sex-gl(2,1,24)
 admit-gl(2,2,24)
 model1-glm(as.vector(x) ~dept*sex*admit,poisson)

 This last line returns:

 Error in family$family : $ operator is invalid for atomic vectors

 I've searched older posts but found nothing that would help resolve my
 problem. Has anyone encountered anything similar and/or knows a fix?

 Cheers,
 Roman

[[alternative HTML version deleted]]

 __
 R-help@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.




[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Error in family$family : $ operator is invalid for atomic vectors

2009-10-11 Thread Sundar Dorai-Raj
Check to see if you have an old workspace being loaded. You might have an
object called 'family' which you might need to remove.

--sundar

On Oct 11, 2009 12:15 PM, romunov romu...@gmail.com wrote:

Thank you Jorge and Barry for your input.

I've fiddled around a bit and as a result, am even more confused. If I start
R console via Notepad++ (I use Npp2R) and execute the model1, it goes
through just fine. Here is the sessionInfo() for this working session:

 sessionInfo()
R version 2.9.2 (2009-08-24)
i386-pc-mingw32

locale:
LC_COLLATE=Slovenian_Slovenia.1250;LC_CTYPE=Slovenian_Slovenia.1250;LC_MONETARY=Slovenian_Slovenia.1250;LC_NUMERIC=C;LC_TIME=Slovenian_Slovenia.1250

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

loaded via a namespace (and not attached):
[1] tools_2.9.2

And if I run R normally, via an icon from the desktop (Rgui.exe) it gives
the aforementioned error. Here is the sessionInfo() for non-working
session. Is it possible that grid, reshape, plyr, ggplot2 and proto could be
causing this? If so, how can I prevent them from loading automatically or
unloading from a live session?

 sessionInfo()
R version 2.9.2 (2009-08-24)
i386-pc-mingw32

locale:
LC_COLLATE=Slovenian_Slovenia.1250;LC_CTYPE=Slovenian_Slovenia.1250;LC_MONETARY=Slovenian_Slovenia.1250;LC_NUMERIC=C;LC_TIME=Slovenian_Slovenia.1250

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

other attached packages:
[1] reshape_0.8.3 plyr_0.1.9proto_0.3-8

loaded via a namespace (and not attached):
[1] ggplot2_0.8.3


Cheers,
Roman



On Sun, Oct 11, 2009 at 6:32 PM, Jorge Ivan Velez
jorgeivanve...@gmail.comwrote:

 Hi Romain,  It works for me:   model1 - glm(as.vector(x)
~dept*sex*admit,poisson)  model1  ...

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Error in family$family : $ operator is invalid for atomic vectors

2009-10-11 Thread romunov
Hello Sundar,

I checked the ls() and it was full of something (something that I should
have removed long ago but was not diligent enough). I have cleared the list
(via rm(list=ls()) and the glm function works fine now.

Cheers,
Roman



On Sun, Oct 11, 2009 at 9:21 PM, Sundar Dorai-Raj sdorai...@gmail.comwrote:

 Check to see if you have an old workspace being loaded. You might have an
 object called 'family' which you might need to remove.

 --sundar

 On Oct 11, 2009 12:15 PM, romunov romu...@gmail.com wrote:

 Thank you Jorge and Barry for your input.

 I've fiddled around a bit and as a result, am even more confused. If I
 start
 R console via Notepad++ (I use Npp2R) and execute the model1, it goes
 through just fine. Here is the sessionInfo() for this working session:

  sessionInfo()
 R version 2.9.2 (2009-08-24)
 i386-pc-mingw32

 locale:

 LC_COLLATE=Slovenian_Slovenia.1250;LC_CTYPE=Slovenian_Slovenia.1250;LC_MONETARY=Slovenian_Slovenia.1250;LC_NUMERIC=C;LC_TIME=Slovenian_Slovenia.1250

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

 loaded via a namespace (and not attached):
 [1] tools_2.9.2

 And if I run R normally, via an icon from the desktop (Rgui.exe) it gives
 the aforementioned error. Here is the sessionInfo() for non-working
 session. Is it possible that grid, reshape, plyr, ggplot2 and proto could
 be
 causing this? If so, how can I prevent them from loading automatically or
 unloading from a live session?

  sessionInfo()
 R version 2.9.2 (2009-08-24)
 i386-pc-mingw32

 locale:

 LC_COLLATE=Slovenian_Slovenia.1250;LC_CTYPE=Slovenian_Slovenia.1250;LC_MONETARY=Slovenian_Slovenia.1250;LC_NUMERIC=C;LC_TIME=Slovenian_Slovenia.1250

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

 other attached packages:
 [1] reshape_0.8.3 plyr_0.1.9proto_0.3-8

 loaded via a namespace (and not attached):
 [1] ggplot2_0.8.3


 Cheers,
 Roman



 On Sun, Oct 11, 2009 at 6:32 PM, Jorge Ivan Velez
 jorgeivanve...@gmail.comwrote:

  Hi Romain,  It works for me:   model1 - glm(as.vector(x)
 ~dept*sex*admit,poisson)  model1  ...



[[alternative HTML version deleted]]

__
R-help@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.