swapme = (as.numeric(tmp$R1) - as.numeric(tmp$R2)) %% 2 !=
> 0),
> {
> tmp[swapme, "R1"] <- r2[swapme]
> tmp[swapme, "R2"] <- r1[swapme]
> tmp
> })
>
> Best,
> Ista
>
> On Thu, Jul 6, 2017 at 4:06 PM, Gang Chen &l
Suppose that we have the following dataframe:
set.seed(1)
(tmp <- data.frame(x = 1:10, R1 = sample(LETTERS[1:5], 10, replace =
TRUE), R2 = sample(LETTERS[1:5], 10, replace = TRUE)))
x R1 R2
1 1 B B
2 2 B A
3 3 C D
4 4 E B
5 5 B D
6 6 E C
7 7 E D
8 8 D E
9 9
2.1 S1 B
> S2A 38 3.2 S2 A
> S2B 22 3.2 S2 B
>
> David C
>
> -Original Message-
> From: Gang Chen [mailto:gangch...@gmail.com]
> Sent: Wednesday, August 24, 2016 2:51 PM
> To: David L Carlson
> Cc: r-help mailing list
> Subject: Re: [R] aggregate
>
> Thank
"), Z = structure(c(1L,
> 1L, 2L, 2L, 1L, 1L, 2L, 2L), .Label = c("A", "B"), class = "factor")), .Names
> = c("X",
> "Y", "S", "Z"), row.names = c(NA, -8L), class = "data.frame")
>
> Combining two lab
tion(x) crossprod(x[, 1], x[, 2])))
> Z CP
> A A 10
> B B 10
>
> David C
>
>
> -Original Message-
> From: Gang Chen [mailto:gangch...@gmail.com]
> Sent: Wednesday, August 24, 2016 10:17 AM
> To: David L Carlson
> Cc: Jim Lemon; r-help mailing list
>
gt; College Station, TX 77840-4352
>
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jim Lemon
> Sent: Tuesday, August 23, 2016 6:02 PM
> To: Gang Chen; r-help mailing list
> Subject: Re: [R] aggregate
>
> Hi Gang Che
This is a simple question: With a dataframe like the following
myData <- data.frame(X=c(1, 2, 3, 4), Y=c(4, 3, 2, 1), Z=c('A', 'A', 'B', 'B'))
how can I get the cross product between X and Y for each level of
factor Z? My difficulty is that I don't know how to deal with the fact
that crossprod()
s3 -50.9669 -136.08716
>
>
>
> Jim Holtman
> Data Munger Guru
>
> What is the problem that you are trying to solve?
> Tell me what you want to do, not how you want to do it.
>
> On Thu, Jul 28, 2016 at 4:40 PM, Gang Chen <gangch...@gmail.com> wrote:
>&
With the following data in data.frame:
subject QMemotion yi
s1 75.1017 neutral -75.928276
s2 -47.3512 neutral -178.295990
s3 -68.9016 neutral -134.753906
s1 17.2099 negative -104.168312
s2 -53.1114 negative -182.373474
s3 -33.0322 negative -137.420410
I
I’m running R 3.2.2 on a Linux server (Redhat 4.4.7-16), and having the
following problem.
It works fine with the following:
require('MASS’)
var(mvrnorm(n = 1000, rep(0, 2), Sigma=matrix(c(10,3,3,2),2,2)))
However, when running the following in a loop with simulated data (Sigma):
# Sigma
ht well have that
wrong.
>
> Doing anything in 190 dimensions is bound to be fraught with numeric
> peril.
>
> cheers,
>
> Rolf Turner
>
> --
> Technical Editor ANZJS
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276
>
>
>
I'm having some trouble with Anova() in package car. When the model
formula is explicitly expressed:
library('nlme')
library('car')
fm - lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)
Anova() works fine:
Anova(fm)
However, if the model formula is scanned from an external source:
, usually in a day or so.
Best,
John
-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Gang Chen
Sent: January-13-15 1:48 PM
To: r-help
Subject: [R] Problem with Anova() in package car
I'm having some trouble with Anova() in package car. When
I want to do the following: if a string does not contain a colon (:),
no change is needed; if it contains one or more colons, break the
string into multiple strings using the colon as a separator. For
example, happy: becomes
happy :
:sad turns to
: sad
and happy:sad changes to
happy : sad
, or Renviron?
What is the output from Sys.getenv() in gui and cli, and do they differ?
On Sep 18, 2014, at 11:18 AM, Gang Chen gangch...@gmail.com wrote:
When R starts in GUI (e.g., /Applications/R.app/Contents/MacOS/R) on
my Mac OS X 10.7.5, the startup configuration in .Rprofile works fine
When R starts in GUI (e.g., /Applications/R.app/Contents/MacOS/R) on
my Mac OS X 10.7.5, the startup configuration in .Rprofile works fine.
However, when R starts on the terminal (e.g.,
/Library/Frameworks/R.framework/Resources/bin/R), it does not work at
all. What could be the reason for the
A random effect formulation for R package nlme is read in as a string
of characters from an input file:
ranEff - pdCompSymm(~1+Age)
I need to convert 'ranEff' to a formula class. However, as shown below:
as.formula(ranEff)
~1 + Age
the pdCompSymm is lost in the conversion. Any solutions?
Thanks for the help! However, I just need to get
pdCompSymm(~1 + Age)
without a tilde (~) at the beginning.
On Wed, Aug 27, 2014 at 3:34 PM, David Winsemius dwinsem...@comcast.net wrote:
On Aug 27, 2014, at 11:19 AM, Gang Chen wrote:
A random effect formulation for R package nlme is read
PM, David Winsemius dwinsem...@comcast.net wrote:
On Aug 27, 2014, at 12:44 PM, Gang Chen wrote:
Thanks for the help! However, I just need to get
pdCompSymm(~1 + Age)
That's not a formula in the R sense of the word. You should do a better job
of posting a use case. Perhaps you want
Sorry for the misspelling! And more importantly, thanks a lot for the
nice solution and for the quick help!
On Wed, Aug 27, 2014 at 4:22 PM, David Winsemius dwinsem...@comcast.net wrote:
On Aug 27, 2014, at 1:11 PM, Gang Chen wrote:
Good point!
Here is an example:
library(nlme)
fm - lme
Suppose I have the following dataframe:
L4 - LETTERS[1:4]
fac - sample(L4, 10, replace = TRUE)
(d - data.frame(x = 1, y = 1:10, fac = fac))
x y fac
1 1 1 B
2 1 2 B
3 1 3 D
4 1 4 A
5 1 5 C
6 1 6 D
7 1 7 C
8 1 8 B
9 1 9 B
10 1 10 B
I'd like to add
() to include it in your
email.
Sarah
On Thu, Jul 17, 2014 at 11:00 AM, Gang Chen gangch...@gmail.com wrote:
Suppose I have the following dataframe:
L4 - LETTERS[1:4]
fac - sample(L4, 10, replace = TRUE)
(d - data.frame(x = 1, y = 1:10, fac = fac))
x y fac
1 1 1 B
2 1 2 B
3
for this specific task.
Hadley Wickham's tidy data [1] principles address this concern more
thoroughly than I have.
[1] Google this phrase... paper seems to be a work in progress.
On Thu, 17 Jul 2014, Gang Chen wrote:
Suppose I have the following dataframe:
L4 - LETTERS[1:4]
fac - sample(L4, 10
-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of Gang Chen
Sent: Thursday, July 3, 2014 2:56 PM
To: r-help
Subject: [R] Display a dataframe
I have a matrix 'dd' defined as below:
dd - t(matrix(c(153.0216306, 1, 7.578366e-35,
13.3696538, 1, 5.114571e-04
 0.8476713 1 7.144239e-01 # Weight Â
#4Â Â 1.2196050Â 1 5.388764e-01 # Intensity
#5Â Â 2.6349405Â 1 2.090719e-01 # ISOÂ Â Â Â Â
#6Â Â 6.0507714Â 1 2.780045e-02 # SECÂ Â Â Â Â
A.K.
On Thursday, July 3, 2014 3:57 PM, Gang Chen gangch...@gmail.com
wrote:
I have a matrix 'dd
I have a matrix 'dd' defined as below:
dd - t(matrix(c(153.0216306, 1, 7.578366e-35,
13.3696538, 1, 5.114571e-04,
0.8476713, 1, 7.144239e-01,
1.2196050, 1, 5.388764e-01,
2.6349405, 1, 2.090719e-01,
6.0507714, 1, 2.780045e-02), nrow=3, ncol=6))
dimnames(dd)[[2]] - c('# Chisq', 'DF',
Suppose that I need to run a multivariate linear model
Y = X B + E
many times with the same model matrix X but each time with different
response matrix Y. Is there a function available in 'car' package
similar to refit() in lme4 package so that the model matrix X would
not be reassembled each
Suppose I have a dataframe 'd' defined as
L3 - LETTERS[1:3]
d0 - data.frame(cbind(x = 1, y = 1:10), fac = sample(L3, 10, replace
= TRUE))
(d - d0[d0$fac %in% c('A', 'B'),])
x y fac
2 1 2 B
3 1 3 A
4 1 4 A
5 1 5 A
6 1 6 B
8 1 8 A
Even though factor 'fac' in 'd' only
Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ;
meghatalmaz#243;: Gang Chen [gangch...@gmail.com]
Küldve: 2013. december 14. 21:09
To: r-help
Tárgy: [R] Change factor levels
Suppose I have a dataframe 'd' defined as
L3 - LETTERS[1:3
Suppose I have a dataframe defined as
L3 - LETTERS[1:3]
(d - data.frame(cbind(x = 1, y = 1:10), fac = sample(L3, 10, replace
= TRUE)))
x y fac
1 1 1 C
2 1 2 A
3 1 3 B
4 1 4 C
5 1 5 B
6 1 6 B
7 1 7 A
8 1 8 A
9 1 9 B
10 1 10 A
I want to extract
Perfect! Thanks a lot, A.K!
On Fri, Dec 13, 2013 at 4:21 PM, arun smartpink...@yahoo.com wrote:
Hi,
Try:
d[match(unique(d$fac),d$fac),]
A.K.
On Friday, December 13, 2013 4:17 PM, Gang Chen gangch...@gmail.com
wrote:
Suppose I have a dataframe defined as
L3 - LETTERS[1:3
, then everyone who tries it will get the same data
frame d.
Sarah
On Fri, Dec 13, 2013 at 4:15 PM, Gang Chen gangch...@gmail.com wrote:
Suppose I have a dataframe defined as
L3 - LETTERS[1:3]
(d - data.frame(cbind(x = 1, y = 1:10), fac = sample(L3, 10,
replace
= TRUE)))
x y
This is most likely a silly question.
First I run the following:
require(car)
mod.ok - lm(cbind(pre.1, pre.2, pre.3, pre.4, pre.5, post.1, post.2,
post.3, post.4, post.5,
fup.1, fup.2, fup.3, fup.4, fup.5) ~
treatment*gender, data=OBrienKaiser)
phase -
. If not, you can copy that
section of the code into your own function to call and have it return the
object rather than printing.
On Wed, Jul 17, 2013 at 3:38 PM, Gang Chen gangch...@gmail.com wrote:
This is most likely a silly question.
First I run the following:
require(car)
mod.ok
I wrote an R program that does heavy computations with hundreds of
lines of code. It's running fine both interactively and in batch mode
on a Mac OS X computer. The program also has no problem running on a
Linux system (Fedora 14) interactively. However, when I try it on the
terminal in batch mode
2012 à 12:54 -0500, Gang Chen a écrit :
I wrote an R program that does heavy computations with hundreds of
lines of code. It's running fine both interactively and in batch mode
on a Mac OS X computer. The program also has no problem running on a
Linux system (Fedora 14) interactively. However
Hi, I have two sets of sensitivity, specificity, positive predictive
value, and negative predictive value, and accuracy from two tests on
the same subjects. Is there an R package that does such paired
comparisons?
Thanks,
Gang Chen
__
R-help@r
That's it. Only thing is to keep the file names in the working
directory straight.
Enjoy
On Wed, Feb 8, 2012 at 12:39 PM, Gang Chen gangch...@gmail.com wrote:
Sorry Elai for the confusions.
Let me try to reframe my predicament. The main program myTest.R has
been written in interactive mode
.
If your goal is to batch evaluate multiple answer files from users
(why else would you ask questions with readline?), then you should
have enough to go on with my answer and the examples in ?eval.
Elai
On Wed, Feb 8, 2012 at 9:04 AM, Gang Chen gangch...@gmail.com wrote:
Hi Elai,
Thanks
Suppose I create an R program called myTest.R with only one line like
the following:
type - as.integer(readline(input type (1: type1; 2: type2)? ))
Then I'd like to run myTest.R in batch mode by constructing an input
file called answers.R with the following:
source(myTest.R)
1
When I ran the
:05 PM, Gang Chen gangch...@gmail.com wrote:
Suppose I create an R program called myTest.R with only one line like
the following:
type - as.integer(readline(input type (1: type1; 2: type2)? ))
Then I'd like to run myTest.R in batch mode by constructing an input
file called answers.R
similar.
HTH,
Dennis
On Thu, Oct 6, 2011 at 1:28 PM, Gang Chen gangch...@gmail.com wrote:
I have some data 'myData' in wide form (attached at the end), and
would like to convert it to long form. I wish to have five variables
in the result:
1) Subj: factor
2) Group: between-subjects factor (2
S1 s 6 She F1
6S1 s 6 She F2
7S1 s10 She J1
8S1 s 9 She J2
On Fri, Oct 7, 2011 at 7:16 AM, Jim Lemon j...@bitwrit.com.au wrote:
On 10/07/2011 07:28 AM, Gang Chen wrote:
I have some data 'myData' in wide form (attached
David, thanks a lot for the code! I've learned quite a bit from all
the generous help...
Gang
On Fri, Oct 7, 2011 at 1:37 PM, David Winsemius dwinsem...@comcast.net wrote:
On Oct 7, 2011, at 1:30 PM, David Winsemius wrote:
On Oct 7, 2011, at 7:40 AM, Gang Chen wrote:
Jim, I really
I have some data 'myData' in wide form (attached at the end), and
would like to convert it to long form. I wish to have five variables
in the result:
1) Subj: factor
2) Group: between-subjects factor (2 levels: s / w)
3) Reference: within-subject factor (2 levels: Me / She)
4) F: within-subject
Miles rstuff.mi...@gmail.com wrote:
Take a look here.
http://stackoverflow.com/questions/2185252/reshaping-data-frame-from-wide-to-long-format
Andrew Miles
Department of Sociology
Duke University
On Oct 6, 2011, at 4:28 PM, Gang Chen wrote:
I have some data 'myData' in wide form (attached
I read somewhere that vector graphics such as eps or dpf are more favorable
than alternatives (jpeg, bmp or png) for publication because vector graphics
scale properly when enlarged. However, my problem is that the file generated
from a graph of fixed size is too large (in the order of 10MB)
I define the following function to convert a t-value with degrees of freedom
DF to another t-value with different degrees of freedom fullDF:
tConvert - function(tval, DF, fullDF) ifelse(DF=1, qt(pt(tval, DF),
fullDF), 0)
It works as expected with the following case:
tConvert(c(2,3), c(10,12),
, I feel my solution is a little kludged. Any better idea?
Thanks,
Gang
On Thu, Jul 7, 2011 at 9:04 PM, David Winsemius dwinsem...@comcast.netwrote:
On Jul 7, 2011, at 8:52 PM, David Winsemius wrote:
On Jul 7, 2011, at 8:47 PM, Gang Chen wrote:
I define the following function to convert
Hi, I have a question about SVAR modeling with the package vars. How does it
handle the situation where the A (structural) matrix has a non-recursive
structure in the SVAR model? In other words, what kind of algorithm does
vars adopt to deal with the unidentifiable issue in a non-recursive model?
I know how to convert a simple dataframe from wide to long format with one
varying factor. However, for a dataset with two factors like the following,
Subj T1_Cond1 T1_Cond2 T2_Cond1 T2_Cond2
1 0.125869 4.108232 1.099392 5.556614
2 1.427940 2.170026 0.120748 1.176353
How to
1.427940 2.170026
4 2 T2 0.120748 1.176353
The modifications to get it exactly as requested are left to the reader
On Sun, May 22, 2011 at 2:25 PM, Gang Chen gangch...@gmail.com wrote:
I know how to convert a simple dataframe from wide to long format with
one
varying
A very simple question. With a data frame like this:
n = c(2, 3, 5)
s = c(aa, bb, cc)
df = data.frame(n, s)
I want df$s[1] or df[1,2], but how can I get rid of the extra line in
the output about the factor levels:
df$s[1]
[1] aa
Levels: aa bb cc
Thanks,
Gang
for.
--
Robert Tirrell | r...@stanford.edu | (607) 437-6532
Program in Biomedical Informatics | Butte Lab | Stanford University
On Thu, Mar 10, 2011 at 13:35, Gang Chen gangch...@gmail.com wrote:
n = c(2, 3, 5)
s = c(aa, bb, cc)
df = data.frame(n, s
Statistical Computing Facility
Department of Statistics
UC Berkeley
spec...@stat.berkeley.edu
On Thu, 10 Mar 2011, Gang Chen wrote:
A very simple question. With a data frame like
I want to create some 3D scatter plot with a diagonal line. In addition, I'd
like to have those points plus the diagonal line projected to those three
planes (xy, yz and xz). Which package can I use to achieve this,
scatterplot3d or something else?
Thanks,
Gang
[[alternative HTML version
Thanks a lot for the quick help! How to project the scatter plot with the
diagonal line to the three planes with scatterplot3d? I could not find such
an example demonstrating that in the vignette.
Thanks,
Gang
2011/1/8 Uwe Ligges lig...@statistik.tu-dortmund.de
On 08.01.2011 16:38, Gang Chen
Yes, too bad I didn't realize that it's so simple like that! Thanks...
On Sat, Jan 8, 2011 at 12:45 PM, David Winsemius dwinsem...@comcast.netwrote:
On Jan 8, 2011, at 11:21 AM, Gang Chen wrote:
Thanks a lot for the quick help! How to project the scatter plot with the
diagonal line
You nailed it, Prof. Ripley! Thanks a lot...
Gang
On Sat, Oct 30, 2010 at 2:58 PM, Prof Brian Ripley
rip...@stats.ox.ac.uk wrote:
On Sat, 30 Oct 2010, Gang Chen wrote:
Hi,
I'm trying to install the gsl wrapper source code
(http://cran.r-project.org/src/contrib/gsl_1.9-8.tar.gz) on a Linux
Hi,
I'm trying to install the gsl wrapper source code
(http://cran.r-project.org/src/contrib/gsl_1.9-8.tar.gz) on a Linux
system (OpenSuse 11.1), but encountering the following problem. I've
already installed 'gsl' version 1.14
(ftp://ftp.gnu.org/gnu/gsl/gsl-1.14.tar.gz) on the system. What's
Anybody knows what functions can be used to calculate
variance/covariance with complex numbers? var and cov don't seem to
work:
a
1
V1 0.00810014+0.00169366i
V2 0.00813054+0.00158251i
V3 0.00805489+0.00163295i
V4 0.00809141+0.00159533i
V5 0.00813976+0.00161850i
var(a)
than mine?):
crossprod(t(apply(xri, 1, '-', colMeans(xri/(nrow(xri)-1)
Do you agree?
Gang
On Sat, Mar 27, 2010 at 7:07 PM, Charles C. Berry cbe...@tajo.ucsd.edu wrote:
On Sat, 27 Mar 2010, Gang Chen wrote:
Anybody knows what functions can be used to calculate
variance/covariance
/internet/
-
On Mon, Feb 8, 2010 at 6:48 AM, Gang Chen gangch...@gmail.com wrote:
Dear Mike,
Thanks a lot for the kind help!
Actually a few months ago I happened to read a couple of your posts on
the R-help archive when I
In a classical meta analysis model y_i = X_i * beta_i + e_i, data
{y_i} are assumed to be independent effect sizes. However, I'm
encountering the following two scenarios:
(1) Each source has multiple effect sizes, thus {y_i} are not fully
independent with each other.
(2) Each source has multiple
I have some bits stored like the following variable nn
(nn - c(1, 0, 0, 1, 0, 1,0))
[1] 1 0 0 1 0 1 0
not in the format of
1001010
and I need to convert them to numbers in base 10. What's an easy way to do it?
TIA,
Gang
__
R-help@r-project.org
, Gang Chen gangch...@gmail.com wrote:
I have some bits stored like the following variable nn
(nn - c(1, 0, 0, 1, 0, 1,0))
[1] 1 0 0 1 0 1 0
not in the format of
1001010
and I need to convert them to numbers in base 10. What's an easy way to
do
it?
TIA,
Gang
I've written a function, myFunc, that works fine with myFunc(data,
...), but when I use apply() to run it with an array of data
apply(myArray, 1, myFunc, ...)
I get a strange error:
Error in match.fun(FUN) : '1' is not a function, character or symbol
which really puzzles me because '1' is
. Model validation is very important,
but interpreting those coefficients, at least in the case of balanced
designs, also provides some insights about various effects for the
people working in the field.
Gang
On Sun, Jan 25, 2009 at 11:25 AM, John Fox j...@mcmaster.ca wrote:
Dear Doug and Gang Chen
With the following example using contr.sum for both factors,
dd - data.frame(a = gl(3,4), b = gl(4,1,12)) # balanced 2-way
model.matrix(~ a * b, dd, contrasts = list(a=contr.sum, b=contr.sum))
(Intercept) a1 a2 b1 b2 b3 a1:b1 a2:b1 a1:b2 a2:b2 a1:b3 a2:b3
11 1 0 1 0 0
I can run one-sample t-test on an array, for example a matrix myData1,
with the following
apply(myData1, 2, t.test)
Is there a similar fashion using apply() or something else to run
2-sample t-test with datasets from two groups, myData1 and myData2,
without looping?
TIA,
Gang
))
to test by column and
mapply(t.test,as.data.frame(t(myData1)),as.data.frame(t(myData2)))
to test by row?
- Original Message
From: Gang Chen gangch...@gmail.com
To: Henrique Dallazuanna www...@gmail.com
Cc: r-h...@stat.math.ethz.ch
Sent: Tuesday, January 6, 2009 10:10:44 AM
I've been using parApply() in snow package for parallel computing with
the following lines in R 2.8.1:
library(snow)
nNodes - 4
cl - makeCluster(nNodes, type = SOCK)
fm - parApply(cl, myData, c(1,2), func1, ...)
Since I have a Mac OS X (version 10.4.11) with two dual-core
processors, I
When invoking dev.new() on my Mac OS X 10.4.11, I get an X11 window
instead of quartz which I feel more desirable. So I'd like to set
the default device to quartz. However I'm confused because of the
following:
Sys.getenv(R_DEFAULT_DEVICE)
R_DEFAULT_DEVICE
quartz
getOption(device)
, and
they all failed.
Any other suggestions?
Thanks,
Gang
On Mon, Oct 6, 2008 at 10:12 PM, Bernardo Rangel Tura
[EMAIL PROTECTED] wrote:
Em Qui, 2008-10-02 às 14:36 -0400, Gang Chen escreveu:
I want to run a R program, prog.R, interactively. My question is, is
there a way I can start prog.R
default packages loaded.
luke
On Tue, 7 Oct 2008, Gang Chen wrote:
Thanks a lot for the suggestion!
Unfortunately R --no-save prog.R does not work well with my
situation because prog.R
contain lines such as readline() and () that require user response in
the middle of the
execution. I
))
so you can source that.
On Wed, Oct 1, 2008 at 6:09 PM, Gang Chen [EMAIL PROTECTED] wrote:
Suppose I have a file prog.R stored in a directory under ~/dirname,
and ~/dirname is set in a shell script file (e.g. .cshrc) as one of
the accessible paths on terminal. On a different directory I could
I have a list, myList, with each of its 9 components being a 15X15
matrix. I want to run a t-test across the list for each component in
the matrix. For example, the first t-test is on myList[[1]][1, 1],
myList[[2]][1, 1], ..., myList[[9]][1, 1]; and there are totally 15X15
t-tests. How can I run
I want to run a R program, prog.R, interactively. My question is, is
there a way I can start prog.R on the shell terminal when invoking R,
instead of using source() inside R?
TIA,
Gang
__
R-help@r-project.org mailing list
this. I suggest you consult with your local statistician.
-- Bert Gunter
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Gang Chen
Sent: Thursday, October 02, 2008 11:24 AM
To: [EMAIL PROTECTED]
Subject: [R] t.test() on a list
I have a list, myList
Suppose I have a file prog.R stored in a directory under ~/dirname,
and ~/dirname is set in a shell script file (e.g. .cshrc) as one of
the accessible paths on terminal. On a different directory I could run
prog.R interactively by executing
source(~/dirname/prog.R)
It seems that source() does
I'm trying to use the following loop to open a window multiple times
to select files, but only the last window shows up. What am I missing?
library(tcltk)
nWin - 6
fn - vector('list', nWin)
for (ii in nWin) {
fn[[ii]] - tclvalue( tkgetOpenFile( filetypes =
{{Files} {.1D}} {{All files}
McMaster University
Hamilton, Ontario, Canada
web: socserv.mcmaster.ca/jfox
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On
Behalf Of Gang Chen
Sent: September-17-08 4:31 PM
To: [EMAIL PROTECTED]
Subject: [R] trouble with tkgetOpenFile
I'm trying to use
http://www.burns-stat.com
(home of S Poetry and A Guide for the Unwilling S User)
Gang Chen wrote:
Hi,
I want to store some number of outputs from running a bunch of
analyses such as lm() into an array. I know how to do this with a
one-dimensional array (vector) by creating
myArray - vector
Hi,
I have a data set collected from 10 measurements (response variables)
on two groups (healthy and patient) of subjects performing 4 different
tasks. In other words there are two fixed factors (group and task),
and 10 response variables. I could analyze the data with aov() or
lme() in package
'.' 0.1 ' ' 1
(Adjusted p values reported -- single-step method)
On 4/16/08, Simon Blomberg [EMAIL PROTECTED] wrote:
Try glht in package multcomp.
Simon.
On Wed, 2008-04-16 at 12:00 -0400, Gang Chen wrote:
Using the ergoStool data cited in Mixed-Effects Models in S and
S-PLUS by Pinheiro
the 'convenience' is largely lost,
and packages such as multcomp can post-hoc test any (coherent) set of
hypotheses you choose, irrespective of the model parametrization.
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gang Chen
Sent: Monday, April 14
Using the ergoStool data cited in Mixed-Effects Models in S and
S-PLUS by Pinheiro and Bates as an example, we have
library(nlme)
fm - lme(effort~Type-1, data=ergoStool, random=~1|Subject)
summary(fm)
Linear mixed-effects model fit by REML
Data: ergoStool
AIC BIC
I'm trying to analyze a model with two variables, one is Group with
two levels (male and female), and other is Time with four levels (T1,
T2, T3 and T4). And for the convenience of post-hoc testing I wanted
to consider a model with no intercept for factor Time, so I tried
formula
Group*(Time-1)
Sorry for this dumb question. Suppose I have a named array ww defined as
ww - 1:5
names(ww) - c(a, b, c, d, e)
How can I extract the whole array of numbers without the names?
ww[1:5] does not work while ww[[1]] can only extract one number at a
time.
Thanks,
Gang
Thanks a lot for the suggestions!
Gang
On 4/7/08, Uwe Ligges [EMAIL PROTECTED] wrote:
Gang Chen wrote:
Sorry for this dumb question. Suppose I have a named array ww defined as
ww - 1:5
names(ww) - c(a, b, c, d, e)
How can I extract the whole array of numbers without the names
?
Thanks in advance for any information,
Gang Chen
[[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
I have two arrays A and B with dimensions of (L, M, N, P) and (L, M,
N), and I want to do
for (i in 1:L) {
for (j in 1:M) {
for (k in 1:N) {
if (abs(B[i, j, k]) 10e-5) C[i, j, k,] - A[i, j, k,]/B[i, j, k]
else C[i, j, k,] - 0
}
}
}
How can I get C more efficiently than looping?
Thanks,
not
returning the zeros where needed therefore, the whole thing will
get recycled to match the dimensions.
b
On Mar 6, 2008, at 2:03 PM, Henrique Dallazuanna wrote:
I think this should work:
array(A[abs(B) 10e-5]/B[abs(B) 10e-5], dim=c(L, M, N, P))
On 06/03/2008, Gang Chen [EMAIL PROTECTED
Suppose I have a 4-D array X with dimensions (dx, dy, dz, dp). I want
to collapse the first 3 dimensions of X to make a 2-D array Y with
dimensions (dx*dy*dz, dp). Instead of awkward looping, what is a good
way to do this? Is there a similar function like reshape in Matlab?
Thanks,
Gang
Thanks a lot for all the suggestions!
Gang
On Feb 28, 2008, at 3:20 PM, Henrique Dallazuanna wrote:
Try this also:
apply(x, 4, rbind)
On 28/02/2008, Gang Chen [EMAIL PROTECTED] wrote:
Suppose I have a 4-D array X with dimensions (dx, dy, dz, dp). I want
to collapse the first 3
Normally I can run an R script in batch mode with a command like this
R CMD BATCH MyScript.R MyOutput
However I prefer to write another script containing something like
R --no-restore --save --no-readline $1 $2
so that I could run the original script simply on the prompt as
MyScript.R
Hi, I'm trying to set up AR(1) as a correlation structure in modeling some
data (attached file data.txt in text format) with lme, but have trouble
getting it to work.
Incent, Correctness, and Oppor are 3 categorical variables, Beta is a
response variable, and Time is an equally-spaced variable
Hi, I'm trying to set up AR(1) as a correlation structure in modeling some
data (attached file data.txt in text format) with lme, but have trouble
getting it to work.
Incent, Correctness, and Oppor are 3 categorical variables, Beta is a
response variable, and Time is an equally-spaced variable
With the example you provided, it seems both glht() and contrast()
work fine.
Based on my limited experience with contrast(), if you encounter such
an error message you just mentioned, check
dat.lme$apVar
You might see something like this
[1] Non-positive definite approximate
I'm running a categorical data analysis with a two-way design of
nominal by ordinal structure like the Political Ideology Example
(Table 9.5) in Agresti's book Categorical Data Analysis. The nominal
variable is Method while the ordinal variable is Quality (Bad,
Moderate, Good, Excellent).
1 - 100 of 123 matches
Mail list logo