One possibility is:
x <- c(30.9, 60.1 , 70.0 , 73.0 , 75.0 , 83.9 , 93.1 , 97.6 , 98.8 ,
113.9)
for (i in 1:9) assign(paste("PAIR",i,sep=""),list(part1 = x[1:i],part2 =
x[-(1:i)]))
--- On Mon, 23/6/08, Gundala Viswanath <[EMAIL PROTECTED]> wrote:
> From: Gundala Viswanath <[EMAIL PRO
Gundala Viswanath wrote:
Hi,
How can I partitioned an example vector like this
print(myvector)
[1] 30.9 60.1 70.0 73.0 75.0 83.9 93.1 97.6 98.8 113.9
into the following pairwise partition:
PAIR1
part1 = 30.9
part2 = 60.1 70.0 73.0 75.0 83.9 93.1 97.
Hi,
How can I partitioned an example vector like this
> print(myvector)
[1] 30.9 60.1 70.0 73.0 75.0 83.9 93.1 97.6 98.8 113.9
into the following pairwise partition:
PAIR1
part1 = 30.9
part2 = 60.1 70.0 73.0 75.0 83.9 93.1 97.6 98.8 113.9
PAIR2
part1 = 30.9
See
?split
help.search() is (or should be) your friend.
HTH,
Chuck
On Mon, 23 Jun 2008, Gundala Viswanath wrote:
Hi,
Given this data frame:
print(repo.dat)
V1 V2 V3 V4
V5 (can be more)
1 1007_s_at DDR1 286
You could do something like:
k <- dim(repo.dat)[2]
odd <- seq(from=1,to=k,by=2)
even <- seq(from=2,to=k,by=2)
even<-c(1,even)
df1 <- repo.dat[,odd)
colnames(df1) <- paste("V",odd,sep="")
df2 <- repo.dat[,even)
colnames(df2) <- paste("V",even,sep="")
--- On Mon, 23/6/08, Gundala Viswanath <[EMAIL
Or use make.unique() in place of apseq()
On Sun, 22 Jun 2008, Gabor Grothendieck wrote:
Try this. apseq() sorts the input and appends a
sequence number: 0, 1, ... to successive
occurrences of each value. Apply that to both
vectors transforms it into a problem that works
with ordinary match:
How about
x <- lookupTable
x[!(x %in% matchSample)] <- NA
pmatch(matchSample,x)
Regards,
Moshe.
--- On Mon, 23/6/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> From: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
> Subject: [R] One-to-one matching?
> To: r-help@r-project.org
> Received: Monday, 23
Try this. apseq() sorts the input and appends a
sequence number: 0, 1, ... to successive
occurrences of each value. Apply that to both
vectors transforms it into a problem that works
with ordinary match:
> lookupTable <- c("a", "a","b","c","d","e","f")
> matchSample <- c("a", "a","a","b","d")
>
First, simulate a uniform r.v on [0,1] and then cast it to binary label
according to your underlying mixing probability;
Second, simulate a Gaussian r.v. in above selected component.
Of course, you can vecterize the two steps to simply your code.
X
Peng Jiang 写道:
Hi,
Is there any package
Hi,
Given this data frame:
> print(repo.dat)
V1 V2 V3 V4
V5 (can be more)
1 1007_s_at DDR1 2865.1 2901.3 1978.3 300.2
2 1053_at RFC2 103.681.6 108.0 101.3
I want to split them into two data
Hi:
Thank you very much,and for your case
if I wirte as
regress=lme(yield~nitro*Variety,data=Oats,random=~Variety|Block)
what this mean?
Regards
2008/6/22 Daniel Malter <[EMAIL PROTECTED]>:
> Hi,
>
> random=~1|B/C
> C is nested in B
>
> ##Example
> data=Oats
> regress=lme(yield~nitro*Va
Hi folks,
Can anyone suggest an efficient way to do "matching without
replacement", or "one-to-one matching"? pmatch() doesn't quite provide
what I need...
For example,
lookupTable <- c("a","b","c","d","e","f")
matchSample <- c("a","a","b","d")
##Normal match() behaviour:
match(matchSample,lo
Thanks so much Jim.
- Gundala Viswanath
Jakarta - Indonesia
On Mon, Jun 23, 2008 at 11:22 AM, jim holtman <[EMAIL PROTECTED]> wrote:
> Wait. The first column is really the rowname. So you want this:
>
>> row.names(x)
> [1] "11145" "3545" "8951" "11097"
>
>
> On Sun, Jun 22, 2008 at 10:16 PM,
Hi,
random=~1|B/C
C is nested in B
##Example
data=Oats
regress=lme(yield~nitro*Variety,data=Oats,random=~1|Block/Variety)
##i.e. variety is nested in block
summary(regress)
##End of example
Best,
Daniel
-
cuncta stricte discussurus
-
-Urspr
Wait. The first column is really the rowname. So you want this:
> row.names(x)
[1] "11145" "3545" "8951" "11097"
On Sun, Jun 22, 2008 at 10:16 PM, Gundala Viswanath <[EMAIL PROTECTED]> wrote:
> Hi,
>
> How can I extract the label only from a given data frame.
>
> Fore example from this data
Is this what you want:
> x
V1 V2V3V4V5V6V7V8V9
11145 14.3 17.1 31.2 41.7 45.8 49.8 68.6 70.6 72.9
3545 10.2 15.6 20.9 23.2 31.4 31.7 36.2 48.4 51.9
8951 15.2 17.5 20.0 21.4 32.4 49.7 51.3 58.3 58.9
11097 59.5 65.9 117.5 118.0 118.9 122.5
Hi,
How can I extract the label only from a given data frame.
Fore example from this data frame.
> print(dataf)
V1 V2 V3 V4 V5 V6 V7 V8 V9
1114514.317.131.241.745.849.868.670.672.9
3545 10.215.620.9
Hi, Peng,
I had a piece of SAS code for 2-class gaussian mixture from my blog.
You might convert it to R code.
2-Class Gaussian Mixture Model in SAS
data d1;
do i = 1 to 100;
x = ranuni(1);
e = rannor(1);
y = 5 * x + e;
output;
end;
run;
data d2;
do i = 1 to 100;
x = ran
Take a look at mixtools.
Tatiana
On Jun 22, 2008, at 9:23 PM, Peng Jiang wrote:
Hi,
Is there any package that I can use to simulate the Gaussian
Mixture Model , which is a mixture modeling method that is widely
used in statistical learning theory.
I know there is a mclust, however, I
Dear R users:
I just got confused some R code used in linear mixed model~
example,two factors,A, B,C,A is fixed ,B,C are random,and B is nested in
C,if I wannt to use linear mixed model,are the following code correct for
each case?
case1:want to know random effect of B,
case1<-lme(y~A*B*C
Hi,
Is there any package that I can use to simulate the Gaussian
Mixture Model , which is a mixture modeling method that is widely used
in statistical learning theory.
I know there is a mclust, however, I think it is a little bit
different from my problem.
Thanks very much..
regards.
Hey, good topic for a thread. I've wrestled with this over the years.
I think there's some user confusion about what WinBUGS does. People
who did not see BUGS before WinBUGS tend not to understand this in the
same way...
The unique / important contributions from WinBUGS are the collection
of wo
Hi all:
I have been using ggplot2 graphics for quite some time now and I really like
it. However, I haven't used barplots enough to understand the arquitecture
behind it. Can someone show me how to make this simple barplot graph with
ggplot2? I want "PondName" along the x axis and "avgWt" along
Wow -- many thanks for the mind-*expanding* help! I'm really impressed by
R's ability to handle this so concisely It's going to take me a while to
get used to applying things to vectors, but the more I understand, the nicer
R looks.
On Sun, Jun 22, 2008 at 6:59 PM, jim holtman <[EMAIL PROTECTED
What is the value of 'line' on the first iteration? It appears to be
undefined. You probably want something like this:
while (TRUE){
line <- readLines(con, n=1)
if (length(line) == 0) break
.your normal statements.
}
On Sun, Jun 22, 2008 at 3:29 PM, Yasin Hajizadeh
<[EMAIL P
This does away with the 'for' loops and uses 'expand.grid' to create
the combinations. I think I got the right variables substituted:
my.df <- data.frame(replicate(10, round(rnorm(100, mean=3.5, sd=1
var.list <- c("dv1", "dv2", "dv3", "iv1", "iv2", "iv3", "iv4", "iv5",
"intv1", "intv2")
names
# I've tried to make this easy to paste into R, though it's probably
so simple you won't need to.
# I have some data (there are many more variables, but this is a
reasonable approximation of it)
# here's a fabricated data frame that is similar in form to mine:
my.df <- data.frame(replicate(10, rou
Fantastic, works perfectly!
Would you have any pointers to where I can learn more about why/how this works?
Thanks!
Regarding the P.S., yes... it seemed appropriate at the time :-)
2008/6/21, Martin Maechler <[EMAIL PROTECTED]>:
>> "KM" == Karl Marx <[EMAIL PROTECTED]>
>> on Thu, 19
I tried it with a simple example to make it easier to check the
result and it does seem we need a panel function, pnl:
library(lattice)
DF <- data.frame(x = 1:5, col = c(1:4, 1), g = c(1, 1, 2, 2, 2), pch =
c(1:3, 2:1))
pnl <- function(x, y, subscripts, col, pch, ...) panel.stripplot(x, y,
col = c
Hi there
My script at each iteration produces a .dat file which I save in a directory
with write.table. Then I need to read each line of this file and create a
directory for each line and put elements of that row in that directory. I do it
with the following script which I have inserted somewh
Hi,
I have the following problem:
I want to redefine the for loop (or define a similar statement) to change its
behavior under some circumstances. So, I would like sthg. like
"For" = function ( var, vec, statement ) {
if ( ... ) {
/* my implementation of for */
}
else {
/* cal
Thanks Gabor, I'm getting closer.
Is there a way to spread out resp values vertically for a given value of
index? In base graphics, stripchart does this with method = "stack". But
in lattice, stack = TRUE does something rather different, and I don't see a
combination of lattice arguments that do
Actually I am not sure if my prior answer was correct. I think its ok
with one panel but
you might have to use a panel function is there are several. With one
panel it seems
ok:
stripplot(~ index, all, col = all$col, pch = all$sym)
On Sun, Jun 22, 2008 at 12:28 PM, Gabor Grothendieck
<[EMAIL PRO
I've done some looking around in R and elsewhere to answer my question
on the value of R vs. Bugs for MCMC. So, for anyone who is curious,
here's what I think I've found: Bugs compiles its code, which should
make it much faster than a pure R program. Packages such as AMCMC run
MCMC in R, potenti
Try this:
library(lattice)
all$resp <- as.factor(all$resp)
stripplot(~ index | resp * yr, all, col = all$col, pch = all$sym,
layout = c(1, 4))
On Sun, Jun 22, 2008 at 10:43 AM, Bryan Hanson <[EMAIL PROTECTED]> wrote:
> Below is a revised set of code that demonstrates my question a little more
>
Maybe this help you
http://www.rforge.net/Cairo/index.html
http://www.rosuda.org/R/GDD/
daniel cegielka
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of milton ruser
Sent: Sunday, June 22, 2008 5:56 PM
To: Josep Lluís Figueras
Cc: r-help@r-project.org
S
Hi there,
try to open a graphic device with x11(), may be.
cheers,
miltinho
On 6/22/08, Josep Lluís Figueras <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am using RSPerl package on Ubuntu and Apache2 web server. It is my first
> experience with R language :-)
>
> I have the next code embedded into
Josep Lluís Figueras wrote:
Hi,
I am using RSPerl package on Ubuntu and Apache2 web server. It is my first
experience with R language :-)
I have the next code embedded into a Perl CGI:
use R;
use RReferences;
my @x;
&R::initR("--silent","--no-save");
&R::library("RSPerl");
@x = &R::call("rnor
Below is a revised set of code that demonstrates my question a little more
clearly, I hope.
When plotting all the data (5th panel), col & sym don't seem to be passed
correctly, as the (random) first value for col & sym are used for all points
(run the code, then run it again, you'll see how the 5t
See
https://bugzilla.redhat.com/show_bug.cgi?id=442727
Right now I seem to be using
/usr/share/doc/R-2.7.0/html
to get the list (on finzi.psych.upenn.edu)
On 06/22/08 20:43, Jim Lemon wrote:
> Hi all,
> As I was uploading a couple of little fixes to prettyR, I remembered
> that there was a quest
See orderBy in the doBy package.
On Sat, Jun 21, 2008 at 7:58 PM, Jiří Voller <[EMAIL PROTECTED]> wrote:
> Dear R-users,
> is there some way how to pass various colnames to the following code for
> sorting data.frames?
>
> mydf.ordered<-with(mydf, mydf[order(colname1,colname2, colnameX, decreasing
Hi,
I am using RSPerl package on Ubuntu and Apache2 web server. It is my first
experience with R language :-)
I have the next code embedded into a Perl CGI:
use R;
use RReferences;
my @x;
&R::initR("--silent","--no-save");
&R::library("RSPerl");
@x = &R::call("rnorm", 10);
&R::call("plot", [EMA
Hi all,
As I was uploading a couple of little fixes to prettyR, I remembered
that there was a question I wanted to ask. I remember the package list
being updated whenever I installed a new package (at least on Linux, oh
yes, Fedora Core 9 now), but not on Windows (I just used to unzip the
packages
Hi,
I use RSPerl on Ubuntu and Apache2 web server. It is my first experience
with R language :-)
I have the next code embedded into a Perl CGI:
use R;
use RReferences;
my @x;
&R::initR("--silent","--no-save");
&R::library("RSPerl");
@x = &R::call("rnorm", 10);
&R::call("plot", [EMAIL PROTECTED]
Your request is too vague for us to be very helpful. However OpenBUGS
runs without very frequent crashes only on some ix86 Linux machines -- and
what those are is unclear and Uwe Ligges and I (working on BRugs) have
been unable to find one recently.
There are dozens of Bayesian MCMC packages
The problem is dat is a data object, not a function. You used the syntax for
a function "dat(1:19)"
What you probably want is:
gc <- dat[,1:19]
act <- dat[,20:39]
That will select columns 1 through 19 and put them into the object gc, and
act will get columns 20 through 39. Is that what you wa
You are drawing four box plots, not two. Two of them are just the number 5.
The two box plots that are only "5" don't have a box, so you can't see that
they're red. Try this:
boxplot(1:19,20:39,col=c("red","blue"))
Paul Adams-8 wrote:
>
> Hello everyone,
>
>
> I am trying to color two boxpl
- There is no column in the data frame called "row.names". It only
looks that way when you use the viewer.
- All data frames must have row and column names. This is not
negotiable. Also, the row.names will not interfere with any merging
operation because they are not a column of the data frame:
48 matches
Mail list logo