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 wrote:
>>
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
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
>
> Thanks again for patiently o
cture(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 labels just requires the
], 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
> Subject: Re: [R] aggregate
ge 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 Chen,
> I
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 wrote:
>>
>> With the follo
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 can
>
> 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
>
>
> On 19/11/15 08:28,
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 defin
fter the
> package is next built on R-Forge, 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] Pro
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:
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
"h
at does R say is the user's home directory? Did you make
> *any* changes to Rprofile.site, 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 wrote:
>>
>> When R starts in GUI
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 failu
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 wrote:
>
> On Aug 27, 2014, at 1:11 PM, Gang Chen wrote:
>
>> Good point!
>>
>> Here is an example:
>>
&g
rocess automatic.
On Wed, Aug 27, 2014 at 3:49 PM, David Winsemius 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 th
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 wrote:
>
> On Aug 27, 2014, at 11:19 AM, Gang Chen wrote:
>
>> A random effect formulation for R package nlme is read
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?
range of values you have to work with then one of the other
> more efficient methods may still be a better choice for this specific task.
>
> Hadley Wickham's "tidy data" [1] principles address this concern more
> thoroughly than I have.
>
> [1] Google this phrase...
mple data and use dput() to include it in your
> email.
>
> Sarah
>
> On Thu, Jul 17, 2014 at 11:00 AM, Gang Chen wrote:
>> Suppose I have the following dataframe:
>>
>> L4 <- LETTERS[1:4]
>> fac <- sample(L4, 10, replace = TRUE)
>> (d <- data.f
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 an
8366e-35 # Sex    Â
>#2 13.3696538 1 5.114571e-04 # Volume Â
>#3  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.
&g
; 2.6349405 1 2.090719e-01 # ISO
> 6.0507714 1 2.780045e-02 # SEC
>
>
>David Carlson
>
>-----Original Message-
>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-h
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', 'Pr(>Ch
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 tim
gt;
>
> best
> daniel
>
> Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ;
> meghatalmazó: Gang Chen [gangch...@gmail.com]
> Küldve: 2013. december 14. 21:09
> To: r-help
> Tárgy: [R] Change factor levels
>
> Suppose I have
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' onl
en everyone who tries it will get the same data
> frame d.
>
> Sarah
>
>
> On Fri, Dec 13, 2013 at 4:15 PM, Gang Chen wrote:
> > Suppose I have a dataframe defined as
> >
> > L3 <- LETTERS[1:3]
> > (d <- data.frame(cbind(x = 1, y = 1:10), fac
Perfect! Thanks a lot, A.K!
On Fri, Dec 13, 2013 at 4:21 PM, arun wrote:
>
>
> Hi,
> Try:
> d[match(unique(d$fac),d$fac),]
> A.K.
>
>
> On Friday, December 13, 2013 4:17 PM, Gang Chen
> wrote:
> Suppose I have a dataframe defined as
>
> L3 <- LE
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
uld just call that function directly. 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 wrote:
>>
>> This is most likely a silly questi
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 <- factor(rep(c("pr
à 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 (Fedo
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
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
7;Answers.R')
>
> # run again this time with answers available
>> source('myTest.R')
> [1] -1.088665 # skips prompt
> [1] -1.088665 # -1.088^1 (type in Answer.R ==1)
>
> # Now you can also run as batch
> $ R CMD BATCH myTest.R out.R
> $ cat out.R
&g
e "type<- readline(...)" in your script so type
> wouldn't be overwritten in subsequent runs.
>
> 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 ans
from a previous run in
interactive mode, s/he may try out the batch mode the next time.
> On Tue, Feb 7, 2012 at 4:05 PM, Gang Chen wrote:
>> Suppose I create an R program called myTest.R with only one line like
>> the following:
>>
>> type <- as.integer(readlin
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 t
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 wrote:
>
> On Oct 7, 2011, at 1:30 PM, David Winsemius wrote:
>
>>
>> On Oct 7, 2011, at 7:40 AM, Gang Chen wrote:
>>
&
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 wrote:
> On 10/07/2011 07:28 AM, Gang Chen wrote:
>>
>> I have some data 'myData' in wide form (
value_var = 'value')
> head(mData4, 4)
>
> Subj Group Ref Time F J
> 1 S1 s Me 1 4 5
> 2 S1 s Me 2 3 6
> 3 S1 s She 1 6 10
> 4 S1 s She 2 6 9
>
> mData5 <- cast(mData3, Subj + Group + Ref + Var ~ Time, value_var
ndrew Miles 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'
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 fa
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) becaus
c(0,12), 12)
[1] 0 3
However, I feel my solution is a little kludged. Any better idea?
Thanks,
Gang
On Thu, Jul 7, 2011 at 9:04 PM, David Winsemius wrote:
>
> 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 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)
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?
, 4,8) )
>
> ubj substr(variable, 1, 2)Cond1Cond2
> 1 1 T1 0.125869 4.108232
> 2 1 T2 1.099392 5.556614
> 3 2 T1 1.427940 2.170026
> 4 2 T2 0.120748 1.176353
>
> The modifications to
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 eleg
Statistical Computing Facility
> Department of Statistics
> UC Berkeley
> spec...@stat.berkeley.edu
>
>
>
> On Thu, 10 Mar 2011, Gang Chen w
or.
> --
> 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 wrote:
>>
>> n = c(2, 3, 5)
>> > s = c("aa", "bb", "cc
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
_
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 wrote:
>
> 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
>> diago
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
>
>
> On 08.01.2011 16:38, Gang Chen wrote:
>
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
You nailed it, Prof. Ripley! Thanks a lot...
Gang
On Sat, Oct 30, 2010 at 2:58 PM, Prof Brian Ripley
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
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
miss
e elegant
modification 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 wrote:
> On Sat, 27 Mar 2010, Gang Chen wrote:
>
>> Anybody knows what functions can be used to calculate
&
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)
ngapore
> http://courses.nus.edu.sg/course/psycwlm/internet/
> -
>
> On Mon, Feb 8, 2010 at 6:48 AM, Gang Chen wrote:
>> Dear Mike,
>>
>> Thanks a lot for the kind help!
>>
>> Actually a
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 e
t;,collapse="")
>>
>> See ?paste for more information.
>>
>> HTH,
>>
>> Jorge
>>
>>
>> On Thu, Apr 9, 2009 at 5:23 PM, Gang Chen wrote:
>>
>>> I have some bits stored like the following variable nn
>>>
>&g
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 mail
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 meant
. 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 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
; 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
> To: Henrique Dallazuanna
> Cc: r-h...@stat.math.ethz.ch
> Sent: Tuesday, January 6, 2009 10
-sample
t-test. Is there a way I can achieve the same with mapply()?
Thanks again,
Gang
On Tue, Jan 6, 2009 at 12:34 PM, Henrique Dallazuanna wrote:
> I think that you can use mapply for this.
>
> On Tue, Jan 6, 2009 at 3:24 PM, Gang Chen wrote:
>>
>> I can run one-sample t-
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
__
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,
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("devi
EMAIL PROTECTED]>
> wrote:
>> > I am sure you will get helpful answers. I am almost as sure that you
>> > shouldn't be doing this. I suggest you consult with your local
> statistician.
>> >
>> > -- Bert Gunter
>> >
>> > -O
.First.sys at the beginning of
> prog.R to get 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 b
t; and "R
--interactive < prog.R", 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, int
shouldn't be doing 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]
>
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
https://stat.ethz.ch/mailman/l
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 th
> location:
>
> Find(file.exists, file.path(p, "prog.R"))
>
> 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 i
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 n
--
> John Fox, Professor
> Department of Sociology
> McMaster University
> Hamilton, Ontario, Canada
> web: socserv.mcmaster.ca/jfox
>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> On
>> Behalf Of Gang Chen
>> Se
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
MAIL PROTECTED]
> +44 (0)20 8525 0696
> 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(
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(mode='list', length=10)
and storing each lm() result into a component of myArray.
My question is, how
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 nl
k 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]
> &g
-10 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 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
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)
H
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", &qu
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
ve such problem?
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-proj
lazuanna 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]> wrote:
>>>> I have two arrays A and B with dimensions o
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
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 wan
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
___
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 MyO
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 wit
1 - 100 of 130 matches
Mail list logo