Uwe Ligges wrote:
Please read the question more carefully, the sin() example was used
as a method that does not give an error but works as expected (just
with the warning), but the question is how not to break the loop,
and so my answer was see ?try.
So,
Do you have any solution about his
Sorry about the simple question. Is there any function to transform a
data.frame like this (rows are observations and columns are
variables):
Q1_1 Q1_2 Q1_3 Q1_4 Q1_5 Q1_6 Q1_7 Q1_8
155545454
245355535
344344
Nash wrote:
Uwe Ligges wrote:
Please read the question more carefully, the sin() example was used
as a method that does not give an error but works as expected (just
with the warning), but the question is how not to break the loop,
and so my answer was see ?try.
So,
Do you have any
Okay!
Thank you!
On Sun, 29 Mar 2009 10:01:29 +0200, Peter Dalgaard wrote
Nash wrote:
Uwe Ligges wrote:
Please read the question more carefully, the sin() example was used
as a method that does not give an error but works as expected (just
with the warning), but the question is how
Edna Bell wrote:
Could someone point me to a small example of a linear mixed effects
model, please?
Check R_HOME/library/nlme/scripts/ch01.R
But better get the book by Pinheiro/Bates (PB)
Edna Bell wrote:
Ideally, this example would only have a few data points so I could
calculate
Suppose I have a long format for a longitudinal data
id time x
1 1 10
1 2 11
1 3 23
1 4 23
2 2 12
2 3 13
2 4 14
3 1 11
3 3 15
3 4 18
3 5 21
4 2 22
4 3 27
4 6 29
I want to select the x values for each ID when time is equal to 3. When that
observation is not observed, then I want to replace it
Here is a possibility. There is only one trick.
data
Q1_1 Q1_2 Q1_3 Q1_4 Q1_5 Q1_6 Q1_7 Q1_8
155545454
245355535
344344442
455555444
5555555
John Poulsen wrote:
Hello R-Users,
I am plotting several histograms to demonstrate zero-inflated data
using lattice. Because there are so many zeros, it is difficult to
see the observations of non-zeros on the graph (i.e. the y-axis scale
is too large). I would like to break the y-scale so
Let's tackle the bigger problem of doing this not just for time = 3 but for all
times.
First we start with your data frame:
dat
id time x
1 11 10
2 12 11
3 13 23
4 14 23
5 22 12
6 23 13
7 24 14
8 31 11
9 33 15
10 34 18
11 35
aa[order(aa)] is the same as sort, although sort is much quicker and
has lower memory requirements:
aa - rnorm(1000)
all(aa[order(aa)] == sort(aa))
[1] TRUE
system.time(sort(aa))
user system elapsed
7.270.088.25
system.time(aa[order(aa)])
user system elapsed
29.58
Hi,
Again, thank you for your extremely helpful answer. I'll try my luck a third
time with a similar but different question: assuming I have two dataframes,
a and b, each of which containing a set of start and end coordinates, and I
want to create a new dataframe c, which contains all coordinates
On 28/03/2009 4:57 PM, Stavros Macrakis wrote:
On Sat, Mar 28, 2009 at 7:53 AM, Duncan Murdoch murd...@stats.uwo.ca wrote:
...More generally, the xtfrm() function converts a vector into a numeric one
that sorts in the same order. ...
Thanks, I learn a lot just by reading the answers to other
On 28/03/2009 9:42 PM, a s wrote:
Hi, I am trying to specify four ticks (at 0,1,2,3 for the y axis) in a persp
plot but the defaults overrule my specification and I obtain seven of them.
Is it possible to gain full control over them in such a plot? Here is my
code:
Thanks for posting these. One minor correction about Rtools
installation below:
On 28/03/2009 11:25 PM, Ken-JP wrote:
I recently got a RFC on Eclipse and StatET setup from a R-help user, so here
it is.
Note: there may be slight errors of omission in my directions as I am making
these notes
Dear all,
I have a word frequency list from a corpus (say, in .csv), where the
first column is a word and the second is the occurrence frequency of
that word in the corpus. Is it possible to obtain a Burt table (a
table crossing all words with each other, i.e., where rows and columns
are
gallon li wrote:
Suppose I have a long format for a longitudinal data
id time x
1 1 10
1 2 11
1 3 23
1 4 23
2 2 12
2 3 13
2 4 14
3 1 11
3 3 15
3 4 18
3 5 21
4 2 22
4 3 27
4 6 29
I want to select the x values for each ID when time is equal to 3. When that
observation is not
Looking into the 'Optimization' task view you will also identify the
Rsymphony package. A short overview of these packages and a benchmark
based on a test suite can be found in
http://www.rmetrics.org/Meielisalp2008/Presentations/Theussl2.pdf.
Different problems may have quite different
require(circular)
c - circular(rep(0, 20), zero = pi/2, rotation = 'clock')
plot(c, stack = TRUE, shrink = 1.5)
Can anyone tell me why the stack is offset from 0?
_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400
On 29/03/2009 7:02 AM, Joan-Josep Vallbé wrote:
Dear all,
I have a word frequency list from a corpus (say, in .csv), where the
first column is a word and the second is the occurrence frequency of
that word in the corpus. Is it possible to obtain a Burt table (a
table crossing all words
Wacek Kusnierczyk wrote:
gallon li wrote:
Suppose I have a long format for a longitudinal data
id time x
1 1 10
1 2 11
1 3 23
1 4 23
2 2 12
2 3 13
2 4 14
3 1 11
3 3 15
3 4 18
3 5 21
4 2 22
4 3 27
4 6 29
I want to select the x values for each ID when time is equal to 3. When that
observation
On 29/03/2009 7:39 AM, Michael Kubovy wrote:
require(circular)
c - circular(rep(0, 20), zero = pi/2, rotation = 'clock')
plot(c, stack = TRUE, shrink = 1.5)
Can anyone tell me why the stack is offset from 0?
It's a histogram, and the bin starts at zero, and runs to pi/10 (I'm
guessing, since
Peter Dalgaard wrote:
times = 3:4
do.call(rbind, by(data, data$id, function(data)
with(data, {
rows = (time == times[which(times %in% time)[1]])
if (is.na(rows[1])) data.frame(id=id, time=NA, x=NA) else
data[rows,] })))
# id time x
# 1
Thank you! I managed it with this function - for a data fram with x and y
coordinates:
anglefun-function(x,y,unit=degrees) {x.new-outer(x,x,-);
y.new-outer(y,y,-);angles-atan2(x.new,y.new);diag(angles)-NA;if(unit
== degrees)
return(180*angles/pi)
if (unit == radians)
return(angles)}
returns a
Hello,
I would like to subscribe to the mailing list. I already receive the daily
digest, but for some reason I am not subscribed to the list, meaning any
posts I make by replying to the e-mail digest have to be placed on the list
by a moderator - incurring significant delay.
Thanks,
Michael
hi ladies and gentlemen of the R community.
i'm federico an italian student of statistics and i've got an issue to submit
to you:
i've got a huge file.txt replenished of blank values (over a milion of them).
by importing it into R the read.table() function higlights missing objects per
row
Example 7c has been aded to the home page which illustrates how
to do this using nested selects.
http://sqldf.googlecode.com
2009/3/29 Schragi Schwartz schra...@post.tau.ac.il:
Hi,
Again, thank you for your extremely helpful answer. I'll try my luck a third
time with a similar but different
Hi,
Not exactly sure what you mean, but try
? intersect
and see if this matches your need.
Cheers,
Umesh
On Sun, Mar 29, 2009 at 6:28 PM, Gabor Grothendieck ggrothendi...@gmail.com
wrote:
Example 7c has been aded to the home page which illustrates how
to do this using nested selects.
On 29/03/2009 8:53 AM, Giacomo Prodi wrote:
hi ladies and gentlemen of the R community.
i'm federico an italian student of statistics and i've got an issue to submit
to you:
i've got a huge file.txt replenished of blank values (over a milion of them).
by importing it into R the read.table()
Hi R users,
I have a time series variable that is only available at a monthly level for
1 years that I need to decompose to a weekly time series level - can
anyone recommend a R function that I can use to decompose this series?
eg. if month1 = 1200 I would to decompose so that the sum of the
On 29/03/2009 9:23 AM, Michael Kubovy wrote:
Thanks so much. I have another question:
why the difference here:
require(circular)
c1 - circular(pi/2 + .0, zero = pi/2, rotation = 'clock')
c2 - circular(pi/2 + .1, zero = pi/2, rotation = 'clock')
opar - par(mfrow = c(1, 2))
plot(c1,
Thanks so much. I have another question:
why the difference here:
require(circular)
c1 - circular(pi/2 + .0, zero = pi/2, rotation = 'clock')
c2 - circular(pi/2 + .1, zero = pi/2, rotation = 'clock')
opar - par(mfrow = c(1, 2))
plot(c1, stack = TRUE, bins = 1, main =
On 29/03/2009 9:58 AM, Duncan Murdoch wrote:
On 29/03/2009 9:23 AM, Michael Kubovy wrote:
Thanks so much. I have another question:
why the difference here:
require(circular)
c1 - circular(pi/2 + .0, zero = pi/2, rotation = 'clock')
c2 - circular(pi/2 + .1, zero = pi/2, rotation =
I see on occasion posts to this list useR group meetings in various
cities. Not sure how these get organized in general, so I'm wondering if
a post here regarding a user meeting in Washington DC might start that
conversation.
Since this isn't related to r-help, I think it is best to keep any
Hi,
Here is another approach:
set.seed(123)
x - sort(runif(200))
y - sin(3*pi*x) + rnorm(200, sd=0.1)
smspl - smooth.spline(x, y)
d2 - function(x) predict(smspl, x , deriv=2)$y
x - seq(0, 1, length=500)
plot(x, d2(x), type=l)
abline(h=0, lty=2)
uniroot(f=d2, interval=c(0.1, 0.5)) # first
On 29-Mar-09 11:48:12, Michael Larsson wrote:
Hello,
I would like to subscribe to the mailing list. I already receive
the daily digest, but for some reason I am not subscribed to the
list, meaning any posts I make by replying to the e-mail digest
have to be placed on the list by a moderator -
Ravi,
I solve for the fixed-point x=g(x;b,Y). The variable Y is given - i
can omitted here to not introduce confusion.
max_{x,b} f(x,b)
constrx=g(x;b)
Let b1 the initial values for b. Having b1 I
can compute the solution x1 of the system x=g(x,b1) - x1 fixed-point.
So,
Its not clear what it means for the sum of
the weeks in a month to equal the month
since the weeks don't evenly divide
a month but if we apportion them pro
rata then here is a possibility.
We create the input monthly series z and
then produce a series of Date class days
d covering the period.
I'm trying to follow along in a text by Velleman and others, with the
'handwashing' example of anova. I used read.table() to read the data, and
now I have an object d (put below the dots here), with an entry Method that
has possible values Water, Soap, etc. What I can't figure out is how to
Dear colleagues,
Can anyone give some clues about how best to conduct post-hoc comparisons or
planned comparisons for repeated-measures data in R? The UCLA web site gives
wonderful examples for doing repeated-measures analyses of variance, but
pairwise or other comparisons are still escaping
Ok, thank you. And is there any function to get the table directly
from the original corpus?
best,
joan-josep vallbé
On Mar 29, 2009, at 2:00 PM, Duncan Murdoch wrote:
On 29/03/2009 7:02 AM, Joan-Josep Vallbé wrote:
Dear all,
I have a word frequency list from a corpus (say, in .csv),
You don't need to find the fixed points. This is a kind of profiling
approach. As I had said before, a better approach would be to jointly maximize
over x and b:
max_{x, b} h(x, b) = f(g(x,b), b).
You can use any unconstrained optimization tools (assuming there are no
box-constraints on x
I have data in a file named hands.dat, which is given at the end of this
question. (It's from a stats textbook example on anova). I'd like to do an
aov on this, which I guess would be
d - read.table(~/hands.dat, header=TRUE)
aov(Bacterial.Counts ~ Water + Soap + Antibacterial.Soap +
Hi Dan,
You could kill two birds with one stone (i.e. learn about both linear
models and R at the same time) by using one of the many R-focused
modeling references. Quite a few can be found in the contributed
documentation section of CRAN. Here's one:
On 29-Mar-09 16:32:11, Joan-Josep Vallbé wrote:
Ok, thank you. And is there any function to get the table directly
from the original corpus?
best,
joan-josep vallbé
You will have to think about what you are doing. As Duncan said,
you need counts of pairs of words or, more precisely, of
As a followup, I show below what I get if I break out the variables by
making a new data frame with new (boolean) columns that indicate the
treatment. (The experiment was germ count on hands, after cleansing with 4
different methods.)
What I'm hoping is to find a way to do this in a less
Hi Dwight,
The answer likely depends on how you are fitting the model. Have a
look at the multcomp package and its vignettes to see if it can handle
the model class you are interested in.
hth,
Kingsford Jones
On Sun, Mar 29, 2009 at 11:11 AM, Krehbiel, Dwight
krehb...@bethelks.edu wrote:
Dan Kelley kelley.dan at gmail.com writes:
I have data in a file named hands.dat, which is given at the end of this
question. (It's from a stats textbook example on anova). I'd like to do an
aov on this, which I guess would be
d - read.table(~/hands.dat, header=TRUE)
On Sun, Mar 29, 2009 at 6:15 AM, Duncan Murdoch murd...@stats.uwo.ca wrote:
On 28/03/2009 4:57 PM, Stavros Macrakis wrote:
On Sat, Mar 28, 2009 at 7:53 AM, Duncan Murdoch murd...@stats.uwo.ca
wrote:
1) Where does the name 'xtfrm' come from?
I don't know.
Hmm. If the origins of the name are
A couple more thoughts. If you're using nlme::lme to fit the model
there is a 'contrasts' argument to lme which can be used to structure
the design matrix to produce tests of hypotheses of interest. Also,
when you pass an lme object to anova you can use the 'L' argument to
specify linear
Looking for the DCT function, but don't see it in the signal pkg.
http://rss.acs.unt.edu/Rdoc/library/signal/html/signal.package.html
http://rss.acs.unt.edu/Rdoc/library/signal/html/00Index.html
As I understand it, the 'signal' functions are ports of the corresponding
matlab/octave code, where
On 29/03/2009 2:14 PM, Stavros Macrakis wrote:
On Sun, Mar 29, 2009 at 6:15 AM, Duncan Murdoch murd...@stats.uwo.ca wrote:
On 28/03/2009 4:57 PM, Stavros Macrakis wrote:
On Sat, Mar 28, 2009 at 7:53 AM, Duncan Murdoch murd...@stats.uwo.ca
wrote:
1) Where does the name 'xtfrm' come from?
I
Dear R subscribers,
I may be too unexperienced and I spent a lot of time looking for the
possibilities of hypothesis testing using finite population correction
factor.
My question is: Is there a possibility to perform standard statistical
tests using finite population correction factor to avoid
I cannot find any R function or operator that performs a binary AND operation,
as performed by Fortran built-in function iand.
Ideally either R operator or should do that. But some tests proved
they do not:
A- 1
B - 2
A
[1] 1
B
[1] 2
as.numeric(AB)
[1] 1
as.numeric(AB)
[1] 1
The binary
This is very possibly not a question on R.
I was under the impression that the argument that gives rise to Fisher's
LSD method in ANOVA works in other situations with three-way comparisons
too, given that formal logic works the same (if the omnibus test rejects,
only two of the three groups may
You should find the functions:
bitAnd, bitOr and bitXor
in the bitops package.
Ciao,
domenico
mau...@alice.it wrote:
I cannot find any R function or operator that performs a binary AND operation, as
performed by Fortran built-in function iand.
Ideally either R operator or should do that.
-Original Message-
From: r-help-boun...@r-project.org
[mailto:r-help-boun...@r-project.org] On Behalf Of mau...@alice.it
Sent: Sunday, March 29, 2009 12:23 PM
To: r-help@r-project.org
Subject: [R] binary AND operators in R
I cannot find any R function or operator that performs a
Hi,
Does anyone know how to write a R function to solve the quantile c for the
following equation.
P(Z11.975, Z2c)+ P(Z1c, Z2c)=0.05/6.
Z1 and Z2 have a bivariate normal distribution with mean 0, variance 1 and
correlation 0.5.
Thanks a lot!
Hannah
[[alternative HTML version
mau...@alice.it wrote:
I cannot find any R function or operator that performs a binary AND
operation, as performed by Fortran built-in function iand.
Ideally either R operator or should do that. But some tests proved
they do not:
they do not, it seems clear from the documentation.
have a look at packages mnormt and mvtnorm.
Best,
Dimitris
li li wrote:
Hi,
Does anyone know how to write a R function to solve the quantile c for the
following equation.
P(Z11.975, Z2c)+ P(Z1c, Z2c)=0.05/6.
Z1 and Z2 have a bivariate normal distribution with mean 0, variance 1 and
mau...@alice.it wrote:
I cannot find any R function or operator that performs a binary AND operation, as
performed by Fortran built-in function iand.
Ideally either R operator or should do that. But some tests proved
they do not:
R doesn't have an operator like iand built in, but I
In lattice, using the command trellis.par.get for superpose.symbol, plot,
symbol and/or dot.symbol shows that we can specify alpha, cex, col, fill
(for superpose.symbol and plot.symbol), font, and pch. Trial and error
shows that the font affects letters but not pch=1 or pch=3 (open circles
and
Hi,
I created the barchart below using the lattice package, however I can't seem
to find a way to add another variable as a line (see the desired
square/lines that I drew for the last 10 years of the plot). Can anyone
help me with this? Your help is much appreciated!
Code:
I have an optimization question that I was hoping to get some suggestions on
how best to go about sovling it. I would think there is probably a package that
addresses this problem.
This is an ordering optimzation problem. Best to describe it with a simple
example. Say I have 100 bins each with
Thank you very much for your reply!
I know we can find the quantile c that satisfies P(Z1c, Z2c)=0.05/6 using
R function qmvnorm.
But the problem here is to find the quantile c that satisfies the equation
P(Z11.975, Z2c)+ P(Z1c, Z2c)=0.05/6. I think it is different from the
above
problem. I
Dear Colleagues
I have the following code that generates a boxplot for one specific labtest:
boxplot.n(LBSTRESN~COHORT, main=Boxplot of laboratory data for XLXXX-XXX
test=Creatinine,
subset = LBTEST==Creatinine,
xlab = Cohort Number,
ylab = Units = umol/L,
varwidth=TRUE
I would like to
rkevinburton wrote:
I have an optimization question that I was hoping to get some suggestions
on how best to go about sovling it. I would think there is probably a
package that addresses this problem.
This is an ordering optimzation problem. Best to describe it with a simple
example.
Duncan Murdoch-2 wrote:
On 29/03/2009 2:14 PM, Stavros Macrakis wrote:
On Sun, Mar 29, 2009 at 6:15 AM, Duncan Murdoch murd...@stats.uwo.ca
wrote:
On 28/03/2009 4:57 PM, Stavros Macrakis wrote:
On Sat, Mar 28, 2009 at 7:53 AM, Duncan Murdoch murd...@stats.uwo.ca
wrote:
1) Where does
Hi there,
I have a yearly data from 1990-2030. The tick marks only show every five
years. I want to add another tick mark at 2008 since data beyond that are
predicted. How can I just add one tick mark to the X axis? Thank you.
Best,
Jacky
You could use the paste() function to dynamically assign label values.
For instance, like this:
dat-data.frame(id=1:4,x=1:4,y=1:4)
par(mfrow=c(2,2))
for (i in dat$id){
boxplot(dat$x[dat$id==i],
dat$y[dat$id==i],
main=paste(Results for Subject,i) )
}
There might be a better
Oops, the example only accounts for 1 observation, so better do
something like this in that case:
..
for (i in unique(dat$id)){
..
On Mon, Mar 30, 2009 at 07:50, Coen van Hasselt
coenvanhass...@gmail.com wrote:
You could use the paste() function to dynamically assign label values.
For instance,
SOmething like this should do it for you:
x - seq(as.Date('1990-1-1'), as.Date('2030-1-1'), by='1 year')
plot(x,runif(length(x)))
axis(1, at=as.Date('2008-1-1'), label='2008', las=2)
On Sun, Mar 29, 2009 at 5:32 PM, Junjie Zhang thuja...@hotmail.com wrote:
Hi there,
I have a yearly data
Dear Prof Gray and everyone,
As our package developers discussed about incompatibility between Design and
survival packages, I faced another problem with cmprsk- a survival dependent
packacge.
The problem is exactly similar to what happened to the Design package that when
I just started
I am trying to install RMySQL on OpenSolaris and need to pass some options
to configure.
Tried the 3 recommended ways of doing it and nothing works, configure cannot
find the headers and the libs.
I ran configure manually and that worked fine
./configureCC=cc
Hi.
I am trying to do histograms in lattice, and I want to get both
counts and percents in the same plot. To try to be clearer ---
there are 3 levels to my factor; I'd like to get a 2 x 3 array
of plots where the top row consist of histograms by counts and
the bottom consists of (the
Modifying your example...
library(lattice)
set.seed(42)
XX - data.frame(y=runif(300,0,10),a=factor(sample(letters[1:3],300,
TRUE,c(0.5,0.3,0.2
XX - rbind(XX,XX)
XX$gps - rep(c(count,percent),each=300)
print(histogram(~y|a*gps,as.table=TRUE,data=XX,
Don't worry everyone, I've solved it. See the code below:
Schart-barchart(Catch~Year,data=SNA,
scales=list(col = black, tck = c(1, 0),x=list(rot=45)),
panel = function(x, ...) {
panel.barchart(x, ...)
Nguyen Dinh Nguyen wrote:
Dear Prof Gray and everyone,
As our package developers discussed about incompatibility between Design and
survival packages, I faced another problem with cmprsk- a survival dependent
packacge.
The problem is exactly similar to what happened to the Design package
That's leading to another question: How does rank() work?
If I have a character vector
a- c(2a, 2c, 3, 5 , 2b ,4a, 4b)
Then a[order(a)] returns
2a 2b 2c 3 4a 4b 5, which makes sense
But a[rank(a)] returns
2a 3 5 4b 2c 2b 4a, which does not seem to make sense.
Similarly, for a numeric
Thanks very much for your input.
On 30/03/2009, at 12:29 PM, Felix Andrews wrote:
Modifying your example...
library(lattice)
set.seed(42)
XX - data.frame(y=runif(300,0,10),a=factor(sample(letters[1:3],300,
TRUE,c(0.5,0.3,0.2
XX - rbind(XX,XX)
Dear R users:
I am having difficulty to place x-axis location alternatively
top/bottom side in Lattice plot, which is composed of seven-column as
following:
E1 E2 E3 E4 E5 E6 E7
Case1 -505.85 -75.32 494.52 -12.31 -98.96 50.34 -48.62
Case2
how to input multiple .txt files?
A data folder has lots of .txt files from different customers.
Want to read all these .txt files to different master files:
such as:
cust1.xx.txt, cust1.xxx.txt, cust1..txt,.. to master file:
X.txt
cust2.xx.txt, cust2.xxx.txt,
Here's a clue:
rank(a)
[1] 1 3 4 7 2 5 6
order(order(a))
[1] 1 3 4 7 2 5 6
W.
Bill Venables
http://www.cmis.csiro.au/bill.venables/
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Jun Shen
Sent: Monday, 30 March 2009 10:14
The usual approach is to count the co-occurence within so many words of each
other.
Typical is between 5 words before and 5 words after a given word.
So for each word in the document, you look for the occurence of all other
words
within -5 -4 -3 -2 -1 0 1 2 3 4 5 words. Depending on the
I am a new R user. Now I have some problem while I use R. I have set
up a data frame called mydata. One of the colume of it was skill.
Now I want to select the observations of the frame whose skill value
is 1,by what command can I get it?
__
I want to add a colume to a data frame by some rules, in stata the
command is gen or egen ,but what is it in R?
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
If speed is a consideration,availing yourself of the built-in pmax()
function via
do.call(pmax,data.frame(yourMatrix))
will be considerably faster for large matrices.
If you are puzzled by why this works, it is a useful exercise in R to figure
it out.
Hint:The man page for ?data.frame says:
How about you starting threads with something that suggest what you are
looking for:
Like adding collumns in stata (gen or egen).
On Sun, Mar 29, 2009 at 10:50 PM, minben minb...@gmail.com wrote:
I want to add a colume to a data frame by some rules, in stata the
command is gen or egen ,but
Suggestion of thread: Selecting rows from dataframe
subset(mydata, mydata$skill==1) may works.
Best wishes
milton
On Sun, Mar 29, 2009 at 10:27 PM, minben minb...@gmail.com wrote:
I am a new R user. Now I have some problem while I use R. I have set
up a data frame called mydata. One of
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of minben
Sent: Monday, 30 March 2009 12:28 PM
To: r-help@r-project.org
Subject: [R] A simple problem
I am a new R user.
Welcome. It would be polite to give us your name.
Now I
In fact
subset(mydata, skill == 1)
is all that you need, unless skill is a factor, when
subset(mydata, skill == 1)
does the trick.
More importantly, as a general rule, if you think you need to use '$' in
connexion with subset(), transform(), with() or within(), you are most likelyu
not
I tried the following:
m - matrix(runif(10),1000,100)
junk - gc()
print(system.time(for(i in 1:100) X1 - do.call(pmax,data.frame(m
junk - gc()
print(system.time(for(i in 1:100) X2 - apply(m,1,max)))
and got
user system elapsed
2.704 0.110 2.819
user system elapsed
1.938
Folks:
I do not wish to agree or disagree with the criticisms of either the speed
or possible design flaws of [. But let's at least see what the docs say
about the issues, using the simple example you provided:
m = matrix(1:9, 3, 3)
md = data.frame(m)
md[1]
# the first column
I would like to know which rows are duplicates of each other, not
simply that a row is duplicate of another row. In the following
example rows 1 and 3 are duplicates.
x - c(1,3,1)
y - c(2,4,2)
z - c(3,4,3)
data - data.frame(x,y,z)
x y z
1 1 2 3
2 3 4 4
3 1 2 3
I can't figure out how
If you sort the data then the duplicated entries will occur in consecutive
blocks:
m
x y z
1 1 2 3
2 3 4 4
3 1 2 3
m1 - m[do.call(order, m), ]
m1
x y z
1 1 2 3
3 1 2 3
2 3 4 4
duplicated(m1)
[1] FALSE TRUE FALSE
When you identify the blocks, the row names will tell you where they
I am using JRI (Java R Interface) library in order to call R from within my
Java application. But since the rmu1 and rmu2 ,see the following code,
are objects of type S4 once i run the application the value of Null will be
returned for both of them. On this regard, i would appreciate it if anyone
95 matches
Mail list logo