Michael Lachmann | 1 Jul 2010 01:22
Picon

Re: problem with rbind on data.frames that contain data.frames


On 30 Jun 2010, at 22:55, Allan Engelhardt wrote:
>> > a$z=z
> You are (kind of) assigning *two* columns from the data frame "z" to  
> the name 'z' in "a" which is probably not going to work as you  
> expect.  R tries to be clever which may or may not be a Good Thing.   
> Try
>
> a$z1 <- z[,1]
> a$z2 <- z[,2]

Yes, the problem is that I wanted my code to work on data where the  
number of columns is variable. Of course even that can be handled....  
just much uglier than just assigning the result of the computation to  
a part of the data.frame. I was mainly asking how I could have avoided  
having the bug in the first place... once I found it, it was easy to  
solve.

I tried to track the problem further...

As I said before, the problem is there if one does
a=data.frame(1:10,1:10)
a$z=a
rbind(a,a)

in this case str(a) gives:
---
 > str(a)
'data.frame':   10 obs. of  3 variables:
  $ X1.10  : int  1 2 3 4 5 6 7 8 9 10
(Continue reading)

Andrew Liu | 1 Jul 2010 01:38
Picon
Favicon

Coloring axis labels on Lattice xyplot.

Hello,

I am trying to color particular labels on my lattice xyplot.

For example:

library(lattice)
z = data.frame(x = 1:5)
xyplot(x~x, z)

Is there any way for me to make the "4" on the y-axis blue?

Thanks,
Andy

Mike Williamson | 1 Jul 2010 01:53
Picon

anyone know why package "RandomForest" na.roughfix is so slow??

Hi all,

    I am using the package "random forest" for random forest predictions.  I
like the package.  However, I have fairly large data sets, and it can often
take *hours* just to go through the "na.roughfix" call, which simply goes
through and cleans up any NA values to either the median (numerical data) or
the most frequent occurrence (factors).
    I am going to start doing some comparisons between na.roughfix() and
some apply() functions which, it seems, are able to do the same job more
quickly.  But I hesitate to duplicate a function that is already in the
package, since I presume the na.roughfix should be as quick as possible and
it should also be well "tailored" to the requirements of random forest.

    Has anyone else seen that this is really slow?  (I haven't noticed
rfImpute to be nearly as slow, but I cannot say for sure:  my "predict" data
sets are MUCH larger than my model data sets, so cleaning the prediction
data set simply takes much longer.)
    If so, any ideas how to speed this up?

                              Thanks!
                                   Mike

"Telescopes and bathyscaphes and sonar probes of Scottish lakes,
Tacoma Narrows bridge collapse explained with abstract phase-space maps,
Some x-ray slides, a music score, Minard's Napoleanic war:
The most exciting frontier is charting what's already here."
 -- xkcd

--
Help protect Wikipedia. Donate now:
(Continue reading)

amatoallah ouchen | 1 Jul 2010 02:12
Picon

question regarding panel data analysis

Good day R-users,

So if the question may seem easy to many of you but this present a
serious  issue for me . I'm currently running a panel data analysis
i've used the plm package to perform the Tests of poolability as
results intercepts and coefficients are assumed different. so my
question is should give up the panel analysis in my case or is there
any alternative methodology or transformation i can use instead??

Any hint would be highly appreciated

thanks a lot in advance.

Ama

jim holtman | 1 Jul 2010 02:26
Picon

Re: anyone know why package "RandomForest" na.roughfix is so slow??

Use "Rprof" to determine where time is being spent.  This might point
out some problems in the code.

On Wed, Jun 30, 2010 at 7:53 PM, Mike Williamson <this.is.mvw <at> gmail.com> wrote:
> Hi all,
>
>    I am using the package "random forest" for random forest predictions.  I
> like the package.  However, I have fairly large data sets, and it can often
> take *hours* just to go through the "na.roughfix" call, which simply goes
> through and cleans up any NA values to either the median (numerical data) or
> the most frequent occurrence (factors).
>    I am going to start doing some comparisons between na.roughfix() and
> some apply() functions which, it seems, are able to do the same job more
> quickly.  But I hesitate to duplicate a function that is already in the
> package, since I presume the na.roughfix should be as quick as possible and
> it should also be well "tailored" to the requirements of random forest.
>
>    Has anyone else seen that this is really slow?  (I haven't noticed
> rfImpute to be nearly as slow, but I cannot say for sure:  my "predict" data
> sets are MUCH larger than my model data sets, so cleaning the prediction
> data set simply takes much longer.)
>    If so, any ideas how to speed this up?
>
>                              Thanks!
>                                   Mike
>
>
>
> "Telescopes and bathyscaphes and sonar probes of Scottish lakes,
> Tacoma Narrows bridge collapse explained with abstract phase-space maps,
(Continue reading)

amatoallah ouchen | 1 Jul 2010 02:42
Picon

question regarding panel data analysis

Good day R-users,

