Hello everyone
I am using nested resampling in caret (5-fold outer and bootstrap inner
resampling) and by default, it shows the "Accuracy" metric. How can I use
it for the ROC/AUC metric?
My code is:
d=readARFF("apns.arff")
index <- createDataPartition(d$isKilled , p = .70,list = FALSE)
tr <-
On Tue, 16 Nov 2021 09:45:34 +0100
Luigi Marongiu wrote:
> contour(df$X, df$Y, df$Z)
contour() works on matrices (sometimes called "wide format" data). Z
must be a numeric matrix, X must be a numeric vector with length(X) ==
nrow(Z), and Y must be a numeric vector with length(Y) == ncol(Z).
On 16/11/2021 3:45 a.m., Luigi Marongiu wrote:
Hello,
I have a dataframe with 3 values and that I would like to plot with contour:
```
head(df)
Y X Z
1 0.0008094667 50 1
2 0.0012360955 50 1
3 0.0016627243 50 1
4 0.0020893531 50 1
5
Hello,
I have a dataframe with 3 values and that I would like to plot with contour:
```
> head(df)
Y X Z
1 0.0008094667 50 1
2 0.0012360955 50 1
3 0.0016627243 50 1
4 0.0020893531 50 1
5 0.0025159819 50 1
6 0.0029426108 50 1
>
Dear Ravi,
I have uploaded on GitHub a version which handles also constant values
instead of functions.
Regarding named arguments: this is actually handled automatically as well:
eval.by.formula((x > 5 & x %% 2) ~ (x <= 5) ~ ., FUN, y=2, x)
# [1] 1 4 9 16 25 6 14 8 18 10
Dear Ravi,
I wrote a small replacement for ifelse() which avoids such unnecessary
evaluations (it bothered me a few times as well - so I decided to try a
small replacement).
### Example:
x = 1:10
FUN = list();
FUN[[1]] = function(x, y) x*y;
FUN[[2]] = function(x, y) x^2;
FUN[[3]] =
yes; tmp[!test] <- no[!test]; tmp)
, possibly extended to handle missing values in 'test'.
Best,
-Deepayan
> Thanks & Best regards,
> Ravi
>
> From: John Fox
> Sent: Thursday, October 7, 2021 2:00 PM
> To: Ravi Varadhan
> Cc:
his behavior.
>
>Thanks & Best regards,
>Ravi
>
>From: John Fox
>Sent: Thursday, October 7, 2021 2:00 PM
>To: Ravi Varadhan
>Cc: R-Help
>Subject: Re: [R] How to use ifelse without invoking warnings
>
>
> External Email
i Varadhan via
R-help
Sent: Friday, October 8, 2021 8:22 AMiu
To: John Fox l
Cc: R-Help
Subject: Re: [R] How to use ifelse without invoking warnings
Thank you to Bert, Sarah, and John. I did consider suppressing warnings, but
I felt that there must be a more principled approach. While John's so
Ravi
From: John Fox
Sent: Thursday, October 7, 2021 2:00 PM
To: Ravi Varadhan
Cc: R-Help
Subject: Re: [R] How to use ifelse without invoking warnings
External Email - Use Caution
Dear Ravi,
It's already been suggested that you could disable warnings, but th
arguments.
Best,
John
Thanks & Best regards,
Ravi
*From:* John Fox
*Sent:* Thursday, October 7, 2021 2:00 PM
*To:* Ravi Varadhan
*Cc:* R-Help
*Subject:* Re: [R] How to use ifelse without invoking warn
Dear Ravi,
It's already been suggested that you could disable warnings, but that's
risky in case there's a warning that you didn't anticipate. Here's a
different approach:
> kk <- k[k >= -1 & k <= n]
> ans <- numeric(length(k))
> ans[k > n] <- 1
> ans[k >= -1 & k <= n] <- pbeta(p, kk + 1, n
Bert's approach is much less risky!
On Thu, Oct 7, 2021 at 1:37 PM Bert Gunter wrote:
>
> ?suppressWarnings
>
> > p <- .05
> > k <- c(-1.2,-0.5, 1.5, 10.4)
> > n <- 10
> >
> > ans <- ifelse (k >= -1 & k <= n, pbeta(p,k+1,n-k,lower.tail=FALSE),
> ifelse (k < -1, 0, 1) )
> Warning message:
> In
If you are positive the warnings don't matter for your application,
you can disable them: see ?options for details of warn.
But that can be dangerous, so be careful!
Sarah
On Thu, Oct 7, 2021 at 1:21 PM Ravi Varadhan via R-help
wrote:
>
> Hi,
> I would like to execute the following vectorized
?suppressWarnings
> p <- .05
> k <- c(-1.2,-0.5, 1.5, 10.4)
> n <- 10
>
> ans <- ifelse (k >= -1 & k <= n, pbeta(p,k+1,n-k,lower.tail=FALSE),
ifelse (k < -1, 0, 1) )
Warning message:
In pbeta(p, k + 1, n - k, lower.tail = FALSE) : NaNs produced
>
> suppressWarnings(ans <- ifelse (k >= -1 & k <=
Hi,
I would like to execute the following vectorized calculation:
ans <- ifelse (k >= -1 & k <= n, pbeta(p, k+1, n-k, lower.tail = FALSE),
ifelse (k < -1, 0, 1) )
For example:
> k <- c(-1.2,-0.5, 1.5, 10.4)
> n <- 10
> ans <- ifelse (k >= -1 & k <= n, pbeta(p,k+1,n-k,lower.tail=FALSE),
Whether you use RStudio is up to you... the heavy lifting would be done by R
anyway.
I am not a STT person, but TensorFlow was recently released on CRAN [1] so
there may be more opportunities for R users to make headway in this area.
[1] https://tensorflow.rstudio.com/installation/
On October
Have you checked here:
https://cran.r-project.org/web/views/NaturalLanguageProcessing.html
Speech to text is a very complex, specialized task requiring, I would
expect, a lot of IP. It would not surprise
me if you have to resort to big time, specialized software products with or
without R.
I am also interested in this.
Maybe a start:
https://voice.mozilla.org/
-Original Message-
To: r-help@r-project.org
Subject: *SPAM* [R] How to use R for Speech to text conversion
Hi
Iam a newbie to NLP and I would like to get some directions on how to
convert speech
Hi
Iam a newbie to NLP and I would like to get some directions on how to
convert speech file to text
Google search leads me to using GoogleLanguageR Package and API's but these
need payments to be made for Google.
Can someone suggest ways in which I can do the speech to text conversion in
R
The basic problem is that holling() is not a (negative) loglikelihood function.
nll() _is_ a negative loglikelihood, but it is not clear for what. You appear
to be very confused as to what a likelihood even is (what is k? apparently your
response variable? Then how can it be a scalar if X is a
Addendum:
the optimization actually got a worse outcome than the original
eyeball estimation:
```
actual <- c(8, 24, 39, 63, 89, 115, 153, 196, 242, 287,
344, 408, 473,
546, 619, 705, 794, 891, 999, 1096, 1242, 1363,
1506, 1648, 1753,
1851,
No, I got the same. I reckon the problem is with X: this was I scalar,
I was providing a vector with the actual values.
Ho can mle2 optimize without knowing what are the actual data? and
what values should I give for X?
Thank you
On Tue, Jun 30, 2020 at 2:06 PM Eric Berger wrote:
>
> I have no
I have no problem with the following code:
library(bbmle)
holling <- function( a, b, x ) {
a*x^2 / (b^2 + x^2)
}
A=3261
B=10
X=30
foo <- mle2( minuslogl=holling, start=list(a=A,b=B,x=X) )
foo
# Call:
# mle2(minuslogl = holling, start = list(a = A, b = B, x = X))
# Coefficients:
#a
Sorry for the typo, but I have the same error if using b instead of h:
```
> O = mle2(minuslogl = holling, start = list(a = A, b = B))
> Error in minuslogl(a = 3261, b = 10) :
argument "x" is missing, with no default
# let's add x
X = c(8, 24, 39, 63, 89, 115, 153, 196, 242, 287,
Hi Luigi,
I took a quick look.
First error:
You wrote
O = mle2(minuslogl = holling, start = list(a = A, h = B, x = X))
it should be b=B (h is not an argument of holling())
The error message gave very precise information!
Second error:
You wrote
O = mle2(minuslogl = nll, start = list(a = A, h =
Hello,
I would like to optimize the function:
```
holling = function(a, b, x) {
y = (a * x^2) / (b^2 + x^2)
return(y)
}
```
I am trying to use the function mle2 from bbmle, but how do I need to
feed the data?
If I give `holling` as function to be optimized, passing the starting
values for `a`,
Hello,
I have an alignment made with the package MSA. I installed latex on my
ubuntu machine with
`sudo apt-get install texlive-full` but I could not find the package
texshade that is mentioned in the MSA's manual.
When I run msaPrettyPrint I get:
```
Multiple alignment written to temporary file
Because the dates might not be consecutive. Or in ISO format.
On May 22, 2020 7:38:17 PM PDT, Jim Lemon wrote:
>So what if you treat a nuisance as a feature and import your dates as
>factors? as.numeric(dates) would have the correct structure or am I,
>as usual, missing something?
>
>Jim
>
>On
So what if you treat a nuisance as a feature and import your dates as
factors? as.numeric(dates) would have the correct structure or am I,
as usual, missing something?
Jim
On Sat, May 23, 2020 at 1:00 AM Jeff Newmiller wrote:
>
> This is getting off-topic here but R0 is a mathematical parameter
This is getting off-topic here but R0 is a mathematical parameter unrelated to
calendar dates. It arises when analyzing case counts (integers) as a function
of the numerical measure of time since some non-trivial number of cases has
occurred (conventionally this measure is in days)..
dta$days
Hi,
you should be able to convert your date variables to integers (usually
viewed as the elapse between 1970/01/01 and today) by using date
conversion to integers:
TODAY="2020-05-22"
as.Date(TODAY)
[1] "2020-05-22"
> as.integer(as.Date(TODAY))
[1] 18404
Doing the same with your reference dates
class(length(x1))
"integer"
Your problem is thinking that begin=1 means you are passing begin as
an integer.
class(1)
"numeric"
class(1L)
"integer"
You should pass: begin=1L, end=length(x1)
Best,
Eric
On Fri, May 22, 2020 at 3:31 PM Luigi Marongiu wrote:
>
> In theory, it works
> ```
> > R0
In theory, it works
```
> R0 = estimate.R(x1, t=d1, GT=mGT, begin=1, end=117,
methods="EG",pop.size=pop, nsim=N)
>R0
Reproduction number estimate using Exponential Growth method.
R : 0.7425278[ 0.7409297 , 0.7441229 ]
```
but I am not happy because 1. I have to use numbers
Hi Luigi,
I am not familiar with the R0 package but I took a quick look.
The example in the documentation sets begin and end to integers.
Try setting begin = 1, end = 121 and see if that works.
HTH,
Eric
On Fri, May 22, 2020 at 1:17 PM Luigi Marongiu wrote:
>
> Hello,
> I am trying ot get the
Hello,
I am trying ot get the R0 from the incidence data from China for the
COVID-19. I set the following:
```
library("R0")
x1 <- c(259, 457, 688, 769, 1771, 1459, 1737, 1981, 2099, 2589,
2825, 3235, 3884, 3694, 3143,
3385, 2652, 2973, 2467, 2015, 14108, 5090, 2641,
R0 = estimate.R(germany_vect, mGT, begin=germany_vect[1],
end=germany_vect[length(germany_vect)], methods="EG", pop.size=pop_de,
nsim=100)
Error in begin.nb:end.nb : argument of length 0
germany_vect[1]
1
184
germany_vect[length(germany_vect)]
57
488
```
What might be the problem
Dear all,
I have been trying to use the package R0
https://www.rdocumentation.org/packages/R0/versions/1.2-6/topics/estimate.R but
the manual is not so rich of words.
The example given is based on the named vector Germany.1918
```
> library("R0")
> data(Germany.1918)
> Germany.1918
1918-09-29
Hello there,
Yes, I'd tried scale as well. I mean, I could do my preprocessing
separately and it was working fine.
I was just wondering how preProcess argument in train function works. As
far as I know, when preProcess argument is set, it normalizes inputs but
not outputs.
Then I've figured we
Hello,
Have you tried alternative methods of pre-processing your data, such
as simply calling scale()? What is the effect on convergence, for both
the caret package and and the neuralnet package? There's an example
using scale() with the neuralnet package at the link below:
Hello there,
I am using caret and neuralnet to train a neural network to predict times
table. I am using 'backprop' algorithm for neuralnet to experiment and
learn.
Before using caret, I've trained a neuralnet without using caret, I've
normalized my input & outputs using preProcess with 'range'
No loops necessary. Use array indexing (see ?"[", of course -- the section
on matrices and arrays)
set.seed(123)
A <- matrix(sample(1:10), nrow = 5)
B <- matrix(c(sample(1:5), sample(1:5)), nrow =5, byrow = FALSE)
## The following could be a 1-liner, but I broke it out for clarity.
ix <-
Hi Jinsong,
In such a case I think explicit loop IS the most elegant solution.
for(i in 1:2) A[,i] <- A[,i][B[,i]]
Linus
On Fri, 11 Oct 2019 at 11:44, Jinsong Zhao wrote:
>
> Hi there,
>
> I have two matrices, A and B. The columns of B is the index of the
> corresponding columns of A. I hope
A matrix can be subset by another 2-column matrix, where the first column is
the row index and the second column the column index. So
idx = matrix(c(B, col(B)), ncol = 2)
A[] <- A[idx]
Martin Morgan
On 10/11/19, 6:31 AM, "R-help on behalf of Eric Berger"
wrote:
Here is one way
A <-
Here is one way
A <- sapply(1:ncol(A), function(i) {A[,i][B[,i]]})
On Fri, Oct 11, 2019 at 12:44 PM Jinsong Zhao wrote:
> Hi there,
>
> I have two matrices, A and B. The columns of B is the index of the
> corresponding columns of A. I hope to rearrange of A by B. A minimal
> example is
Hi there,
I have two matrices, A and B. The columns of B is the index of the
corresponding columns of A. I hope to rearrange of A by B. A minimal
example is following:
> set.seed(123)
> A <- matrix(sample(1:10), nrow = 5)
> B <- matrix(c(sample(1:5), sample(1:5)), nrow =5, byrow = FALSE)
> A
Solution:
https://github.com/grst/rstudio-server-conda
It works.
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting
> When I had breaks = 18, I get total number of cells as 16, which is
> same when I put breaks = 20
>
> In the 2nd case I was expecting total number of cells (i.e. bars) as
> 20 i.e. if I understand the documentation correctly I should expect
> total number of cells (bars) should be same as breaks
Hi Cristofer,
If you just ask for a number of breaks, you will get what "hist"
thinks you should. Try this or something similar:
hist(x,breaks=seq(min(x),max(x),length.out=21))
Jim
On Wed, Sep 18, 2019 at 8:55 PM Christofer Bogaso
wrote:
>
> Hi,
>
> I have a numerical vector as below
>
> x =
Hi,
I have a numerical vector as below
x = c(92958.2014593977, -379826.025677203, 881937.411562002, 25761.5278163719,
-11837.158273897, 48450.8089746788, -415505.62910869, -168462.98512054,
328504.255373387, -298966.051027528, 237133.794811816, -49610.1148173768,
-92459.1170329526,
You may get a response here (including my poorly-informed one) but this is off
topic (_do read the Posting Guide_) so you are basically barking into the
darkness here. You should be asking in the RStudio community forum.
As far as I am aware you have to run your RSS in a single environment, so
Dear R-help Mailing List:
For reproducibility, I want to use Conda + R (IRkernel), which will allow
me to have within the same machine different "environments", with different
versions of R installed, and specific package versions:
> On 20 Sep 2017, at 11:14, niharika singhal
> wrote:
>
> Hello,
>
> I have initial parameters for HMM model and I want to use depmixS4 package.
> The parameters are in the form
>
> intial_prob_matrix=matrix(c(0.07614213, 0.45177665, 0.47208122), nrow=1,
>
Hello,
I have initial parameters for HMM model and I want to use depmixS4 package.
The parameters are in the form
intial_prob_matrix=matrix(c(0.07614213, 0.45177665, 0.47208122), nrow=1,
ncol=3, byrow = TRUE)
transition_matrix=matrix(c(0.4667,0.4667,0.0667,
On 01/09/2017 7:37 PM, Yingrui Liu wrote:
Dear Sir/Madam,
How to use getSymbols() to get annual data? For example, I need the annual
stock price of APPLE from the year 2000 to 2016. How to write the command? I
only know how to get the daily data. It is:
Reading ?getSymbols, why do think you can get yearly data if the src --
"yahoo" by default -- only contains daily data? And if you can get the
daily data, why can't you just pick a day from each year to make it yearly?
Note: I'm not a quantmod user, so apologies if I just don't get it.
Cheers,
I suppose that might depend what you mean by "annual data".
?yearlyReturn
or
###
library(quantmod)
#> Loading required package: xts
#> Loading required package: zoo
#>
#> Attaching package: 'zoo'
#> The following objects are masked from 'package:base':
#>
#> as.Date, as.Date.numeric
#>
Dear Sir/Madam,
How to use getSymbols() to get annual data? For example, I need the annual
stock price of APPLE from the year 2000 to 2016. How to write the command? I
only know how to get the daily data. It is:
getSymbols("AAPL",from="2000-01-01",to="2016-12-31")
Thank you very much.
I was using OS X native R editor. I would imagine that editor is as simple and
native as it gets. But, if it's truly native, why would Gmail think of my code
chunk so differently.
I'm just throwing it out there! I can always remove format in Gmail after
pasting as a precaution. :)
On Fri,
I am pretty sure it is not RStudio that is converting it to html... it is
Gmail... but many email programs seem to do this these days so that people can
send Wingdings symbols to their lolz pals, with no thought of the damage done
to computer code examples.
--
Sent from my phone. Please
Thanks for letting me know. That line does look familiar.
It's interesting how I simply copy and paste from R editor can result in
HTML format.
On Fri, Feb 24, 2017 at 9:16 PM, Jeff Newmiller
wrote:
> There is a little button near the bottom of the Gmail editing box
There is a little button near the bottom of the Gmail editing box that switches
to plain text. We can immediately tell because of the
[[alternative HTML version deleted]]
line when we receive it, and sometimes it loses all of the line breaks or has
extra asterisks mixed in. You can look in the
I suppose for loop will suffice.
I simply copy & paste the code from R editor. From my email, it looks
plain. Is there a way to tell?
On Fri, Feb 24, 2017 at 8:50 PM, Jeff Newmiller
wrote:
> The apply function is one of many alienate ways to write a loop. It is not
>
The apply function is one of many alienate ways to write a loop. It is not
appreciably more efficient in cpu time than a for loop.
Your example creates the numbers in the loop... does your actual data get
created in a loop? If so then your original code should be perfectly
serviceable. If not
In theory, I am generating from group 5 groups of random numbers, each
group has 3 samples.
Isn't apply() the replacement of loops?
On Fri, Feb 24, 2017 at 8:23 PM, Jeff Newmiller
wrote:
> What is wrong with
>
> dat <- matrix(rnorm(15), nrow=5, ncol = 3)
>
> ?
>
> And
What is wrong with
dat <- matrix(rnorm(15), nrow=5, ncol = 3)
?
And what is this "no loop drama" you refer to? I use loops frequently to loop
around large memory gobbling chunks of code.
--
Sent from my phone. Please excuse my brevity.
On February 24, 2017 5:02:46 PM PST, C W
Dear R,
I wanted to simulate a 5 by 3 matrix which fills up by either rows or
columns?
I started with the following filling the matrix by rows,
dat <- matrix(NA, nrow=5, ncol = 3)
for(i in 1:5){
dat[i, ] <- rnorm(3)
}
But, R is known for no loop drama. Any suggestions?
Thanks!
eans(x, na.rm = na.rm). If either is NA, no reordering will be done for the
corresponding side.
Cheers
Petr
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Fix Ace via
> R-help
> Sent: Monday, November 21, 2016 9:14 PM
> To: r-help@r-p
Hello, there,
R document for heatmap says that Rowv could be a vector of values to specify
the row order. However, I couldn't figure out how to apply it. A simple example
here:> b=as.data.frame(matrix(c(3,4,5,8,9,10,13,14,15,27,19,20),3,4))
> b
V1 V2 V3 V4
1 3 8 13 27
2 4 9 14 19
3 5 10
Hello, there,
R document for heatmap says that Rowv could be a vector of values to specify
the row order. However, I couldn't figure out how to apply it. A simple example
here:> b=as.data.frame(matrix(c(3,4,5,8,9,10,13,14,15,27,19,20),3,4))
> b
V1 V2 V3 V4
1 3 8 13 27
2 4 9 14 19
3 5 10
hello all r users,
somebody has a example how to use fontchooser widget?
I haven't success in my try :-(
Thanks
Cleber
> library( tcltk ) # in R-devel,
> tclVersion()
[1] "8.6.4"
> tclvalue( tcl('tk::fontchooser', 'show', command='' ) )
Error in (function (name, pos = -1L, envir =
om: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Richard M.
Heiberger
Sent: Thursday, October 20, 2016 8:05 AM
To: mviljamaa
Cc: r-help
Subject: Re: [R] How to use predict() so that one retains the rows that they're
associated with?
I believe you have missing values and therefore you n
I believe you have missing values and therefore you need to use
the argument
glm(formula, data, na.action=na.exclude, ...)
?na.exclude
The relevant line is
when 'na.exclude' is used the residuals and
predictions are padded to the correct length by inserting 'NA's
for cases
ject.org] On Behalf Of mviljamaa
> Sent: Thursday, October 20, 2016 1:40 PM
> To: r-help@r-project.org
> Subject: [R] How to use predict() so that one retains the rows that they're
> associated with?
>
> I'm using predict() for my glm() logistic model, but I'm having trouble
> rel
Some more context would help here but here goes anyway.
You should have a vector of predictions with length equal to the number
of rows in your original data-set so you can just use cbind. If that is
not true check the documentation for the correct setting of na.action.
If you used newdata =
I'm using predict() for my glm() logistic model, but I'm having trouble
relating the predicted results to the rows that produced them.
I want to be able to plot predictions along some categorical variables.
So what can I do in order to get predicted values but also know what
variable values
> On Oct 6, 2016, at 7:07 AM, abhishek pandey
> wrote:
>
> Sent from RediffmailNG on Android
>
> From: abhishek pandeyabhishekpandey_1...@rediffmail.com
> Sent:Thu, 06 Oct 2016 13:24:39 +0530
> To: r-help-ow...@r-project.org
> Subject: how to use 97.5%,2.5%
Hello, guys!
I tried to do that:
> teste = fuzzy_partition( varnames = c( "a", "b" ), FUN = fuzzy_trapezoid,
> corners = c( 0, 1, 2, 3), corners = c(4, 5, 6, 7))
Error in FUN(i, ...) :
argumento formal "corners" corresponde a múltiplos argumentos especificados
So, how can I use
Dear all,
I am trying to run the seas() function. In doing so, I need an object of class
"ts". I tried to generate an ts object using the ts() function but it does not
work.
Does anyone have an idea how to generate an ts object. In addition, I get the
error that there are too many observations
Please try to read my earlier comments.
In the absence of a proper example with expected output I think what you
are trying to achieve is:
# create a sample dataframe
df <- data.frame(Command=c("_localize_PD", "_localize_tre_t2",
"_abdomen_t1_seq", "knee_pd_t1_localize", "pd_local_abdomen_t2"))
On Mon, May 2, 2016 at 1:01 PM, ch.elahe via R-help
wrote:
> I just changed all the names in Command to lowercase, then this
> str_extract works fine for "pd" and "t2", but not for "PDT2". Do you have
> any idea how I can bring PDT2 also in str_extract?
>
Looking at
I just changed all the names in Command to lowercase, then this str_extract
works fine for "pd" and "t2", but not for "PDT2". Do you have any idea how I
can bring PDT2 also in str_extract?
On Monday, May 2, 2016 9:16 AM, Tom Wright wrote:
The first thing I notice here
The first thing I notice here is that your first two subset statements are
searching in an object named Command, not the column df$Command. I'm not at
all sure what you are trying to achieve with the str_extract process but it
is looking for the exact string 'PDT2' the vectors / dataframe formed
Yes it works, but let me explain what I am going to do. I extract all the names
I want and then create a new column out of them for my plot. This is he whole
thing I do:
PD=subset(df,grepl("pd",Command)) //extract names in Command with only "pd"
t2=subset(df,grepl("t2",Command)) //extract
Sorry for the missed braces earlier. I was typing on a phone, not the best
place to conjugate regular expressions.
Using the example you provided:
> df=data.frame(Command=c("_localize_PD", "_localize_tre_t2",
"_abdomen_t1_seq", "knee_pd_t1_localize", "pd_local_abdomen_t2"))
>
Thanks Peter, you were right, the exact grepl is
grepl("(.*t2.*pd.*)|(.*pd.*t2.*)",df$Command), but it does not change anything
in Command, when I check the size of it by
sum(grepl("(.*t2.*pd.*)|(.*pd.*t2.*)",df$Command)) the result is 0, but I am
sure that the size is not 0. It seems that
On 02 May 2016, at 12:43 , ch.elahe via R-help wrote:
> Thanks for your reply tom. After using
> Subset(df,grepl("(.*t2.*pd.*)|(.*pd.*t2.*)"),df$Command) I get this error:
> Argument "x" is missing, with no default. Actually I don't know how to fix
> this. Do you have
Thanks for your reply tom. After using
Subset(df,grepl("(.*t2.*pd.*)|(.*pd.*t2.*)"),df$Command) I get this error:
Argument "x" is missing, with no default. Actually I don't know how to fix
this. Do you have any idea?
Thanks,
Elahe
On Saturday, April 30, 2016 7:35 PM, Tom Wright
Actually not sure my previous answer does what you wanted. Using your
approach:
t2pd=subset(df,grepl("t2",df$Command) & grepl("pd",df$Command))
Should work.
I think the regex pattern you are looking for is:
Subset(df,grepl("(.* t2.*pd.* )|(.* pd.* t2.*)",df$Command)
On Sat, Apr 30, 2016,
subset(df,grepl("t2|pd",x$Command))
On Sat, Apr 30, 2016 at 2:38 PM, ch.elahe via R-help
wrote:
> Hi all,
>
> I have one factor variable in my df and I want to extract the names from
> it which contain both "t2" and "pd":
>
> 'data.frame': 36919 obs. of 162 variables
>
Your code looks fine to me. What did t2pd look like?
I tried reproducing the problem in R-3.2.4(Revised) and everything worked
(although the output of str() looked a bit different - perhaps you have an
old version of R)
> df <- data.frame(TE=1:10, TR=101:110,
Hi all,
I have one factor variable in my df and I want to extract the names from it
which contain both "t2" and "pd":
'data.frame': 36919 obs. of 162 variables
$TE:int 38,41,11,52,48,75,.
$TR:int 100,210,548,546,.
$Command :factor
>
> > From: ruipbarra...@sapo.pt <ruipbarra...@sapo.pt>
> > Sent: Monday, March 21, 2016 11:50 AM
> > To: Stephen HK WONG
> > Cc: r-help@r-project.org
> > Subject: Re: [R] how to use vectorization instead of for loop
&g
rom: ruipbarra...@sapo.pt <ruipbarra...@sapo.pt>
> Sent: Monday, March 21, 2016 11:50 AM
> To: Stephen HK WONG
> Cc: r-help@r-project.org
> Subject: Re: [R] how to use vectorization instead of for loop
>
> Hello,
>
> I've renamed your dataframe to 'dat'. Since ?ifelse i
ifelse ?
Thanks.
From: ruipbarra...@sapo.pt <ruipbarra...@sapo.pt>
Sent: Monday, March 21, 2016 11:50 AM
To: Stephen HK WONG
Cc: r-help@r-project.org
Subject: Re: [R] how to use vectorization instead of for loop
Hello,
I've renamed your dataframe to 'dat'. Since ?ifelse is vectorized, try
Dear All,
I have a dataframe like below but with many thousands rows,
structure(list(gene_id = structure(1:6, .Label = c("0610005C13Rik",
"0610007P14Rik", "0610009B22Rik", "0610009L18Rik", "0610009O20Rik",
"0610010B08Rik,OTTMUSG0016609"), class = "factor"), log2.fold_change. =
c(0.0114463,
Hello,
I've renamed your dataframe to 'dat'. Since ?ifelse is vectorized, try
dat[, 4] <- ifelse(dat[, 2] > 0, 1 * (1/dat[,3]), -1* (1/dat[,3]))
Oh, and why do you multiply by 1 and by -1?
It would simply be 1/dat[,3] and -1/dat[,3].
Hope this helps,
Rui Barradas
Quoting Stephen HK WONG
Problem resolved. I confused the true matching status and the probabilistic
record linkage results.
Anders Alexandersson
andersa...@gmail.com
On Thu, Jan 28, 2016 at 9:48 AM, Anders Alexandersson
wrote:
> I am using the compare.linkage function in the RecordLinkage
I am using the compare.linkage function in the RecordLinkage package,
and getting a result I know is wrong, so I know I'm misunderstanding
something.
I am using R 3.2.3 for x64 Windows. I am very familar with Stata but not so
much with R.
I can create record pairs from the blocking fields but all
I am using the compare.linkage function in the RecordLinkage package,
and getting a result I know is wrong, so I know I'm misunderstanding
something.
I am using R 3.2.3 for x64 Windows. I am very familar with Stata but not so
much with R.
I can create record pairs from the blocking fields but all
1 - 100 of 564 matches
Mail list logo