Jim Lemon | 1 May 12:45 2011
Picon

plotrix_3.2

Hi all,
plotrix 3.2 has arrived. The reason for this announcement is that there 
have been a couple of major rewrites.

The barNest family of functions has had an overhaul that began as a fix 
for an apparently trivial bug that caused problems with empty 
subcategories. So far, testing has not found anything that will break 
code written for the former version.

color.scale will now convert numeric values into colors in all three 
color specifications, RGB, HSV and HCL. Again, I think that previous 
code will run with the new version. The change that will probably cause 
trouble is the renaming of the color range arguments from redrange, 
greenrange and bluerange to cs1, cs2 and cs3. The user can trip up the 
function more easily, as the three specs have different color parameter 
ranges.

If the new version does break anyone's code, especially for packages 
that depend upon plotrix, please let me know and I'll do my best to 
resolve any problems.

Jim

Jim Lemon | 1 May 14:29 2011
Picon

Re: using tapply with multiple variables

On 05/01/2011 05:28 AM, Kevin Burnham wrote:
> HI All,
>
> I have a long data file generated from a minimal pair test that I gave to
> learners of Arabic before and after a phonetic training regime.  For each of
> thirty some subjects there are 800 rows of data, from each of 400 items at
> pre and posttest.  For each item the subject got correct, there is a 'C' in
> the column 'Correct'.  The line:
>
> tapply(ALLDATA$Correct, ALLDATA$Subject, function(x)sum(x=="C"))
>
> gives me the sum of correct answers for each subject.
>
> However, I would like to have that sum separated by Time (pre or post).  Is
> there a simple way to do that?
>
>
> What if I further wish to separate by Group (T or C)?
>
Hi Kevin,
When I looked at this, I immediately thought of the brkdnNest function 
(which uses tapply internally). In order to get the counts with the 
current function, I had to create a new variable (newcorrect). However, 
the idea so attracted me that I programmed it into the code (thanks).
Here is a way to get your summary by Subject and Time:

ALLDATA<-data.frame(Subject=rep(1:30,each=800),
  Occasion=factor(rep(c("pre","post"),2400),levels=c("pre","post")),
  Correct=sample(c("C","I"),2400,TRUE))