So if the question may seem easy to many of you but this present a
serious  issue for me . I'm currently running a panel data analysis
i've used the plm package to perform the Tests of poolability as
results intercepts and coefficients are assumed different. so my
question is should give up the panel analysis in my case or is there
any alternative methodology or transformation i can use instead??

Any hint would be highly appreciated

thanks a lot in advance.

Ama

Greg Snow | 1 Jul 2010 02:42

Re: Correctly plotting bar and scatter chart on 2-y axis plot with par(new=T)

For 1 you can just reverse one of the y ranges, e.g.:

updateusr(1:2, range(0,y1), 1:2, rev(range(y2)) )

on my computer for some reason the axis command needs you to explicitly set the at points, but then it works properly.

For 2, are the axes on all the plots the same?  If so you can put all the axes in the outer margin and remove the
space between the plots (see the pairs2 function in the TeachingDemos packages to see an example).

Otherwise you may need to remove some of the labeling from the plots and put it in the caption (publication)
instead.  For on screen, just remember which plot is which.

A more detailed example of what you are trying may help us give better suggestions.

--

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow <at> imail.org
801.408.8111

> -----Original Message-----
> From: r-help-bounces <at> r-project.org [mailto:r-help-bounces <at> r-
> project.org] On Behalf Of dan.weavesham
> Sent: Wednesday, June 30, 2010 12:44 PM
> To: r-help <at> r-project.org
> Subject: Re: [R] Correctly plotting bar and scatter chart on 2-y axis
> plot with par(new=T)
> 
> 
(Continue reading)

Jinsong Zhao | 1 Jul 2010 01:14
Picon

plain text in Chinese can not be set

Hi there,

According to ?par, 'font' is an integer which specifies which font to
use for text, that 1 corresponds to plain text (the default), 2 to bold
face, 3 to italic and 4 to bold italic.

When I test Chinese character in pdf(), I found that 1 to bold face, 2 
to italic, 3 to bold italic, 4 to symbol. and I don't find how to set 
plain text. In the following code, the font to use for Latin text is 
correct.

I also tested postscript(), and it did as what was expected.

Any suggestions? Thanks in advance!

Regards,
Jinsong

### the code to reproduce my question ###

pdf("test_0.pdf", fonts = c("GB1"))
plot(1:10)
text(5,4, "\u4F60\u597D", family="GB1", font = 0) ## bold
text(5,5, "is 'hello' in Chinese", font = 0) ## normal
dev.off()

pdf("test_1.pdf", fonts = c("GB1"))
plot(1:10)
text(5,4, "\u4F60\u597D", family="GB1", font = 1) ## bold
text(5,5, "is 'hello' in Chinese", font = 1) # normal
(Continue reading)

Lidia Dobria | 1 Jul 2010 01:44
Picon
Favicon

Re: Interpretation of gam intercept parameter


Gavin,

Thank you for your clear explanation. I'm just learning R, hence my not knowing how to dummy code a variable
using R. Your example was very useful!

Thank you again.
Lidia

----------------------------------------
> Subject: Re: [R] Interpretation of gam intercept parameter
> From: gavin.simpson <at> ucl.ac.uk
> To: lidiadobria <at> hotmail.com
> CC: r-help <at> r-project.org
> Date: Wed, 30 Jun 2010 08:31:45 +0100
>
> On Tue, 2010-06-29 at 21:27 -0500, Lidia Dobria wrote:
>> Dear All:
>>
>> I apologize for asking such an elementary question, but I could not
>> find an adequate response on line. I am hoping to receive some help
>> with the interpretation of the Intercept coefficient in the gam model
>> below.
>>
>> I1 through I3 are dummy coded "Item difficulty" parameters in a data
>> set that includes 4 items. If the Intercept is the value of Y when all
>> other terms are 0, am I correct in assuming that it also equals the
>> difficulty of item 4 (dummy coded 0 0 0 )?
>
> If I understand you correctly (?) you have a single variable 'ID' (Item
(Continue reading)

Nikos Alexandris | 1 Jul 2010 03:21
Picon

Re: Factor Loadings in Vegan's PCA

On Wednesday 30 of June 2010 23:02:09 afsouza <at> unisinos.br wrote:
> Hi all,
> 
>    I am using the vegan package to run a prcincipal components analysis
> on forest structural variables (tree  density, basal area, average
> height, regeneration density) in R.
> 
>    However, I could not find out how to extract factor loadings
> (correlations of each variable with each pca axis), as is straightforwar
> in princomp.
> 
>    Do anyone know how to do that?
> 
>    Moreover, do anyone knows a function r package that produces
> rotated-pca and biplots? Most packages I found did only one of these
> tasks (princomp, psych, vegan).
> 
>    Thanks a lot,
>    Alexandre

Hi Alexandre.

I haven't used the vegan package. But using princomp() and/or prcomp() is 
really easy. Easy is also the extraction of the loadings. Just check the 
structure of the result of princomp() to find the "loadings" or the result of 
prcomp() to find the "rotation" ( which is the same as the loadings in 
princomp() ).

For plotting you might want to have a look at the plotpc R package. It's 
something I really like (and have customised it a lot to suit my needs of 
(Continue reading)


Gmane