[R] error using by, Error in tapply(response, list(x.factor, trace.factor), fun) : argument "trace.factor" is missing, with no default

John Sorkin JSorkin at grecc.umaryland.edu
Sun Apr 19 16:33:50 CEST 2015



I am receiving an error message from the by function that I don't understand:
Error in tapply(response, list(x.factor, trace.factor), fun) : 
  argument "trace.factor" is missing, with no default



My code follows:


> summary(ipd)
 group      values            time      subjects     weaned disp  
 1:55   Min.   :0.0000   Min.   :0   Min.   :115.0   1:65   2:45  
 2:35   1st Qu.:0.1950   1st Qu.:1   1st Qu.:121.0   2:25   3: 5  
        Median :0.3400   Median :2   Median :126.0          4:20  
        Mean   :0.3479   Mean   :2   Mean   :127.6          5:20  
        3rd Qu.:0.5000   3rd Qu.:3   3rd Qu.:134.0                
        Max.   :0.7300   Max.   :4   Max.   :144.0                
        NA's   :48                                                
> by(ipd[,c("time","subjects","values")],ipd[,"group"],interaction.plot)
Error in tapply(response, list(x.factor, trace.factor), fun) : 
  argument "trace.factor" is missing, with no default




These are my data.
> ipd
   group values time subjects weaned disp
1      1   0.00    0      115      1    2
2      1   0.00    1      115      1    2
3      1   0.18    2      115      1    2
4      1   0.17    3      115      1    2
5      1     NA    4      115      1    2
6      1   0.62    0      116      1    2
7      1     NA    1      116      1    2
8      1     NA    2      116      1    2
9      1     NA    3      116      1    2
10     1     NA    4      116      1    2
11     1   0.00    0      118      1    2
12     1   0.21    1      118      1    2
13     1   0.34    2      118      1    2
14     1   0.49    3      118      1    2
15     1     NA    4      118      1    2
16     2   0.52    0      119      2    4
17     2     NA    1      119      2    4
18     2     NA    2      119      2    4
19     2     NA    3      119      2    4
20     2     NA    4      119      2    4
21     2   0.35    0      121      2    3
22     2   0.53    1      121      2    3
23     2   0.35    2      121      2    3
24     2   0.44    3      121      2    3
25     2   0.56    4      121      2    3
26     1   0.16    0      122      1    5
27     1   0.22    1      122      1    5
28     1     NA    2      122      1    5
29     1     NA    3      122      1    5
30     1     NA    4      122      1    5
31     1   0.19    0      123      2    5
32     1     NA    1      123      2    5
33     1     NA    2      123      2    5
34     1     NA    3      123      2    5
35     1     NA    4      123      2    5
36     2   0.29    0      124      1    4
37     2   0.22    1      124      1    4
38     2     NA    2      124      1    4
39     2     NA    3      124      1    4
40     2     NA    4      124      1    4
41     1   0.38    0      125      1    4
42     1   0.45    1      125      1    4
43     1     NA    2      125      1    4
44     1     NA    3      125      1    4
45     1     NA    4      125      1    4
46     1   0.22    0      127      1    2
47     1   0.37    1      127      1    2
48     1   0.28    2      127      1    2
49     1   0.50    3      127      1    2
50     1     NA    4      127      1    2
51     1   0.30    0      130      1    2
52     1   0.49    1      130      1    2
53     1     NA    2      130      1    2
54     1     NA    3      130      1    2
55     1     NA    4      130      1    2
56     1   0.70    0      131      1    2
57     1     NA    1      131      1    2
58     1     NA    2      131      1    2
59     1     NA    3      131      1    2
60     1     NA    4      131      1    2
61     2   0.00    0      133      1    2
62     2   0.50    1      133      1    2
63     2   0.56    2      133      1    2
64     2   0.73    3      133      1    2
65     2     NA    4      133      1    2
66     1   0.22    0      134      1    2
67     1   0.65    1      134      1    2
68     1     NA    2      134      1    2
69     1     NA    3      134      1    2
70     1     NA    4      134      1    2
71     2   0.34    0      135      1    2
72     2   0.73    1      135      1    2
73     2   0.71    2      135      1    2
74     2     NA    3      135      1    2
75     2     NA    4      135      1    2
76     2   0.26    0      139      2    5
77     2     NA    1      139      2    5
78     2     NA    2      139      2    5
79     2     NA    3      139      2    5
80     2     NA    4      139      2    5
81     1   0.00    0      140      1    5
82     1   0.19    1      140      1    5
83     1     NA    2      140      1    5
84     1     NA    3      140      1    5
85     1     NA    4      140      1    5
86     2   0.19    0      144      2    4
87     2     NA    1      144      2    4
88     2     NA    2      144      2    4
89     2     NA    3      144      2    4
90     2     NA    4      144      2    4


John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing) 




Call
Send SMS
Add to Skype
You'll need Skype CreditFree via Skype

John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing) 





John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing) 


Confidentiality Statement:
This email message, including any attachments, is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. 


More information about the R-help mailing list