Re: [Rd] bad variable names when printing a data frame containing a matrix (PR#10730)

2008-02-09 Thread Peter Dalgaard
[EMAIL PROTECTED] wrote:
> library(glmpath)
> data(heart.data)
> # heart.data is a list, $y a vector, $x a matrix
> data <- data.frame(x=I(heart.data$x), y = heart.data$y)
>   
>> data[1:2,]
>> 
> x.1   x.2   x.3   x.4   x.5   x.6   x.7   x.8   x.9 y
> 1   16012  5.73 23.11 149  25.3  97.252 1
> 2   144  0.01  4.41 28.61 055 28.87  2.0663 1
>   
>> dimnames(heart.data$x)[[2]]
>> 
> [1] "sbp"   "tobacco"   "ldl"   "adiposity" "famhist"   "typea"
> [7] "obesity"   "alcohol"   "age"  
>
> Note that the printed variable names do not use the column names
> of the matrix.
>
> In contrast, in S-PLUS the names are used; the printout begins:
>x.sbp x.tobacco  x.ldl x.adiposity x.famhist x.typea x.obesity x.alcohol 
>   
The reason seems to be that format.AsIs is losing dimnames. That could 
be easily fixed -- unless I'm overlooking something?

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] bad variable names when printing a data frame containing (PR#10732)

2008-02-09 Thread p . dalgaard
[EMAIL PROTECTED] wrote:
> library(glmpath)
> data(heart.data)
> # heart.data is a list, $y a vector, $x a matrix
> data <- data.frame(x=3DI(heart.data$x), y =3D heart.data$y)
>  =20
>> data[1:2,]
>>=20
> x.1   x.2   x.3   x.4   x.5   x.6   x.7   x.8   x.9 y
> 1   16012  5.73 23.11 149  25.3  97.252 1
> 2   144  0.01  4.41 28.61 055 28.87  2.0663 1
>  =20
>> dimnames(heart.data$x)[[2]]
>>=20
> [1] "sbp"   "tobacco"   "ldl"   "adiposity" "famhist"   "typea"=
   =20
> [7] "obesity"   "alcohol"   "age" =20
>
> Note that the printed variable names do not use the column names
> of the matrix.
>
> In contrast, in S-PLUS the names are used; the printout begins:
>x.sbp x.tobacco  x.ldl x.adiposity x.famhist x.typea x.obesity x.alc=
ohol=20
>  =20
The reason seems to be that format.AsIs is losing dimnames. That could=20
be easily fixed -- unless I'm overlooking something?

--=20
   O__   Peter Dalgaard =D8ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327=
918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327=
907

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Problem with fitdistr function while estimating parameters

2008-02-09 Thread Aswad Gurjar
 Hello,

I am using fitdistr function for parameter estimation.
 When I use
fd<-fitdistr(V2,"gamma")
I get following error:
Error in optim(x = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,  :
initial value in 'vmmin' is not finite

  fd<-fitdistr(V2,"weibull")
Error in optim(x = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,  :
non-finite value supplied by optim

But if I use following I dont get any errors.
fd<-fitdistr(V2,"exponential")

I have included necessary libraries.
How can i remove this error?Are there any restrictions in using fitdistr
function?If yes is there any alternative approach for solving such problem?
My aim is to get estimated value of parameters.

Data is as follows:
N
   V1  V2
1   32400   0
2   32460   0
3   32520   0
4   32580   0
5   32640   0
6   32700   0
7   32760   0
8   32820   0
9   32880   0
10  32940   0
11  33000   0
12  33060   0
13  33120   0
14  33180   0
15  33240   0
16  33300   0
17  33360   0
18  33420   0
19  33480   0
20  33540   0
21  33600   0
22  33660   0
23  33720   0
24  33780   0
25  33840   0
26  33900   0
27  33960   0
28  34020   0
29  34080   0
30  34140   0
31  34200   0
32  34260   0
33  34320   0
34  34380   0
35  34440   0
36  34500   0
37  34560   0
38  34620   0
39  34680   0
40  34740   0
41  34800   0
42  34860   0
43  34920   0
44  34980   0
45  35040   0
46  35100   0
47  35160   0
48  35220  32
49  35280   0
50  35340   0
51  35400   0
52  35460   0
53  35520   0
54  35580   0
55  35640   0
56  35700   0
57  35760   0
58  35820   0
59  35880   0
60  35940   0
61  36000   0
62  36060   0
63  36120  31
64  36180  32
65  36240   0
66  36300   0
67  36360   0
68  36420   0
69  36480   0
70  36540   0
71  36600   0
72  36660   0
73  36720   0
74  36780   0
75  36840   0
76  36900   0
77  36960   0
78  37020   0
79  37080   0
80  37140   0
81  37200   0
82  37260   0
83  37320   0
84  37380   0
85  37440   0
86  37500   0
87  37560   0
88  37620   0
89  37680   0
90  37740   0
91  37800   0
92  37860   0
93  37920  32
94  37980   0
95  38040   0
96  38100   0
97  38160   0
98  38220   0
99  38280   0
100 38340   0
101 38400   0
102 38460   0
103 38520   0
104 38580   0
105 38640   0
106 38700   0
107 38760   0
108 38820  32
109 38880  32
110 38940  32
111 39000   0
112 39060   0
113 39120   0
114 39180   0
115 39240   0
116 39300   0
117 39360   0
118 39420   0
119 39480   0
120 39540   0
121 39600   0
122 39660   0
123 39720  32
124 39780  32
125 39840  77
126 39900   0
127 39960   0
128 40020   0
129 40080   0
130 40140   0
131 40200   0
132 40260   0
133 40320   0
134 40380   0
135 40440   0
136 40500   0
137 40560   0
138 40620  32
139 40680  32
140 40740 109
141 40800  67
142 40860  92
143 40920   0
144 40980   0
145 41040   0
146 41100   0
147 41160   0
148 41220   0
149 41280   0
150 41340   0
151 41400   0
152 41460   0
153 41520 112
154 41580   0
155 41640   0
156 41700   0
157 41760   0
158 41820   0
159 41880   0
160 41940   0
161 42000   0
162 42060   0
163 42120   0
164 42180   0
165 42240   0
166 42300   0
167 42360   0
168 42420   0
169 42480   0
170 42540  66
171 42600   0
172 42660  93
173 42720   0
174 42780   0
175 42840   0
176 42900   0
177 42960   0
178 43020   0
179 43080   0
180 43140   0
181 43200   0
182 43260   0
183 43320   0
184 43380   0
185 43440   0
186 43500   0
187 43560   0
188 43620   0
189 43680 138
190 43740   0
191 43800   0
192 43860   0
193 43920   0
194 43980   0
195 44040   0
196 44100   0
197 44160   0
198 44220   0
199 44280   0
200 44340   0
201 44400   0
202 44460   0
203 44520   0
204 44580   0
205 44640   0
206 44700   0
207 44760   0
208 44820   0
209 44880   0
210 44940   0
211 45000   0
212 45060   0
213 45120  69
214 45180  90
215 45240   0
216 45300   0
217 45360 112
218 45420   0
219 45480   0
220 45540   0
221 45600  87
222 45660   0
223 45720  97
224 45780   0
225 45840   0
226 45900   0
227 45960   0
228 46020   0
229 46080   0
230 46140   0
231 46200   0
232 46260   0
233 46320  92
234 46380   0
235 46440   0
236 46500   0
237 46560   0
238 46620   0
239 46680   0
240 46740   0
241 46800   0
242 46860   0
243 46920   0
244 46980   0
245 47040   0
246 47100   0
247 47160   0
248 47220   0
249 47280   0
250 47340   0
251 47400   0
252 47460   0
253 47520   0
254 47580   0
255 47640   0
256 47700   0
257 47760   0
258 47820   0
259 47880   0
260 47940   0
261 48000   0
262 48060   0
263 48120   0
264 48180   0
265 48240   0
266 48300   0
267 48360   0
268 48420   0
269 48480   0
270 48540   0
271 48600   0
272 48660   0
273 48720   0
274 48780   0
275 48840   0
276 48900   0
277 48960   0
278 49020   0
279 49080   0
280 49140   0
281 49200   0
282 49260   0
283 49320   0
284 49380   0
285 49440   0
286 49500   0
287 49560   0
288 49620  32
289 49680  32
290 49740   0
291 49800   0
292 49860   0
293 49920   0
294 49980  33
295 50040   0
296 50100   0
297 50160   0
298 50220   0
299 50280   0
300 50340   0
301 50400   0
302 50460   0
303 50520 102
304 50580  

Re: [Rd] Problem with fitdistr function while estimating parameters

2008-02-09 Thread Peter Dalgaard
Aswad Gurjar wrote:
>  Hello,
>
> I am using fitdistr function for parameter estimation.
>  When I use
> fd<-fitdistr(V2,"gamma")
> I get following error:
>   
Please do not post to multiple lists. This is a usage question, not a 
development one.

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] help with R rendering engine

2008-02-09 Thread Michael Lawrence
On Feb 7, 2008 4:49 PM, Mark W Kimpel <[EMAIL PROTECTED]> wrote:

> I'm doing some work on a potential patch to the Bioconductor package
> Rgraphviz and have some questions on code that is contained in engine.c.
> In particular, I am developing some custom shapes using polygon and need
> to make sure that, with rendering, the line connecting the centers of
> two polygons stops at the border of each polygon. The polygons can be
> transparent, so the option of just rendering the lines first won't work.
>
> Is there some help for me with an R internal or perhaps a higher level
> function?
>

I have to admit I am not that familiar with R graphics, but a very common
way to achieve this in general is to use clipping. That is, you would set
the regions covered by your node polygons as the "clip" and then draw your
edges. Anything drawn onto the clip region is discarded. You would then
reset the clip and continue drawing.

I'm pretty sure that base R does not support the complex clip regions you
would require. However, it would be possible to do this in R by rendering to
pixmaps in memory and then compositing the pixmaps. The first part is
supported by the cairoDevice package and the latter part by RGtk2 (in
particular its binding to GDK). I'm sure you'd rather not introduce such a
dependency on Rgraphviz, but it's an option. I think the graphviz developers
are moving towards GTK+/Cairo in terms of plugins and other work.

I checked libgd (already a dependency of graphviz) but found that it only
supports a single rectangle for clipping.

Anyway, I hope this helps a little and good luck,
Michael


> Thanks,
> Mark
> --
>
> Mark W. Kimpel MD  ** Neuroinformatics ** Dept. of Psychiatry
> Indiana University School of Medicine
>
> 15032 Hunter Court, Westfield, IN  46074
>
> (317) 490-5129 Work, & Mobile & VoiceMail
> (317) 204-4202 Home (no voice mail please)
>
> mwkimpelgmailcom
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] .. printing a data frame containing a matrix (PR#10730)

2008-02-09 Thread Peter Dalgaard
Peter Dalgaard wrote:
> [EMAIL PROTECTED] wrote:
>   
>> library(glmpath)
>> data(heart.data)
>> # heart.data is a list, $y a vector, $x a matrix
>> data <- data.frame(x=I(heart.data$x), y = heart.data$y)
>>   
>> 
>>> data[1:2,]
>>> 
>>>   
>> x.1   x.2   x.3   x.4   x.5   x.6   x.7   x.8   x.9 y
>> 1   16012  5.73 23.11 149  25.3  97.252 1
>> 2   144  0.01  4.41 28.61 055 28.87  2.0663 1
>>   
>> 
>>> dimnames(heart.data$x)[[2]]
>>> 
>>>   
>> [1] "sbp"   "tobacco"   "ldl"   "adiposity" "famhist"   "typea"
>> [7] "obesity"   "alcohol"   "age"  
>>
>> Note that the printed variable names do not use the column names
>> of the matrix.
>>
>> In contrast, in S-PLUS the names are used; the printout begins:
>>x.sbp x.tobacco  x.ldl x.adiposity x.famhist x.typea x.obesity x.alcohol 
>>   
>> 
> The reason seems to be that format.AsIs is losing dimnames. That could 
> be easily fixed -- unless I'm overlooking something?
>
>   
Fixed in R-devel.


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] print.fitdistr buglet

2008-02-09 Thread Enrico Rossi
Dear developers,

There's a small bug in print.fitdistr that can cause output to be printed
twice, but only if print is called explicitly:

> fit<-fitdistr(rt(1000,3),"t")
There were 11 warnings (use warnings() to see them)
> fit
m sdf
  -0.021817231.001452963.13723878
 ( 0.03865057) ( 0.03999447) ( 0.33298377)
> print(fit)
m sdf
  -0.021817231.001452963.13723878
 ( 0.03865057) ( 0.03999447) ( 0.33298377)
m sdf
  -0.021817231.001452963.13723878
 ( 0.03865057) ( 0.03999447) ( 0.33298377)

Most likely, the function print.fitdistr doesn't return the input invisibly.

Cheers,
Enrico

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] print.fitdistr buglet

