Dear R Users,
I am trying to write a script to count the longest consecutive
occurring 1 in a sequence:
test-c(1,1,1,1,1,1,1,0,0,0,0,1,1,0,1,0,1,0,1,1)
In the case of the object test, 1 occurs 7 consecutive times which
is the longest consecutive within the sequence.
I know I can always do a
(test), max(lengths[!!values]))
On Sat, May 23, 2009 at 1:09 PM, tsunhin wong thjw...@gmail.com wrote:
Dear R Users,
I am trying to write a script to count the longest consecutive
occurring 1 in a sequence:
test-c(1,1,1,1,1,1,1,0,0,0,0,1,1,0,1,0,1,0,1,1)
In the case of the object test, 1
(lengths[values==0]))
[1] 7
Many thanks!
- John
On Sat, May 23, 2009 at 1:54 PM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
!!
On Sat, May 23, 2009 at 1:52 PM, tsunhin wong thjw...@gmail.com wrote:
Thanks!
I tested it using:
test-c(1,1,1,1,1,0,0,0,0,0,0,0,1,1,0,1,0,1,0,1,1)
that has
Dear R Users,
I have created a 1500 x 2 data frame - DataSeq. Each of the 1500
rows represents a data sequence.
I have another data frame iData that stores the information of these
1500 data sequences in the same order, for example, condition, gender,
etc.
If I use subset to select certain
the list of indices into iData for the criteria, then
you can use that to get the appropriate rows:
indx - which(iData 5) # or whatever your criteria is
DataSeq[indx,, drop=FALSE] # gives you a subset matrix of just the rows you
are interested in.
On Thu, May 21, 2009 at 10:10 AM, tsunhin wong
Dear R Users,
I have some dynamic selection rules that I want to pass around for my functions:
rules - paste(g$TrialList==1 g$Session==2)
myfunction - function(rules) {
index - which(rules)
anotherFunction(index)
}
However, I can't find a way to pass around these selection rules
easily
Dear all,
I found the answer:
intersect()
- John
On Thu, May 21, 2009 at 7:32 PM, tsunhin wong thjw...@gmail.com wrote:
Dear Jim,
Thanks for your suggestion.
I have a follow-up question for fellow R Users that have followed this thread:
*I used to create two lists by some very flexible
Dear R users,
I have 1 data.frame of 1500x80 - data1. I found out that there are a
few cells of data that I have misplace, and I need to fix the ordering
of them.
In an attempt trying to swap column 22 23 of the Subject with
misplaced data, I did the following:
data2 - data1
Dear R users,
I have been using a dynamic data extraction from raw files strategy at
the moment, but it takes a long long time.
In order to save time, I am planning to generate a data set of size
1500 x 2 with each data point a 9-digit decimal number, in order
to save my time.
I know R is
Hello all,
Probably my concepts about the data.frame and matrix and array in R
are not clear, I need some clarification to help me understand them
better.
M - read.table(test1.csv,sep=,,row.names=NULL,header=T)
gives me: M as
M1 M2 M3 M4 M5 M6 M7 M8 M9 M10
1 9 11 14 15 18 20 20 20 20 20
2
Dear R Users,
I was running some data analysis scripts and ran into this error:
Error: cannot allocate vector of size 27.6 Mb
Doing a memory.size(max=TRUE) will give me:
[1] 1506.812
The current situation is:
I'm working on a Windows Vista 32bit laptop with 4GB RAM (effectively
3GB I
Also,each data.frame of the 1500 working as data sources floating in
the global environment is of a size ranging from 2000x36 to 9000x36
Please help...! THANKS!!!
- John
On Mon, Dec 15, 2008 at 1:12 PM, tsunhin wong thjw...@gmail.com wrote:
Dear R Users,
I was running some data analysis
Dear all R users,
I am going to use R to process some of my physiological data about eye.
The problem is the recording machine does not sample in a reliably
constant rate: the time intervals between data sampled can vary from
9msec to ~120msec, while most around in the 15-30msec range.
The below
Dear R users,
I'm trying to plot 45x8 graphs on the same pdf / device for the sake
of visual comparison.
par(mfcol=c(45,8))
par(mai=c(0,0,0,0))
In ?title, I can see there are cex and font settings: I set cex = 0.01
and font = 1: it is still very large, and then I tried setting font
1, e.g. font
, 8), mai=c(0,0.1,0.1,0))
sapply(1:(45*8), function(ii) {
plot(x, rnorm(x))
title(paste(test, ii), cex.main=0.5)
}) - b.quiet
dev.off()
Hope this helps,
baptiste
On 10 Dec 2008, at 13:42, tsunhin wong wrote:
Dear R users,
I'm trying to plot 45x8 graphs
I found I have to use font=1, and I found it works when I set:
par(mfcol=c(45,8))
par(mar=c(0,0.5,1,0.5))
instead of
par(mfcol=c(45,8))
par(mai=c(0,0,0,0))
On Wed, Dec 10, 2008 at 9:22 AM, tsunhin wong [EMAIL PROTECTED] wrote:
What if cex=0.001 with font=1 will still have the title font too
Message-
From: tsunhin wong [mailto:[EMAIL PROTECTED]
Sent: Monday, December 08, 2008 1:34 PM
To: Greg Snow
Cc: Jim Holtman; r-help@r-project.org; [EMAIL PROTECTED]
Subject: Re: [R] Transforming a string to a variable's name? help me
newbie...
I want to combine all dataframes into one
of data
frames (into 1 row or otherwise).
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
801.408.8111
-Original Message-
From: tsunhin wong [mailto:[EMAIL PROTECTED]
Sent: Monday, December 08, 2008 1:34 PM
To: Greg Snow
Cc
/12/9 tsunhin wong [EMAIL PROTECTED]:
I did really want to find make the suggestion work... it is going to
save my time...
I worked on trying to put all dataframes into a list() by:
###start of file
rm(list=ls())
setwd(/Users/John/Programs/R)
load(Expt108Master2008.Rdata)
nms - ls(pattern
Dear all,
I'm a newbie in R.
I have a 45x2x2x8 design.
A dataframe stores the metadata of trials. And each trial has its own
data file: I used read.table to import every trial into R as a
dataframe (variable).
Now I dynamically ask R to retrieve trials that fit certain selection
criteria, so I
[EMAIL PROTECTED] wrote:
?get
Sent from my iPhone
On Dec 8, 2008, at 7:11, tsunhin wong [EMAIL PROTECTED] wrote:
Dear all,
I'm a newbie in R.
I have a 45x2x2x8 design.
A dataframe stores the metadata of trials. And each trial has its own
data file: I used read.table to import every trial
Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
project.org] On Behalf Of tsunhin wong
Sent: Monday, December 08, 2008 8:45 AM
To: Jim Holtman
Cc: r-help@r-project.org
Subject: Re: [R] Transforming a string to a variable's name? help me
newbie...
Thanks Jim and All
22 matches
Mail list logo