Hi all,
Within a foreach loop with doSNOW, we cant call functions which come from
the non-default package. We need to load(require/library) the package once
more within the foreach loop. Anyone knows why would happen like this? Is it
caused by the snow package and something happened when "snow" pa
Hi Guys
In order to look at a dense plot I would like to have the capability
to plot dynamic/interactive. Before I try rgobi which I heard can help
me; I would like to take your opinion.
Thanks!
-Abhi
__
R-help@r-project.org mailing list
https://stat.e
Hello,
I'm fairly new to R. I'm a chemist, not a programmer so please bear with me.
I have a large data.frame that I want to break down (subset) into smaller
data.frames for analysis. I would like to give the data.frames descriptive
names which I have stored in a character vector. My origina
Hi List,
I have a question to calculate probability using R.
There are 491 boxes and 142 balles. If the ball randomly put into the
box. How to calculate the probability of six or more there are in one
box?
I have try :
dbinom(6,142,1/491)
1-pbinom(6,142,1/491)
But I think I have some unclear
Hello all,
I am currently attempting to replicate data from a political science article
that utilized a Markov chain transition model to predict voter turnout
intention at time *t*; the data was separated into two different models
based on whether prior intent was to vote or not to vote. The deta
In terms of a reproducible example:
ProbeSet.ID.F ProbeSet.ID Feature.ID Gene.Symbol X0030V120810.4
X0143V120110.4 X0258V111710.4 X0283V111710.4 X0430V120710.4 X0472V111610.4
X0520V111610.4 X0546V113010.4 X0578V111810.4 X0624V111810.4
7896741_479302 7896741 479302 OR4F17
Dear R people
Could you please help with following
Trying to compare accuracy of tumor size evaluation by different
methods. So data looks like
id true metod1 method2 ...
1 22 2.5
2 1.5 2 2
3 22 2
etc.
Could you please give a hint how to deal with that.
Seems like
Hi all,
I'm trying to figure out the effective differences between BFGS and L-BFGS-B
are, besides the obvious that L-BFGS-B should be using a lot less memory,
and the user can provide box constraints.
1) Why would you ever want to use BFGS, if L-BFGS-B does the same thing but
use less memory?
2)
How can I dynamically use a variable as the name for another variable?
I realize this sounds cryptic, so an example is best:
#Start with an array of "codes"
codes <- c("a1", "b24", "q99")
#Each code has a corresponding matrix (could be vector)
a1 <- matrix(rnorm(100), nrow=10)
b24 <- matrix(rnor
Notice that
>mone-3
[1] -8.881784e-16
on my machine so, no, mone is actually less than 3, which truncates to 2.
This is an overcomplicated version of R FAQ 7.31, which is mentioned in the
posting guide referenced at the end of every R-help message.
--
On Thu, Feb 24, 2011 at 3:13 PM, Gabriel Bergin wrote:
> Hi,
>
> I have two time series; one of annual data and one of monthly data. How do I
> plot these on the same plot? I checked out ts.plot(), but it only allows for
> different starting times, not different frequencies.
>
Try this assuming s
Thanks for all the solutions!
On Thu, Feb 24, 2011 at 5:37 PM, Sarah Goslee wrote:
> What about:
>
> ifelse(is.na(x), y, x)
>
> as long as x and y are always the same where one is not NA.
>
> Sarah
>
> On Thu, Feb 24, 2011 at 7:53 PM, Andrew Anglemyer
> wrote:
> > Thanks! Unfortunately, in my
What about:
ifelse(is.na(x), y, x)
as long as x and y are always the same where one is not NA.
Sarah
On Thu, Feb 24, 2011 at 7:53 PM, Andrew Anglemyer
wrote:
> Thanks! Unfortunately, in my effort to simply the question, I didn't really
> adequately describe the problem. This solution is perf
Andrew -
I believe
character.data$z = ifelse(is.na(character.data$x),
character.data$y,character.data$x)
should do what you want.
- Phil Spector
Statistical Computing Facility
Thanks! Unfortunately, in my effort to simply the question, I didn't really
adequately describe the problem. This solution is perfect in the numeric
case I presented, but what about in the case of character classes! Let me
try again:
I have
>character.data
id xy
1
I think the easiest way is probably
data$z <- rowMeans(data[, c("x", "y")], na.rm=TRUE)
Best,
Ista
On Fri, Feb 25, 2011 at 12:12 AM, Andrew Anglemyer
wrote:
> I am trying to combine two columns in a data frame into one column. Some
> values in either column are missing, but not in the same row
I am trying to combine two columns in a data frame into one column. Some
values in either column are missing, but not in the same row for the two
different columns. Additionally, when both columns in a row contain data,
the data are identical. I want a new column with the identical data or the
d
I would suggest asking this question on r-sig-geo.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 2/18/11 10:44 AM, "Leonardo Monasterio"
wrote:
>Dear R-users,
>
>Is there any way of calculating the perimeter of a pol
Thanks a lot!
Regards,
Eduardo
On Thu, Feb 24, 2011 at 6:47 PM, David Winsemius wrote:
>
> On Feb 24, 2011, at 3:06 PM, Eduardo de Oliveira Horta wrote:
>
>> It seems the code I've sent had typos...
>>
>> Here's a corrected version:
>>
>> #
>> x <- sapply(1:10, f
On Feb 24, 2011, at 3:06 PM, Eduardo de Oliveira Horta wrote:
It seems the code I've sent had typos...
Here's a corrected version:
#
x <- sapply(1:10, function(i)rnorm(1000))
f <- sapply(1:10, function(i)density(x[,i], from=-5,to=5)$y)
grid <- density(x[,1], fr
On 2011-02-24 08:18, Andrea Storto wrote:
Dear all,
I am having troubles in using
fitdistr() from MASS package
to fit self-defined distributions.
I try to use it in this simple example
where I want to fit some data to
a Gaussian+Flat distribution:
gaussflat<-function(x,sd,k){
res<-x
I'm not a Windows user, but if win.graph is like other output device
calls, it would need a dev.off() to close it. When I do it with pdf()
and close with dev.off() I get ten pages, each with a density that is
consistent with what should be seen with rnorm() as input.
--
David.
On Feb 21,
On 02/24/2011 05:14 PM, Hadley Wickham wrote:
Note however that I've never seen evidence for a *practical*
difference in simple cases, and also of such cases as part of a
larger computation.
But I'm happy to see one if anyone has an interesting example.
E.g., I would typically never use 0L:100L
Exactly as Max said. See the rfcv() function in the latest version of
randomForest, as well as the reference in the help page for that function.
OOB estimate is as accurate as CV estimate _if_ you run straight RF. Most
other methods do not have this "feature". However, if you start adding ste
Try this:
reshape(x, direction = 'long', varying = list(c(2, 4), c(3, 5)), idvar =
'gene')
On Thu, Feb 24, 2011 at 3:19 PM, fbarreto wrote:
>
> Hi all,
>
> I have been struggling with this problem for a few days.
>
> I have a data table like this:
>
> gene rpkm1 diff1
Hi,
I have two time series; one of annual data and one of monthly data. How do I
plot these on the same plot? I checked out ts.plot(), but it only allows for
different starting times, not different frequencies.
Sincerely,
Gabriel Bergin
gabr...@bergin.se
[[alternative HTML version delete
It seems the code I've sent had typos...
Here's a corrected version:
#
x <- sapply(1:10, function(i)rnorm(1000))
f <- sapply(1:10, function(i)density(x[,i], from=-5,to=5)$y)
grid <- density(x[,1], from=-5,to=5)$x
win.graph()
persp(grid, 1:10, f,theta=-50, phi=30, d
Hello all,
I am re-posting my previous question with a simpler, more transparent,
commented code.
I have been ramming my head against this problem, and I wondered if
anyone could lend a hand. I want to make parallel a bootstrap of a
linear mixed model on my 8-core mac. Below is the process t
Thanks, Dimitri! It is really cool!
On Thu, Feb 24, 2011 at 11:43 AM, Dimitri Liakhovitski <
dimitri.liakhovit...@gmail.com> wrote:
> If your ack$ID variable is numeric, you could first turn it into a factor:
>
> myfactor = as.factor(ack$ID)
>
> And then use model.matrix to create dummy variables
Hi R-help,
I am using nnet package in R for neural networks for performing
classification and regression.Is there any command or set of commands in R
which would help to figure out the variable importance of the inputs in the
generated neural network.
Thanks in advance.
Regards,
Raji
--
View
Hi all,
I have been struggling with this problem for a few days.
I have a data table like this:
gene rpkm1 diff1 rpkm2 diff2
gene1 23 50 13 120
gene2 111 220 827 1200
gene3 7
Dear Prof Frank,
I tried to simulate an example data set as close as possible to my own real
data with the codes below. There are only two covariates, tumor(3 levels)
and ecog(3 levels). "rx" is treatment (4 levels). Validation with the
stratified model (by rx) had a negative R2.. and the R2 unde
One way to do Dirichlet triangulations is to map point (x,y) to point
(x,y,x^2+y^2) (I think, it's been a while) and then find the convex hull of
these points in 3 dimensions. You can do the Voronoi diagram of circles by
mapping (x,y,r) to (x,y,x^2+y^2-r^2) I would try assigning an r to each
If your ack$ID variable is numeric, you could first turn it into a factor:
myfactor = as.factor(ack$ID)
And then use model.matrix to create dummy variables:
mydummies = model.matrix(~myfactor)[, -1]
You'll get as many dummy variables as values you have in ack$ID -
minus 1 (for the reference lev
Thanks, David!
On Thu, Feb 24, 2011 at 11:30 AM, David Winsemius wrote:
>
> On Feb 24, 2011, at 1:23 PM, Changbin Du wrote:
>
> HI, Dear R community,
>>
>> I try to create 100 dummy variables like the following:
>>
>> ack$id_1 <- (ack$ID==1)*1
>> ack$id_2 <- (ack$ID==2)*1
>> ..
>> .
>> ack$id_100
On Feb 24, 2011, at 1:23 PM, Changbin Du wrote:
HI, Dear R community,
I try to create 100 dummy variables like the following:
ack$id_1 <- (ack$ID==1)*1
ack$id_2 <- (ack$ID==2)*1
..
.
ack$id_100 <- (ack$ID==100)*1
I used the following codes:
for(i in 1:100){
ack$id_[i] <- (ack$
Thanks to all, appreciated!
On Thu, Feb 24, 2011 at 11:18 AM, Jonathan P Daily wrote:
> See inline below.
> --
> Jonathan P. Daily
> Technician - USGS Leetown Science Center
> 11649 Leetown Road
> Kearneysville WV, 25430
> (304) 724-4480
> "Is the room still a
See inline below.
--
Jonathan P. Daily
Technician - USGS Leetown Science Center
11649 Leetown Road
Kearneysville WV, 25430
(304) 724-4480
"Is the room still a room when its empty? Does the room,
the thing itself have purpose? Or do we, what's the word... imbue i
On Feb 24, 2011, at 1:03 PM, Duke wrote:
Hi folks,
I am wondering if the following is possible: I want to control the
arguments sent to a function by string variables. For example,
instead of
> heatmap.2( A, col=greenred(75) )
I would want to have something like:
> heatmap.2 ( paste(A, "c
HI, Dear R community,
I try to create 100 dummy variables like the following:
ack$id_1 <- (ack$ID==1)*1
ack$id_2 <- (ack$ID==2)*1
..
.
ack$id_100 <- (ack$ID==100)*1
I used the following codes:
for(i in 1:100){
ack$id_[i] <- (ack$ID==i)*1
}
But only one colum
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Martin Maechler
> Sent: Thursday, February 24, 2011 7:45 AM
> To: Claudia Beleites
> Cc: r-help@r-project.org
> Subject: Re: [R] The L Word
>
> > "CB" == Claudia Beleites
>
On Thu, Feb 24, 2011 at 10:03 AM, Duke wrote:
> Hi folks,
>
> I am wondering if the following is possible: I want to control the arguments
> sent to a function by string variables. For example, instead of
>> heatmap.2( A, col=greenred(75) )
> I would want to have something like:
>> heatmap.2 ( pas
Look at ?quantile, especially the detail section on "type" and the second
reference (and the see also section). There are many different definitions of
quantiles/quartiles and different functions use different versions.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Heal
Hi folks,
I am wondering if the following is possible: I want to control the
arguments sent to a function by string variables. For example, instead of
> heatmap.2( A, col=greenred(75) )
I would want to have something like:
> heatmap.2 ( paste(A, "col=greenred(75)", sep=",") )
Is this possible
> "MM" == Martin Maechler
> on Thu, 24 Feb 2011 18:34:36 +0100 writes:
> "HW" == Hadley Wickham
> on Thu, 24 Feb 2011 10:14:35 -0600 writes:
>>> Note however that I've never seen evidence for a *practical*
>>> difference in simple cases, and also of such cases as
Let me first thank you all for the replies.
Actually I also tried the print() function, and indeed it did not
work. The function capture.output() Peter said did the job.
Thank you for sending the proposition for the new code to the maintainer.
Duarte
On Thu, Feb 24, 2011 at 4:51 PM, Martin Ma
You've fallen afoul of rounding error, FAQ 7.31 I believe,
> rnorm(3, 0, 1)
[1] -2.0903756 -0.9314351 0.1477768
but
> rnorm(mone, 0, 1)
[1] -0.8695359 -0.5429294
because mone is not actually three, but on my linux system a bit less.
> mone == 3
[1] FALSE
> mone < 3
[1] TRUE
You could try
>
Hi,
It's FAQ 7.31
Try this:
mone <- round(m-mzero)
HTH,
Ivan
Le 2/24/2011 18:31, li li a écrit :
Hi all.
I was having some trouble with a for loop and I found the problem is the
following.
Does anyone have some idea why I got the following R result? Since mone
is equal to 3, why
mu1 on
On 24/02/2011 9:59 AM, Jk Zheng wrote:
Hi,
I'm new to R, and found this code confusing. It is from the bioconductor
package "RpsiXML".
entryCount<- length(nodes)
The "nodes" object is either the argument nor generated in the function.
How can R find the "nodes" object? What am I missing h
> "HW" == Hadley Wickham
> on Thu, 24 Feb 2011 10:14:35 -0600 writes:
>> Note however that I've never seen evidence for a *practical*
>> difference in simple cases, and also of such cases as part of a
>> larger computation.
>> But I'm happy to see one if anyone has an
Hi all.
I was having some trouble with a for loop and I found the problem is the
following.
Does anyone have some idea why I got the following R result? Since mone
is equal to 3, why
mu1 only have 2 components?
library(MASS)
> p0 <- seq(0.1, 0.9,by=0.1)
> m <- 10
>
>
> p0 <- p0[7]
>
> ## da
options(error=utils::recover)
On Thu, Feb 24, 2011 at 12:06 PM, Yan Jiao wrote:
> Dear R user
>
>
>
> How to make the program stop at the spot where the error occurs? I mean
> inside the iterations,.
>
>
>
> Many thanks
>
>
>
> yan
>
>
> **
On Thu, Feb 24, 2011 at 6:06 PM, Yan Jiao wrote:
> Dear R user
>
>
>
> How to make the program stop at the spot where the error occurs? I mean
> inside the iterations,.
>
Check
?browser
?debug
Rainer
>
>
> Many thanks
>
>
>
> yan
>
>
> **
Dear R user
How to make the program stop at the spot where the error occurs? I mean
inside the iterations,.
Many thanks
yan
**
This email and any files transmitted with it are confide...{{dropped:10}}
__
My box plot below is drawing its upper whisker all the way to the last point,
instead of showing the point as an outlier. Am I misunderstanding, or is it a
bug?
Help(boxplot) states for the parameter “range” that “this determines how far
the plot whiskers extend out from the box. If range is po
You don't need to write functions to "source" files:
source("code1.R")
source("code2.R")
source("code3.R")
When you source a file with a bunch of function definitions, the definitions
are just assignment statements:
f <- function (x)...
g <- function (x,y,z) ...
Did you think you would break y
Hi,
I'm new to R, and found this code confusing. It is from the bioconductor
package "RpsiXML".
entryCount <- length(nodes)
The "nodes" object is either the argument nor generated in the function.
How can R find the "nodes" object? What am I missing here?
Thanks
Zheng Jk
parseXmlEntryNod
If you're in a hurry, it's way easier than that:
t <- c(1,2,3,7,8,9,11,12,13)
x <- rnorm(length(t))
new.t <- min(t):max(t)
new.x <- NULL
new.x[t-min(t)+1] <- x
plot(new.t, new.x, type='l')
This is wastes max(t)-min(t)-length(t)+1 vector entries, but presumably you
won't be wasting a lot of rea
Dear all,
I am having troubles in using
fitdistr() from MASS package
to fit self-defined distributions.
I try to use it in this simple example
where I want to fit some data to
a Gaussian+Flat distribution:
gaussflat<-function(x,sd,k){
res<-x
res[ abs(x) <= k ] <- dnorm(x[ abs(x) <= k
I want to predict a set of proportions from a linear regression using glm.
The model includes a logit link. However I want to extract the
variance:covariance matrix among the predicted proportions rather than
on the logit scale.
Is there a way to do this using Vcov or a similar package in R?
Dear R-users,
Does anyone know how to do weighted Voronoi diagrams (Dirichlet
tesselation) in R? To be more specific, I have a set of coordinates for
tree locations on a plot, and I'm looking for a way to do the
tesselation so that the polygon size for each tree depends on the size
of the sub
Deal all, as MCMClogit does not allow for the specification of several chains,
I have run my model 3 times with different random number seeds and differently
dispersed multivariate normal priors.
For example:
res1 = MCMClogit(y~x,b0=0,B0=0.001,data=mydat, burnin=500, mcmc=5500,
seed=1234, thin=5
> Note however that I've never seen evidence for a *practical*
> difference in simple cases, and also of such cases as part of a
> larger computation.
> But I'm happy to see one if anyone has an interesting example.
>
> E.g., I would typically never use 0L:100L instead of 0:100
> in an R script b
Thanks a lot, everyone!
Honestly - I just did not know one could source everything and not
just functions.
What you wrote is simple, but pretty eye-opening for me (and extremely helpful)!
Dimitri
On Thu, Feb 24, 2011 at 10:51 AM, wrote:
> You don't need to write functions to "source" files:
>
>
> "PE" == Peter Ehlers
> on Thu, 24 Feb 2011 07:07:29 -0800 writes:
PE> On 2011-02-24 06:32, David Winsemius wrote:
>>
>> On Feb 24, 2011, at 7:22 AM, Peter Ehlers wrote:
>>
>>> On 2011-02-24 03:26, Duarte Viana wrote:
Hello all,
This
> "CB" == Claudia Beleites
> on Thu, 24 Feb 2011 12:31:55 +0100 writes:
CB> On 02/24/2011 11:20 AM, Prof Brian Ripley wrote:
>> On Thu, 24 Feb 2011, Tal Galili wrote:
>>
>>> Thank you all for the answers.
>>>
>>> So if I may extend on the question -
>>> W
If you are just wanting to run them once, you can just do:
source("code1.r")
source("code2.r")
source("code3.r")
or place the file names in a vector, say 'filenames' and:
sapply(filenames, source)
If you want to use them multiple times, try:
run1 <- parse("code1.r")
run2 <- parse("code2.r")
ru
You say you are aware that you can source them from a common script, yet you
don't seem satisfied with that.
Perhaps you could be more specific about why that solution is not satisfactory?
One thing you said could indicate a misunderstanding... you do not have to wrap
the code in functions bef
On Feb 24, 2011, at 10:07 AM, Peter Ehlers wrote:
On 2011-02-24 06:32, David Winsemius wrote:
On Feb 24, 2011, at 7:22 AM, Peter Ehlers wrote:
On 2011-02-24 03:26, Duarte Viana wrote:
Hello all,
This shouldn't be difficult, but I am not able to extract a printed
value from a function and
Hello!
I am wondering if it's possible to run - in sequence - code that is
stored in several R scripts.
For example:
Script in the file "code1.r" contains the code:
a = 3; b = 5; c = a + b
Script in the file "code2.r" contains the code:
d = 10; e = d - c
Script in the file "code3.r" contains th
I don't think that third suggestion actually works:
> x <- print( twotPermutation(c(2,3,4),c(3,6,5),plotit=F) )
[1] 0.289
NULL
> x
NULL
twotPermutation returns the value of invisible() which is NULL:
x <- print(invisible())
x
This conflicts with the documented behaviour of twotPermutation which
On 2011-02-24 06:32, David Winsemius wrote:
On Feb 24, 2011, at 7:22 AM, Peter Ehlers wrote:
On 2011-02-24 03:26, Duarte Viana wrote:
Hello all,
This shouldn't be difficult, but I am not able to extract a printed
value from a function and assign it to an object.
In my case,
library(DAAG)
On Feb 24, 2011, at 7:21 AM, emj83 wrote:
Hi,
I would like to save the plots produced by boa into postscript files
in R.
I am struggling- can anyone advise?
?postscript
I see that Nabble omits the standard capitalized suggestion:
PLEASE do read the posting guide http://www.R-project.
Hi everybody,
I recently sent out a first message using this tool and was astonished about
the quick and helpful replys. So, thank you in advance for your help, I really
appreciate that!
As already recently mentioned I am new to using R as I have to implement some
decision trees with R respect
On Feb 24, 2011, at 7:22 AM, Peter Ehlers wrote:
On 2011-02-24 03:26, Duarte Viana wrote:
Hello all,
This shouldn't be difficult, but I am not able to extract a printed
value from a function and assign it to an object.
In my case,
library(DAAG)
twotPermutation(c(2,3,4),c(3,6,5),plotit=F)
Problem solved:
DF = data.frame(read.table(textConnection("A B C D E
1 1 a 1999 1 0
2 1 b 1999 0 1
3 1 c 1999 0 1
4 1 d 1999 1 0
5 2 c 2001 1 0
6 2 d 2001 0 1
7 3 a 2004 0 1
8 3 b 2004 0 1
9 3 d 2004 0 1
10 4 b 2001 1 0
11 4 c 2001 1
Hi all,
I wish to use rp.tkrplot from the rpanel package with subplots produced
by layout or split.screen. My problem is that I want to use a click
function, but I can't work out how to convert the x and y values it
produces into the values on the plots as unlike for a single plot they
don't
Dear R Help,
I'm using the sampleSelection library to run a heckman model. The default is
to use a probit model for the selection equation. I would like to know if it
is possible to use a clog-log for the selection equation either with the
sampleSelection library or in a different way. Is this pos
Hello,
I am training to use the changeLOS package. Using data provided in this
package
(los.data), I want to generate a new plot with overlaying 2 curves of
transition
probability P01 and P03 and also statistically compare the two curves like the
Kaplan-Meier Method.Can someone help me ?
Hi,
I would like to save the plots produced by boa into postscript files in R.
I am struggling- can anyone advise?
Thanks Emma
--
View this message in context:
http://r.789695.n4.nabble.com/boa-library-and-plots-tp3322508p3322508.html
Sent from the R help mailing list archive at Nabble.com.
Dear all: i have the following problem
I use gls, I have 10 repeated meassures.
The 10 by 10 matrix has different variances in the diagonal (i know how to
handle that)
The correlation matrix is blocked: the first 3 repeated meassures have the
same correlation,
the next 4 have the same correlat
Dear Shreyasee,
I had exactly the same error message. I converted the pdf-files into plain
textfiles and reran the command without any problems. I'm no expert but the
problem must be with the readability of the filetype.
Kind regards
Kutsal
--
View this message in context:
http://r.789695.n4.
On 24/02/2011 7:38 AM, Christos Delivorias wrote:
I'm trying to plot some temporal data that have some gaps in them. You
can see the plot here: http://www.tiikoni.com/tis/view/?id=da222e2.
The problem is that during the time gaps in the TS the line plot is
interpolated over the gap and I don't w
I'm trying to plot some temporal data that have some gaps in them. You
can see the plot here: http://www.tiikoni.com/tis/view/?id=da222e2.
The problem is that during the time gaps in the TS the line plot is
interpolated over the gap and I don't want it to. I've tried
interleaving the gaps with an
On 2011-02-24 03:26, Duarte Viana wrote:
Hello all,
This shouldn't be difficult, but I am not able to extract a printed
value from a function and assign it to an object.
In my case,
library(DAAG)
twotPermutation(c(2,3,4),c(3,6,5),plotit=F)
[1] 0.298
I would like to assign this result to an
Am Mittwoch, den 23.02.2011, 18:12 +0100 schrieb Juergen Rose:
> class.weights=Wts,
I have just seen, that me last code was not complete. I try it once
more:
> library(e1071)> data(Glass, package = "mlbench")
> index <- 1:nrow(Glass)
> testindex <- sample(index, trunc(length(index)/5))
> testset
On 2011-02-23 19:27, Ramya wrote:
Hi there,
b is my dataframe.
I have a dataframe. I am trying to get rid of the -INF values but didnt have
much luck
b[which(is.finite(b))]
I can get rid of it for a single column
b[,1][which(is.finite(b[,2]))] but not for all dataframe I used it inside of
a
This came up at least once before, with regard to where it is
documented:
http://r.789695.n4.nabble.com/Where-are-usages-like-quot-2L-quot-documented-tt831061.html
I haven't looked around much to see if the documentation has changed,
but in a quick look at ?integer I don't see the concept me
On 02/24/2011 11:20 AM, Prof Brian Ripley wrote:
On Thu, 24 Feb 2011, Tal Galili wrote:
Thank you all for the answers.
So if I may extend on the question -
When is it important to use 'Literal integer'?
Under what situations could not using it cause problems?
Is it a matter of efficiency or pr
Hello all,
This shouldn't be difficult, but I am not able to extract a printed
value from a function and assign it to an object.
In my case,
> library(DAAG)
> twotPermutation(c(2,3,4),c(3,6,5),plotit=F)
[1] 0.298
I would like to assign this result to an object.
Thanks,
Duarte
___
On 2011-02-23 19:06, Jie TANG wrote:
hi,R users,
Now I have some scatter figures, is there some method can plot equalprobable
error ellipse ?
It's not clear to me what you mean by 'error ellipse'
but perhaps dataEllipse() in the car package is useful.
Peter Ehlers
___
Or simply do :
position <- as.numeric(trend1 == trend2 )
position
2011/2/24 Dimitris Rizopoulos
> there are also vectorized logical operators; have a look at the help page
> ?'&', and try this:
>
>
> trend1 <- c(1,1,1,1,1,1,-1,-1,-1,-1,-1,-1)
> trend2 <- c(1,1,1,1,1,1,1,1,1,1,1,-1)
>
> position
Thanks all. This works..
On Thu, Feb 24, 2011 at 3:43 AM, Jim Lemon wrote:
> On 02/24/2011 08:37 PM, Dimitris Rizopoulos wrote:
>
>> there are also vectorized logical operators; have a look at the help
>> page ?'&', and try this:
>>
>> trend1 <- c(1,1,1,1,1,1,-1,-1,-1,-1,-1,-1)
>> trend2 <- c(1,
On Thu, 24 Feb 2011, Tal Galili wrote:
Thank you all for the answers.
So if I may extend on the question -
When is it important to use 'Literal integer'?
Under what situations could not using it cause problems?
Is it a matter of efficiency or precision or both?
Efficiency: it avoids unnecessa
On 02/24/2011 08:43 PM, Jim Lemon wrote:
Oops, forgot about the zero!
trunc((trend1 * trend2 + 1)/2)
Jim
__
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/posti
On 02/24/2011 08:37 PM, Dimitris Rizopoulos wrote:
there are also vectorized logical operators; have a look at the help
page ?'&', and try this:
trend1 <- c(1,1,1,1,1,1,-1,-1,-1,-1,-1,-1)
trend2 <- c(1,1,1,1,1,1,1,1,1,1,1,-1)
position <- as.numeric((trend1 == 1 & trend2 == 1) | (trend1 == -1 &
Hi,
I think you want ifelse().
Assuming that length(trend2)=12 and not 14 as in the data you provided,
that should work:
position <- ifelse((trend1==1 & trend2==1)|(trend1==-1 &
trend2==-1),1,0) #btw, note the single "&" and single "|", not double
HTH,
Ivan
Le 2/24/2011 09:41, Kushan Thak
there are also vectorized logical operators; have a look at the help
page ?'&', and try this:
trend1 <- c(1,1,1,1,1,1,-1,-1,-1,-1,-1,-1)
trend2 <- c(1,1,1,1,1,1,1,1,1,1,1,-1)
position <- as.numeric((trend1 == 1 & trend2 == 1) | (trend1 == -1 &
trend2 == -1))
position
I hope it helps.
Best,
Thank you all for the answers.
So if I may extend on the question -
When is it important to use 'Literal integer'?
Under what situations could not using it cause problems?
Is it a matter of efficiency or precision or both?
Thanks,
Tal
Contact
Details:--
I have two vectors: both have possible values of 1,-1, or 0
trend1 <- c(1,1,1,1,1,1,-1,-1,-1,-1,-1,-1)
trend2 <- c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,)
i want to create a third vector that is conditional upon these two vectors:
if (trend2 == 1 && trend1 == 1) {position <- 1}
elseif (trend2 == -1 && tre
100 matches
Mail list logo