tapply(ALLDATA$Correct,list(ALLDATA$Subject,ALLDATA$Occasion),
(Continue reading)

Jeroen Ooms | 1 May 03:36 2011
Picon

regressing on variable with heavy tails

I have a dependent variable with is very peaked and has heavy tails,
something I haven't encountered before. (histogram:
http://postimage.org/image/2sw9bn8pw/). What could be an appropriate family
or transformation to do regress on this?--
View this message in context: http://r.789695.n4.nabble.com/regressing-on-variable-with-heavy-tails-tp3486973p3486973.html
Sent from the R help mailing list archive at Nabble.com.

Alice Wines | 1 May 01:18 2011
Picon

indexing into a data.frame using another data.frame that also contains values for replacement

Hello all,

     I have a quandry I have been scratching my head about for a
while. I've searched the manual and the web and have not been able to
find an acceptable result, so I am hoping for some help.

     I have two data frames and I want to index into the first using
the second, and replace the specific values I have indexed with more
values from the second data.frame. I can do this using a loop, but I
wanted a quicker solution with no loops involved.

Although my data set is much larger than this, a small example of what
I am trying to do is as follows:

df1 <- data.frame(rows=c("A","B","C", "B", "C", "A"),
columns=c("21_2", "22_2", "23_2", "21_2", "22_2", "23_2"),
values=c(3.3, 2.5, 67.2, 44.3, 53, 66))
df2 <- data.frame(matrix(rep(NA, length(df1$values)),nrow=3, ncol=3))
names(df2) <- c("21_2", "22_2", "23_2")
row.names(df2) <- c("A", "B", "C")

> df1
  rows columns values
1    A    21_2    3.3
2    B    22_2    2.5
3    C    23_2   67.2
4    B    21_2   44.3
5    C    22_2   53.0
6    A    23_2   66.0

(Continue reading)

Wonjae Lee | 1 May 04:50 2011

Conversion to xlsx file

Hi, all

I would like to convert xls files to xlsx files with R commands in R console
instead of saving xls files as xlsx files after opening xls files.
Please show me how.

Thanks.
Wonjae

 --
View this message in context: http://r.789695.n4.nabble.com/Conversion-to-xlsx-file-tp3487118p3487118.html
Sent from the R help mailing list archive at Nabble.com.

David Winsemius | 1 May 05:15 2011
Picon
Picon

Re: regressing on variable with heavy tails


On Apr 30, 2011, at 9:36 PM, Jeroen Ooms wrote:

> I have a dependent variable with is very peaked and has heavy tails,
> something I haven't encountered before. (histogram:
> http://postimage.org/image/2sw9bn8pw/). What could be an appropriate  
> family
> or transformation to do regress on this?

None. You have not yet established that the residuals of your analysis  
violate any of linear regression assumptions. It is the residuals that  
need to be Normal, not the dependent variable.

--

-- 

David Winsemius, MD
West Hartford, CT

Yihui Xie | 1 May 05:35 2011

Re: Plotting an Underbrace in R

Oh, I did not see this post and I just saw your message in my blog.
Anyway, here is a solution for other people's future reference:
http://yihui.name/en/2011/04/produce-authentic-math-formulas-in-r-graphics/

Regards,
Yihui
--
Yihui Xie <xieyihui <at> gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA

On Fri, Apr 15, 2011 at 4:42 AM, Michael McAssey <mpmcassey <at> gmail.com> wrote:
> Baptiste,
>
> Thank you.  The examples in the documentation for tikz helped me solve
> this problem, and give me a good tool for future plots.  I only need
> to figure out how to incorporate LaTeX packages like amssymb so that I
> can use \mathbb{} to put the real numbers symbol in my plot.
>
> Regards,
>
> Michael
>
> On Fri, Apr 15, 2011 at 10:48 AM, baptiste auguie
> <baptiste.auguie <at> googlemail.com> wrote:
>> Hi,
>>
>> Through pgfSweave you can use the tikz device, which is the one that
>> can interpret Latex code (package tikzDevice). I would start with a
(Continue reading)

Chee Chen | 1 May 05:39 2011
Picon

Question on where samples are grouped in rmvnorm{mvtnorm}

Dear All,
For function:  rmvnorm{mvtnorm}  in (library mvtnorm, not splus2R), if I generate 2 bivariate normal
samples as follows:
> rmvnorm(2,mean=rep(0,2),sigma=diag(2))
           [,1]      [,2]
[1,]  2.0749459 1.4932752
[2,] -0.9886333 0.3832266

Where is the first sample, it is stored in the first row or the first column?
Does this function store samples row-wise or column-wise?

Thank you,
-Chee
	[[alternative HTML version deleted]]

Berend Hasselman | 1 May 06:50 2011
Picon
Picon

Re: indexing into a data.frame using another data.frame that also contains values for replacement


Alice Wines wrote:
> 
> Hello all,
> 
>      I have a quandry I have been scratching my head about for a
> while. I've searched the manual and the web and have not been able to
> find an acceptable result, so I am hoping for some help.
> 
>      I have two data frames and I want to index into the first using
> the second, and replace the specific values I have indexed with more
> values from the second data.frame. I can do this using a loop, but I
> wanted a quicker solution with no loops involved.
> 
> Although my data set is much larger than this, a small example of what
> I am trying to do is as follows:
> 
> df1 <- data.frame(rows=c("A","B","C", "B", "C", "A"),
> columns=c("21_2", "22_2", "23_2", "21_2", "22_2", "23_2"),
> values=c(3.3, 2.5, 67.2, 44.3, 53, 66))
> df2 <- data.frame(matrix(rep(NA, length(df1$values)),nrow=3, ncol=3))
> names(df2) <- c("21_2", "22_2", "23_2")
> row.names(df2) <- c("A", "B", "C")
> 
>> df1
>   rows columns values
> 1    A    21_2    3.3
> 2    B    22_2    2.5
> 3    C    23_2   67.2
> 4    B    21_2   44.3
(Continue reading)

Shane Phillips | 1 May 06:33 2011
Picon

Simulation Questions

I have the following script for generating a dataset.  It works like a champ except for a couple of things.

1.  I need the variables "itbs" and  "map" to be negatively correlated with the binomial variable "lunch" 
(around -0.21 and -0.24, respectively). The binomial variable  "lunch" needs to remain unchanged.
2.  While my generated variables do come out with the desired means and correlations, the distribution is
very narrow and only represents a small portion of the possible scores.  Can I force it to encompass a wider
range of scores, while maintaining my desired parameters and correlations?

Please help...

Shane

Script follows...

#Number the subjects
subject=1:1000
#Assign a treatment condition from a binomial distribution with a probability of 0.13
treat=rbinom(1*1000,1,.13)
#Assign a lunch status condition froma binomial distribution with a probability of 0.35
lunch=rbinom(1*1000,1,.35)
#Generate age in months from a random normal distribution with mean of 87 and sd of 2
age=rnorm(1000,87,2)
#invoke the MASS package
require(MASS)
#Establish the covariance matrix for MAP, ITBS and CogAT scores
sigma <- matrix(c(1, 0.84, 0.59, 0.84, 1, 0.56, 0.59, 0.56, 1), ncol = 3)
#Establish MAP as a random normal variable with mean of 200 and sd of 9
map   <- rnorm(1000, 200, 9)
#Establish ITBS as a random normal variable with mean of 175 and sd of 15
itbs <- rnorm(1000, 175, 15)
(Continue reading)


Gmane