ries, or present both and highlight the difference in outcome. A
> third option is to gather more data.
>
> Tim
>
> -Original Message-
> From: R-help On Behalf Of Bert Gunter
> Sent: Sunday, November 20, 2022 1:06 PM
> To: Mitchell Maltenfort
> Cc: R-help
> Subject: R
-
From: R-help On Behalf Of Bert Gunter
Sent: Sunday, November 20, 2022 1:06 PM
To: Mitchell Maltenfort
Cc: R-help
Subject: Re: [R] test logistic regression model
[External Email]
I think (2) might be a bad idea if one of the "sparse"categories has high
predictive power. You'll lose i
I think (2) might be a bad idea if one of the "sparse"categories has
high predictive power. You'll lose it when you pool, will you not?
Also, there is the problem of subjectively defining "sparse."
However, 1) seems quite sensible to me. But IANAE.
-- Bert
On Sun, Nov 20, 2022 at 9:49 AM
Two possible fixes occur to me
1) Redo the test/training split but within levels of factor - so you have
the same split within each level and each level accounted for in training
and testing
2) if you have a lot of levels, and perhaps sparse representation in a few,
consider recoding levels to
small reprex:
set.seed(5)
dat <- data.frame(f = rep(c('r','g'),4), y = runif(8))
newdat <- data.frame(f =rep(c('r','g','b'),2))
## convert values in newdat not seen in dat to NA
is.na(newdat$f) <-!( newdat$f %in% dat$f)
lmfit <- lm(y~f, data = dat)
##Result:
> predict(lmfit,newdat)
1
Às 15:29 de 20/11/2022, Gábor Malomsoki escreveu:
Dear Bert,
Yes, was trying to fill the not existing categories with NAs, but the
suggested solutions in stackoverflow.com unfortunately did not work.
Best regards
Gabor
Bert Gunter schrieb am So., 20. Nov. 2022, 16:20:
You can't predict
Dear Bert,
Yes, was trying to fill the not existing categories with NAs, but the
suggested solutions in stackoverflow.com unfortunately did not work.
Best regards
Gabor
Bert Gunter schrieb am So., 20. Nov. 2022, 16:20:
> You can't predict results for categories that you've not seen before
>
You can't predict results for categories that you've not seen before (think
about it). You will need to remove those cases from your test set (or
convert them to NA and predict them as NA).
-- Bert
On Sun, Nov 20, 2022 at 7:02 AM Gábor Malomsoki
wrote:
> Dear all,
>
> i have created a logistic
Dear all,
i have created a logistic regression model,
on the train df:
mymodel1 <- glm(book_state ~ TG_KraftF5, data = train, family = "binomial")
then i try to predict with the test df
Predict<- predict(mymodel1, newdata = test, type = "response")
then iget this error message:
Error in
I believe this is the wrong list for this post. See the posting guide,
linked below, for one that is more appropriate.
Bert Gunter
"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip
Dear R friends,
I am currently trying to write a piece of C code that uses „embedded R“, and
for specific reasons*, I cannot keep track if R already has been initialized.
So the code snippet looks like this:
LibExtern char *R_TempDir;
if(R_TempDir == NULL)
…throw exception R not
er it is finished to pdf.
The only obstacle is that my code flashes during plotting to basic device,
however I can live with it.
Thank you again and best regards
Petr
> -Original Message-
> From: Duncan Murdoch
> Sent: Thursday, September 12, 2019 2:29 PM
> To: PIKAL Petr
On 12/09/2019 7:10 a.m., PIKAL Petr wrote:
Dear all
Is there any simple way checking whether after calling pdf device something was
plotted into it?
In interactive session I used
if (dev.cur()==1) plot(ecdf(rnorm(100))) else plot(ecdf(rnorm(100)), add=T,
col=i)
which enabled me to test if
Dear all
Is there any simple way checking whether after calling pdf device something was
plotted into it?
In interactive session I used
if (dev.cur()==1) plot(ecdf(rnorm(100))) else plot(ecdf(rnorm(100)), add=T,
col=i)
which enabled me to test if plot is open
But when I want to call eg.
The basic test of independence for a table based on the Chi-squared
distribution can be done using the `chisq.test` function. This is in
the stats package which is installed and loaded by default, so you
don't need to do anything additional. There is also the `fisher.test`
function for Fisher's
Hi
Did you search CRAN? I got **many** results for
test of independence
which may or may not provide you with suitable procedures.
Cheers
Petr
> -Original Message-
> From: R-help On Behalf Of km
> Sent: Thursday, December 20, 2018 8:07 AM
> To: r-help@r-project.org
&
Dear All,
How do I do a test of independence with 16x16 table of counts.
Please suggest.
Regards,
KM
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
Apologies for disturbance! Just checking that I can
get through to r-help.
Ted.
__
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 guide
Dear Mr. Savicky,
I am currently working on a project where I want to test a random number
generator, which is supposed to create 10.000 continuously uniformly
distributed random numbers between 0 and 1. I am now wondering if I can use the
Chi-Squared-Test to solve this problem or if the
Hey all,
Does anyone know how we can get train set and test set for each fold of 5 fold
cross validation in Caret package? Imagine if I want to do cross validation by
random forest method, I do the following in Caret:
set.seed(12)
train_control <- trainControl(method="cv",
This list is about R programming, not statistics, although admittedly
there is a nonempty intersection. However, I think you would do better
posting this on a statistics list like stats.stackexchange.com.
-- Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming
Hello group,
my question is deciding what test would be appropriate for following question.
An experiment 'A' yielded 3200 observations of which 431 are
significant. Similarly, using same method, another experiment 'B' on a
different population yielded 2541 observations of which 260 are
Hi John. Thanks much for your help. It is great to know this.
Hanna
2017-03-16 8:02 GMT-04:00 Fox, John :
> Dear Hanna,
>
> You can test the slope in each non-reference group as a linear hypothesis.
> You didn’t make the data available for your example, so here’s an example
>
Dear Hanna,
You can test the slope in each non-reference group as a linear hypothesis.
You didn’t make the data available for your example, so here’s an example
using the linearHypothesis() function in the car package with the Moore
data set in the same package:
- - - snip - - -
> library(car)
Hi all,
Consider the data set where there are a continuous response variable, a
continuous predictor "weeks" and a categorical variable "region" with five
levels "a", "b", "c",
"d", "e".
I fit the ANCOVA model as follows. Here the reference level is region "a"
and there are 4 dummy variables.
--
Robert J. Piliero
Cell: (617) 283 1020
38 Linnaean St. #6
Cambridge, MA, 02138
USA
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
r interactions mentioned
> above.
>
> So the bptest() implementation from "lmtest" is really recommend. Or
> alternatively ncvTest() from package "car".
>
>
> Hope this helps.
>>
>> Sacha
>>
>>
>>
>>
>>
>> __
) implementation from "lmtest" is really recommend. Or
alternatively ncvTest() from package "car".
Hope this helps.
Sacha
De : Deepak Singh <sdeepakrh...@gmail.com>
À : r-help@r-project.org
Envoyé le : Lundi 4 avril 2016 10h40
Objet :
On Mon, 4 Apr 2016, Deepak Singh wrote:
Respected Sir,
I am doing a project on multiple linear model fitting and in that project I
have to test Homoscedesticity of errors I have google for the same and
found bptest for the same but in R version 3.2.4 bp test is not available.
The function is
the assumption of
heteroscedastic.
The White test with R
install.packages("bstats")
library(bstats)
white.test(LinearModel)
Hope this helps.
Sacha
De : Deepak Singh <sdeepakrh...@gmail.com>
À : r-help@r-project.org
Envoyé le : Lundi 4 avril 2016
You might "google Breusch Pagan test r" and find that the test is
implemented in lmtest package.
On 4 Apr 2016 17:28, "Deepak Singh" wrote:
> Respected Sir,
> I am doing a project on multiple linear model fitting and in that project I
> have to test Homoscedesticity of
Respected Sir,
I am doing a project on multiple linear model fitting and in that project I
have to test Homoscedesticity of errors I have google for the same and
found bptest for the same but in R version 3.2.4 bp test is not available.
So please suggest me a test on homoscedesticity ASAP as we
> On Mar 23, 2016, at 1:44 PM, ruipbarra...@sapo.pt wrote:
>
> Hello,
>
> Try
>
> ?t.test
> t.test(mA, mB, alternative = "greater")
>
> Hope this helps,
>
> Rui Barradas
>
>
> Citando Eliza Botto :
>
>> Dear All,
>> I want to test a hypothesis in R by using
othesis is that model A produced less error.
>
> regards,
>
> Eliza
>
> -
> Date: Wed, 23 Mar 2016 20:44:20 +
> From: ruipbarra...@sapo.pt
> To: eliza_bo...@outlook.com
> CC: r-help@r-project.org
> Subject: Re: [R] test hypothesis in
Thnx Rui,
Just one point though
Should it be alternative="greater" or "less"? Since alternative hypothesis is
that model A produced less error.
regards,
Eliza
Date: Wed, 23 Mar 2016 20:44:20 +
From: ruipbarra...@sapo.pt
To: eliza_bo...@outlook.com
CC: r-help@r-project
Hello,
Try
?t.test
t.test(mA, mB, alternative = "greater")
Hope this helps,
Rui Barradas
Citando Eliza Botto :
> Dear All,
> I want to test a hypothesis in R by using student' t-test (P-values).
> The hypothesis is that model A produces lesser error than model B at
Dear All,
I want to test a hypothesis in R by using student' t-test (P-values).
The hypothesis is that model A produces lesser error than model B at ten
stations. Obviously, Null Hypothesis (H0) is that the error produces by model A
is not lower than model B.
The error magnitudes are
#model A
On 29/06/2014, 7:12 AM, Hui Du wrote:
Hi all,
I need to test if a url exists. I used url.exists() in RCurl package
library(RCurl)
however the test result is kind of weird. For example,
url.exists(http://www.amazon.com;)
[1] FALSE
although www.amazon.comhttp://www.amazon.com is a
Hi all,
I need to test if a url exists. I used url.exists() in RCurl package
library(RCurl)
however the test result is kind of weird. For example,
url.exists(http://www.amazon.com;)
[1] FALSE
although www.amazon.comhttp://www.amazon.com is a valid url. Does anybody
know how to use that
On 01/03/2014 23:32, Hui Du wrote:
Hi All,
My sample code looks like
options(stringsAsFactors = FALSE);
clean = function(x)
{
loc = agrep(ABC, x$name);
x[loc,]$new_name - NEW;
x;
}
name = c(12, dad, dfd);
y = data.frame(name = as.character(name), idx = 1:3);
y$new_name =
Hi All,
My sample code looks like
options(stringsAsFactors = FALSE);
clean = function(x)
{
loc = agrep(ABC, x$name);
x[loc,]$new_name - NEW;
x;
}
name = c(12, dad, dfd);
y = data.frame(name = as.character(name), idx = 1:3);
y$new_name = y$name;
z - clean(y)
The snippet does not
Hi,
I have a data set where there are 20 experiments which each ran for 10 minutes.
In each experiment an insect had a choice to spend time in one of two chambers.
Each experiment therefore has number of seconds spent in each chamber. I want
to know whether there is a difference in the mean
Inline below.
Cheers,
Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374
Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
H. Gilbert Welch
On Tue, Dec 24, 2013 at 7:38 AM, wesley bell wesleybel...@yahoo.com wrote:
Hi,
I have a data
Hi,
In attachment you can find source data on which I run adf.test() and
print-screen with results in R and Eviews.
Results are very different. Did I missed something?
Best,
T.S.
__
R-help@r-project.org mailing list
On Dec 5, 2013, at 3:18 PM, nooldor wrote:
Hi,
In attachment you can find source data on which I run adf.test() and
print-screen with results in R and Eviews.
Results are very different. Did I missed something?
Yes. You missed the list of acceptable file types for r-help.
--
David
Hi,
I am building a bivariate SVAR model
y_1t=c_1+Ã_1 (1,1) y_(1,t-1)+Ã_1 (1,2) y_(2,t-1)+Ã_2 (1,1) y_(1,t-2)+Ã_2
(1,2) y_(2,t-2)+å_1t
b y_1t+ y_2t=c_2+Ã_1 (2,1) y_(1,t-1)+Ã_1 (2,2) y_(2,t-1)+Ã_2 (2,1)
y_(1,t-2)+Ã_2 (1,2) y_(2,t-2)+å_2t
Now y1 is relatively exogenous in that y1
Hi,
Try:
fun1 - function(dat){
mat1 - combn(colnames(dat1),2)
res - sapply(seq_len(ncol(mat1)),function(i) {x1- dat[,mat1[,i]];
wilcox.test(x1[,1],x1[,2])$p.value})
names(res) - apply(mat1,2,paste,collapse=_)
res
}
set.seed(432)
dat1 -
Hello,
There's a bug in your function, it should be 'dat', not 'dat1'. In the
line marked, below.
fun1 - function(dat){
mat1 - combn(colnames(dat),2) # Here, 'dat' not 'dat1'
res - sapply(seq_len(ncol(mat1)),function(i) {x1- dat[,mat1[,i]];
wilcox.test(x1[,1],x1[,2])$p.value})
Hi,
Check out this function:-
pairwise.wilcox.test {package=stats}.
example(pairwise.wilcox.test)
On Fri, Oct 25, 2013 at 2:15 AM, Rui Barradas ruipbarra...@sapo.pt wrote:
Hello,
There's a bug in your function, it should be 'dat', not 'dat1'. In the line
marked, below.
fun1 -
It looks much better than mine.
with p value adjustment:
p.adjust(fun1(dat1), method = holm, n = 153)
#
dat1$id - 1:10
library(reshape2)
dat2 - melt(dat1,id.var=id)
with(dat2,pairwise.wilcox.test(value,variable))
with(dat2,pairwise.wilcox.test(value,variable,p.adj=none))
A.K.
On
Dear all
I have one question that I struggle to find an answer:
Let`s assume I have 2 timeseries of daily PnL data over 2 years coming from 2
different trading strategies. I want to find out if strategy A is better than
strategy B. The problem is that the two series have serial
I imagine that most readers of this list will put your question in the
too hard basket.
That being so, here is my inexpert take on the question.
The issue is to estimate the uncertainty in the estimated difference of
the means.
This uncertainty depends on the nature of the serial dependence
]
Gesendet: Samstag, 13. Juli 2013 19:57
An: William Dunlap
Cc: mailman, r-help; Thiem Alrik
Betreff: Re: [R] Test for column equality across matrices
I tried it on a slightly bigger dataset:
A1 - matrix(t(expand.grid(1:90, 15, 16)), nrow = 3)
B1 - combn(90, 3)
which(is.element(columnsOf(B1
Dunlap
Cc: R help; Thiem Alrik
Subject: Re: [R] Test for column equality across matrices
I tried it on a slightly bigger dataset:
A1 - matrix(t(expand.grid(1:90, 15, 16)), nrow = 3)
B1 - combn(90, 3)
which(is.element(columnsOf(B1), columnsOf(A1)))
# [1] 1067 4895 8636 12291 15861 19347
Dear list,
I have two matrices
A - matrix(t(expand.grid(c(1,2,3,4,5), 15, 16)), nrow = 3)
B - combn(16, 3)
Now I would like to exclude all columns from the 560 columns in B which are
identical to any 1 of the 6 columns in A. How could I do this?
Many thanks and best wishes,
Alrik
Sent: Saturday, July 13, 2013 6:45 AM
To: mailman, r-help
Subject: [R] Test for column equality across matrices
Dear list,
I have two matrices
A - matrix(t(expand.grid(c(1,2,3,4,5), 15, 16)), nrow = 3)
B - combn(16, 3)
Now I would like to exclude all columns from the 560 columns in B
.
- Original Message -
From: William Dunlap wdun...@tibco.com
To: Thiem Alrik th...@sipo.gess.ethz.ch; mailman, r-help
r-help@r-project.org
Cc:
Sent: Saturday, July 13, 2013 1:30 PM
Subject: Re: [R] Test for column equality across matrices
Try
columnsOf - function(mat) split(mat, col(mat))
newB
(match(interaction(as.data.frame(t(B))),interaction(as.data.frame(t(A)]
identical(B1,B2)
#[1] TRUE
A.K.
- Original Message -
From: Thiem Alrik th...@sipo.gess.ethz.ch
To: mailman, r-help r-help@r-project.org
Cc:
Sent: Saturday, July 13, 2013 9:45 AM
Subject: [R] Test for column
Sorry for this message it's just a test.
Thank you!
--
---
Catalin-Constantin ROIBU
Lecturer PhD, Forestry engineer
Forestry Faculty of Suceava
Str. Universitatii no. 13, Suceava, 720229, Romania
office phone +4 0230 52 29 78, ext. 531
mobile phone +4 0745 53 18 01
Dear Heather,
You can make this test using the ordinal package. Here the function
clm fits cumulative link models where the ordinal logistic regression
model is a special case (using the logit link).
Let me illustrate how to test the parallel regression assumption for a
particular variable using
Hi,
I am running an analysis with an ordinal outcome and I need to run a test
of the parallel regression assumption to determine if ordinal logistic
regression is appropriate. I cannot find a function to conduct such a test.
From searching various message boards I have seen a few useRs ask this
Heather:
You are at Vanderbilt, whose statistics department under Frank Harrell
is a veritable bastion of R and statistical wisdom. I strongly
recommend that you take a stroll over there in the lovely spring
weather and seek their help. I can't imagine how you could do better
than that!
Cheers,
Perhaps you should be asking whether such an algorithm exists, regardless of
whether it is already implemented in R. However, this is the wrong place to ask
such theory questions... your local statistics expert might know, or you could
ask on a statistics theory forum such as
here's some code as an example hope it helps!
mod-polr(vote~age+demsat+eusup+lrself+male+retnat+union+urban, data=dat)
summary(mod)
mod-polr(vote~age+demsat+eusup+lrself+male+retnat+union+urban, data=dat)
levs-levels(dat$vote)
tmpdat-list()
for(i in 1:(nlevels(dat$vote)-1)){
tmpdat[[i]] -
Hi fellows,
I use RMySQL. I want to reconnect, if the connections is not alive anymore.
if (!connected()) con-dbConnect(MySQL(),user=..,
password=..,host=..,db=..)
But how can I do the test connected()?
I thought the way to do this was,
Once again, thanks!
MVS
-
MVS
=
Matthew Van Scoyoc
Graduate Research Assistant, Ecology
Wildland Resources Department Ecology Center
Quinney College of Natural Resources
Utah State University
Logan, UT
=
Think SNOW!
--
View this message in context:
Dear R usuer,
I need to fit logistic regression with binomial response. The
objective is to compare treatment groups controlling other categorical
and continuous predictors. The GLM procedure with
family=binomial(Logit) gives me parameters estimates as well as odd
ratios. But objective is to
Hi Lorenzo,
Just a quick thought, the uniform probability density on a unit sphere is 1
/ (4pi),
what about binning those random points according to their directions and do
a chi-square test?
Regards,
Guo
On Sun, Oct 7, 2012 at 2:16 AM, cbe...@tajo.ucsd.edu wrote:
Lorenzo Isella
Lorenzo Isella lorenzo.ise...@gmail.com writes:
Dear All,
I implemented an algorithm for (uniform) random rotations.
In order to test it, I can apply it to a unit vector (0,0,1) in
Cartesian coordinates.
The result is supposed to be a set of random, uniformly distributed,
points on a sphere
Dear All,
I implemented an algorithm for (uniform) random rotations.
In order to test it, I can apply it to a unit vector (0,0,1) in Cartesian
coordinates.
The result is supposed to be a set of random, uniformly distributed,
points on a sphere (not the point of the algorithm, but a way to
On Fri, Oct 5, 2012 at 5:39 PM, Lorenzo Isella lorenzo.ise...@gmail.com wrote:
Dear All,
I implemented an algorithm for (uniform) random rotations.
In order to test it, I can apply it to a unit vector (0,0,1) in Cartesian
coordinates.
The result is supposed to be a set of random, uniformly
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
project.org] On Behalf Of R. Michael Weylandt
Sent: Friday, October 05, 2012 11:17 AM
To: Lorenzo Isella
Cc: r-help@r-project.org
Subject: Re: [R] Test for Random Points on a Sphere
On Fri, Oct 5
Hi all,
I want to know how to perform the test Breslow-Day test for homogeneity of
odds ratios (OR) stratified for svytable. This test is obtained with the
following code:
epi.2by2 (dat = daty, method = case.control conf.level = 0.95,
units = 100, homogeneity = breslow.day, verbose =
Suggstion:
You need to send us more information, i.e. the code that genrated daty, or a
listing of the daty structure, and a copy of the listing
produced by epi.2by2
John
John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of
On Aug 31, 2012, at 7:20 AM, Diana Marcela Martinez Ruiz wrote:
Hi all,
I want to know how to perform the test Breslow-Day test for homogeneity of
odds ratios (OR) stratified for svytable. This test is obtained with the
following code:
epi.2by2 (dat = daty, method = case.control
On Sat, Sep 1, 2012 at 4:27 AM, David Winsemius dwinsem...@comcast.net wrote:
On Aug 31, 2012, at 7:20 AM, Diana Marcela Martinez Ruiz wrote:
Hi all,
I want to know how to perform the test Breslow-Day test for homogeneity of
odds ratios (OR) stratified for svytable. This test is obtained
On Tue, Aug 7, 2012 at 10:26 PM, Marc Schwartz marc_schwa...@me.com wrote:
since there are alpha-numerics present, whereas the first option will:
grepl([^[:alnum:]], ab%)
[1] TRUE
So, use the first option.
And I should start reading more carefully. The above works fine for me.
I ended up
On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz marc_schwa...@me.com wrote:
is.letter - function(x) grepl([[:alpha:]], x)
is.number - function(x) grepl([[:digit:]], x)
Quick follow-up question.
I'm always reluctant to create functions that would resemble the
method of a function (here, is() ),
On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz marc_schwa...@me.com wrote:
is.letter - function(x) grepl([[:alpha:]], x)
is.number - function(x) grepl([[:digit:]], x)
Another follow-up. To test for (non-)alphanumeric one would do the following:
x - c(letters, 1:26, '+', '-', '%^')
x[1:10] -
On Tue, Aug 7, 2012 at 4:28 AM, Liviu Andronic landronim...@gmail.com wrote:
On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz marc_schwa...@me.com wrote:
is.letter - function(x) grepl([[:alpha:]], x)
is.number - function(x) grepl([[:digit:]], x)
Quick follow-up question.
I'm always reluctant
On Aug 7, 2012, at 3:02 PM, Liviu Andronic landronim...@gmail.com wrote:
On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz marc_schwa...@me.com wrote:
is.letter - function(x) grepl([[:alpha:]], x)
is.number - function(x) grepl([[:digit:]], x)
Another follow-up. To test for (non-)alphanumeric
On Aug 7, 2012, at 3:18 PM, Marc Schwartz marc_schwa...@me.com wrote:
On Aug 7, 2012, at 3:02 PM, Liviu Andronic landronim...@gmail.com wrote:
On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz marc_schwa...@me.com wrote:
is.letter - function(x) grepl([[:alpha:]], x)
is.number - function(x)
On Tue, Aug 7, 2012 at 10:18 PM, Marc Schwartz marc_schwa...@me.com wrote:
That will get you values where punctuation characters are used, but there may
be other non-alphanumeric characters in the vector. There may be ASCII
control codes, tabs, newlines, CR, LF, spaces, etc. which would not
Dear all
I'm pretty sure that I'm approaching the problem in a wrong way.
Suppose the following character vector:
(x[1:10] - paste(x[1:10], sample(1:10, 10), sep=''))
[1] a10 b7 c2 d3 e6 f1 g5 h8 i9 j4
x
[1] a10 b7 c2 d3 e6 f1 g5 h8 i9 j4 k
l m n
[15] o p q r s t
nzchar(x) !is.na(x)
No?
-- Bert
On Mon, Aug 6, 2012 at 9:25 AM, Liviu Andronic landronim...@gmail.com wrote:
Dear all
I'm pretty sure that I'm approaching the problem in a wrong way.
Suppose the following character vector:
(x[1:10] - paste(x[1:10], sample(1:10, 10), sep=''))
[1] a10 b7
Hello,
Fun as an exercise in vectorization. 30 times faster. Don't look, guess.
Gave it up? Ok, here it is.
is_letter - function(x, pattern=c(letters, LETTERS)){
sapply(x, function(y){
any(sapply(pattern, function(z) grepl(z, y, fixed=T)))
})
}
# test ascii codes, just one
On 08/06/2012 09:51 AM, Rui Barradas wrote:
Hello,
Fun as an exercise in vectorization. 30 times faster. Don't look, guess.
system.time(res0 - grepl([[:alpha:]], x))
user system elapsed
0.060 0.000 0.061
system.time(res1 - has_letter(x))
user system elapsed
3.728 0.008
Perhaps I am missing something, but why use sapply() when grepl() is already
vectorized?
is.letter - function(x) grepl([:alpha:], x)
is.number - function(x) grepl([:digit:], x)
x - c(letters, 1:26)
x[1:10] - paste(x[1:10], sample(1:10, 10), sep='')
x - rep(x, 1e3)
str(x)
chr [1:52000] a2
, 2012 12:25 PM
Subject: [R] test if elements of a character vector contain letters
Dear all
I'm pretty sure that I'm approaching the problem in a wrong way.
Suppose the following character vector:
(x[1:10] - paste(x[1:10], sample(1:10, 10), sep=''))
[1] a10 b7 c2 d3 e6 f1 g5 h8 i9 j4
x
[1
On Aug 6, 2012, at 12:06 PM, Marc Schwartz marc_schwa...@me.com wrote:
Perhaps I am missing something, but why use sapply() when grepl() is already
vectorized?
is.letter - function(x) grepl([:alpha:], x)
is.number - function(x) grepl([:digit:], x)
Sorry, typos in the above from my CP.
: Monday, August 06, 2012 12:07 PM
To: Rui Barradas
Cc: r-help
Subject: Re: [R] test if elements of a character vector contain letters
Perhaps I am missing something, but why use sapply() when grepl() is
already vectorized?
is.letter - function(x) grepl([:alpha:], x)
is.number - function(x
On Mon, Aug 6, 2012 at 6:42 PM, Bert Gunter gunter.ber...@gene.com wrote:
nzchar(x) !is.na(x)
No?
It doesn't work for what I need:
x
[1] a10 b8 c9 d2 e3 f4 g1 h7 i6 j5 k
l m n
[15] o p q r s t u v w x y
z 1 2
[29] 3 4 5 6 7 8 9 10 11 12
You probably mean grepl('[a-zA-Z]', x)
Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA
On Mon, Aug 6, 2012 at 3:29 PM, Liviu Andronic landronim...@gmail.com wrote:
On Mon, Aug
On Mon, Aug 6, 2012 at 7:35 PM, Marc Schwartz marc_schwa...@me.com wrote:
is.letter - function(x) grepl([[:alpha:]], x)
is.number - function(x) grepl([[:digit:]], x)
This does exactly what I wanted:
x
[1] a10 b8 c9 d2 e3 f4 g1 h7 i6 j5 k
l m n
[15] o p q r s t u v
On Sun, Jul 8, 2012 at 2:32 AM, Diana Marcela Martinez Ruiz
dianamm...@hotmail.com wrote:
Hello,
I would like to know how to test the assumption of proportional odds or
parallel lines or slopes for an ordinal logistic regression with svyolr
I wouldn't, but if someone finds a clear reference
Hello,
I would like to know how to test the assumption of proportional odds or
parallel lines or slopes for an ordinal logistic regression with svyolr
Thanks
[[alternative HTML version deleted]]
__
As an alternative to the hexview package, an external Hex-Editor may help you
investigate how the data is organised.
--
View this message in context:
http://r.789695.n4.nabble.com/Test-Binary-File-tp833690p4633075.html
Sent from the R help mailing list archive at Nabble.com.
Hi all,
how would you test if a sample mean of integers with range -inf;inf is
different from zero:
# my sample of integers:
c - c(-3, -1, 0, 1, 0, 3, 4, 10, 12)
# is mean of c 0?:
mean(c)
Thanks,
Kay
[[alternative HTML version deleted]]
mean(c) != 0
But if you mean in a statistical sense... t.test() is one possibility.
Michael
On Fri, May 4, 2012 at 5:29 AM, Kay Cichini kay.cich...@gmail.com wrote:
Hi all,
how would you test if a sample mean of integers with range -inf;inf is
different from zero:
# my sample of
On Fri, May 04, 2012 at 11:29:51AM +0200, Kay Cichini wrote:
Hi all,
how would you test if a sample mean of integers with range -inf;inf is
different from zero:
# my sample of integers:
c - c(-3, -1, 0, 1, 0, 3, 4, 10, 12)
# is mean of c 0?:
mean(c)
Hi.
It is better to use a name
1 - 100 of 244 matches
Mail list logo