2008-02-09 Thread Duncan Murdoch
On 09/02/2008 11:33 AM, Enrico Rossi wrote:
> Dear developers,
> 
> There's a small bug in print.fitdistr that can cause output to be printed
> twice, but only if print is called explicitly:
> 
>> fit<-fitdistr(rt(1000,3),"t")
> There were 11 warnings (use warnings() to see them)
>> fit
> m sdf
>   -0.021817231.001452963.13723878
>  ( 0.03865057) ( 0.03999447) ( 0.33298377)
>> print(fit)
> m sdf
>   -0.021817231.001452963.13723878
>  ( 0.03865057) ( 0.03999447) ( 0.33298377)
> m sdf
>   -0.021817231.001452963.13723878
>  ( 0.03865057) ( 0.03999447) ( 0.33298377)
> 
> Most likely, the function print.fitdistr doesn't return the input invisibly.

That's a correct analysis, but fitdistr is in MASS, so the report should 
go to Brian Ripley, the maintainer.  I've cc'd him.

I did a quick look through other print methods using this code:

for (name in methods("print")) {
   fn <- do.call("getAnywhere", list(name))$objs[[1]]
   body <- body(fn)
   len <- length(body)
   cat(name, ":  ", deparse(body[[len]]), "\n")
}

and turned up a few other cases in base packages; I'll fix them as 
appropriate.

Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Rprofile.site in Windows version

2008-02-09 Thread Erich Neuwirth
I think Rprofile.site as installed with R-2.6.2
contains some misleading information.
It contains the following lines

# set a CRAN mirror
# local({r <- getOption("repos")
#   r["CRAN"] <- "http://my.local.cran";
#   options(repos=r)})'.

Uncommenting these lines and changing the URL
will not work.

'. at the end of the last line will break the execution.
Furthermore
library(tools)
needs to be run before these lines can be run.



-- 
Erich Neuwirth, University of Vienna
Faculty of Computer Science
Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-39464 Fax: +43-1-4277-39459

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] View() + "End" key on Ubuntu=segfault

2008-02-09 Thread Ben Bolker

   I can repeatably crash R (segfault)

  by doing

n <- 10
z <- data.frame(a=1:n,b=1:n)
View(z)

  and then hitting the "End" key on my keyboard.

   I haven't got debugging going yet, but running under
gdb (without debugging symbols) does give this:

0xb7b63583 in strlen () from /lib/tls/i686/cmov/libc.so.6

R version 2.6.2 (2008-02-08)
i486-pc-linux-gnu

[Ubuntu Gutsy]

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

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

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Rprofile.site in Windows version

2008-02-09 Thread Duncan Murdoch
On 09/02/2008 6:44 PM, Erich Neuwirth wrote:
> I think Rprofile.site as installed with R-2.6.2
> contains some misleading information.
> It contains the following lines
> 
> # set a CRAN mirror
> # local({r <- getOption("repos")
> #   r["CRAN"] <- "http://my.local.cran";
> #   options(repos=r)})'.
> 
> Uncommenting these lines and changing the URL
> will not work.
> 
> '. at the end of the last line will break the execution.

Yes, those shouldn't be there.

> Furthermore
> library(tools)
> needs to be run before these lines can be run.

Why?  local, getOption, and options are all in the base package.

Duncan Murdoch

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel