How many data points do you have in each group?
- How much do the two groups overlap?
If the answers are 'not many' or 'lots' (in that order), and especially if both
apply, you can't expect a significant test result.
S Ellison
*
> tb2a$TID2 <- gsub(tb2a$TID, pattern="-[0-0]{0,7}", replacement = "")
Just to add something on why this didn't work ...
It looks like you were trying to match a hyphen followed by a number up to
seven digits. by mistake(?) you gave the digit range as [0-0] so it would
repmatch a hyphen followe
> I am having an issue with creating a code in which i can hold information such
> as the author of a paper, the year of publication, and the title.
This doesn't really tell me what the trouble is. But ...
> Also would like
> to add into this data frame a logical variable which would show some
>
Not really my field, but would you not approach this using FFT on selected
regions?
I think IMageJ has some capability in that area; see example at
https://imagej.nih.gov/ij/docs/examples/tem/.
Steve Ellison
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On
> Limited water resources need to be apportioned among various competing
> users
> (e.g,, agriculture, fish and wildlife, Tribes, potable human water
> supplies).
Water management is definitely not my field, but for interest - and maybe to
help other folk respond - can I ask what the loss functio
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Michael
> Friendly
> Check out the `matlib` package on CRAN and devel on github:
Very nice! Thanks for the pointer.
Steve E
***
This
You can drop the quote marks by calling print() explicitly with quote=FALSE, by
using as.data.frame round your cbind, or - perhaps best - by constructing your
output matrix as a data frame in the first place. (print.data.frame defaults
to quote=FALSE). And if you suppress name checking in a dat
)
which uses default colours. Once you have an aes mapping you can change the
scale, so
( p + scale_colour_manual(values = c("red", "blue", "green")) )
gives you the colour ordering you want.
( p + scale_colour_manual(values = c("red", "blue", "gr
subset(t1, apply(t1, 1, function(x) !all(is.na(x
(or the equivalent '[' usage)
and, as an aside, using '==' for floating point numbers is not generally safe;
for example
> sqrt(2)^2 == 2.0
[1] FALSE
See R FAQ 7.31 for details of why '==' is bad for floating poin
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jose
> Claudio Faria
>
> The Tinn-R project has a new web page:
> http://nbcgib.uesc.br/tinnr/en/index.php
>
Thanks for this - and thanks, also, for maintaining Tinn-R and keeping it
available as free software. The effort is muc
Pointers inline below:
> > Since I'm a newbie on R, I was wondering if you could help me to achieve a
> > small project that I think it's possible with this project (I cant seem to
> > find a similar tool)
> >
> > I have a data file with about 2000 value lines, organized like this:
> >
> > x;y;z;j
> With your code you just remove diagonal elements from your matrix.
Worse; it removed _all_ elements from the matrix that match _anything_ in the
diagonal!
Which, in that example, was everything ...
***
This email and any attach
i) Your code creates w2 but references w1 to create aa.
So you needed
aa <- matrix(rep(c(0.4, 0.1, 0.2), 3), 3,3)
for a working example.
ii) This
> matrix(as.numeric(aa)[!as.numeric(aa) %in% diag(aa)],2,3)
removes any value that is present in the diagonal of aa. Look up ?"%in%" to see
what that
You might take a look at the reshape package, which switches from 'long' to
'wide' formats and vice versa in a fairly flexible way.
S Ellison
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of lily li
> Sent: 13 Novemb
You could look at combning a number of palettes from the RColorBrewer package
to get the palette length you want.
S Ellison
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Federico
> Calboli
> Sent: 11 September 2018 08:35
&g
> This package uses a modified version of aov() function, which uses
> Permutation Tests
>
> I obtain different p-values for each run!
Could that be because you are defaulting to perm="Prob"?
I am not familiar with the package, but the manual is informative.
You may have missed something when r
x likelihood, maybe nlme in the nlme package.
For other ideas, look up 'non-linear fitting with R' on any search engine, or
check the R Task Views
S Ellison
***
This email and any attachments are confidential. Any use, copyi
> If I install R on my work network computer, will the data ever leave our
> network?
As far as I know, if you run R locally (and not, say, on an amazon EC2
instance) your data - indeed anything about you or your machine - will only
leave your desktop if you download and run an R package that tr
> Most of my methods, are not exported to the namespace using the
> @examples
> options.
Joanna,
You normally need to export _all_ the objects/functions that you expect users
to be able to run.
And if you are giving an example of a function, it seems likely that you expect
users to use it, so it
> > Eric Bergeron Wed, 8 Aug 2018 12:53:32 +0300 writes:
>
> > You only need one "for loop"
> > for(i in 2:nrow(myMatrix)) {
> >myMatrix[i-1,i-1] = -1
> >myMatrix[i-1,i] = 1
> > }
Or none, with matrix-based array indexing and explicit control of the indices
to prevent overrun i
Another possible approach, using the transformation returned by persp() to
locate axes explicitly and using base graphics to place labels etc, is given at
http://entrenchant.blogspot.com/2014/03/custom-tick-labels-in-r-perspective.html
> -Original Message-
> From: R-help [mailto:r-help-
g your business.
S Ellison
***
This email and any attachments are confidential. Any use, copying or
disclosure other than by the intended recipient is unauthorised. If
you have received this message in error, please notify the
> Given that clarification, I'd just generate the full set and remove
> the ones you aren't interested in, as in:
I'd agree; that is probably the most efficient thing to do with only half a
dozen binary variables and a single condition.
A way of going about it for a more complex case might be to
Suggest you take a look at the R website at www.r-project.org; the most
important answers are evident there.
If you 'require' more authoritative answers within a particular timescale, I
suggest you engage an R consultant and pay for them. This is a voluntary list.
S Ellison
>
> On Thu, Aug 2, 2018 at 11:20 AM, R Stafford
> wrote:
> > But I have the extra condition that if E is true, then F must be false, and
> > vice versa,
Question: Does 'vice versa' mean
a) "if E is False, F must be True"
or
b) "if F is True, E must be False"?
... which are not the same.
b) (and
xpected results.
S Ellison
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Naresh
> Gurbuxani
> Sent: 25 July 2018 07:17
> To: R-help@r-project.org
> Subject: [R] Using apply function to merge list of data frames
>
> I have
> #I need to get this final result
> r<-data.frame(i=c(1,1,1,2,2,3), s=c(97, 98, 99, 103, 105, 118))
Nothing magic to suggest.
But maybe:
list.s <- strsplit(d$s,",")
r <- data.frame(i=rep(d$i, times=sapply(list.s, length)), s=unlist(list.s),
stringsAsF
", not the
menu function or the package installation function "install.packages"
The latter needs a list of packages to install. The former tells you what is
already installed.
S Ellison
***
This email and
levels=c("name_b", "name_c", "name_a"))
#or, for a more obviously likely example
lmh <- factor(sample(c("High", "Medium", "Low"), 30, replace=T),
levels=c("Low&qu
need_ the enclosiong {}, though;
> expression(NO[3]^'-'~(mg/L))
works as you intended
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
ats[3,], names, pos=1) #labels just below
the medians
#And for placing means on the plot:
RTFmeans <- with(AmbientTr, tapply(RTF, batch, mean))
points(1:length(RTFmeans), RTFmeans, pch=19)
text(1:length(RTFmeans), RTFmeans, paste(round(RTFmeans,0)), pos=
> I am traying to create a a column in my data frame filled down with a
> number.
>
> > df$newcolumn <- number
>
> How can I do it? I am considering use rep() but in this case it is
> necessary know the number of rows in each data base that I have and I would
> like to do it in a faster ( and m
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of JEFFERY
> REICHMAN
> # Standard deviations and correlation
> sig_x <- 1
> sig_y <- 1
> rho_xy <- 0.0
>
> # Covariance between X and Y
> sig_xy <- rho_xy * sig_x *sig_y
>
> # Covariance matrix
> Sig
rn tells me
that you have not constructed your data frame correctly. I can't tell you what
you did wrong there.
- As another poster has said, data.frame is the name of a function - one that
construicts a data frame. R can often tell which you want, but it is never safe
to use the na
he differential function from your function for
y; see ?D
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
R-help@r-project.org mailing list --
> Following the given codes below, I generated a plot that has 6 regions around
> a
> center point (IL), with 5 regions containing
>
> a point (L1, L2 to L5) and sixth vacant region. I want background of all the
> filled
> regions turned "green", while "red" for the
>
> vacant region. Can it be
t?
See ?summary.lm
For a linear model L
summary(L)$r.squared
gives R^2
and the adjusted R^2 is
summary(L)$adj.r.squared
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
, "P3", "P4"}}
Note the double parentheses ... this is still a set of sets with one member,
not a set of character strings with four members.
Hope that helps ...
S Ellison
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Neha
ors constructed from allele data, you will usually get
complete nonsense in genetic terms.
You should probably look at something like dist.gene in the ape package: see
https://www.rdocumentation.org/packages/ape/versions/5.0/
ps something that picks the minimum
year for a subject or other relevant group might work? For example
paste("survey", ave(year, studyno, FUN=min), sep="_")
S Ellison
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Kevin
>
> > From: Leif Ruckman [mailto:leif.ruck...@kau.se]
> > Sent: Friday, February 16, 2018 3:27 PM
> > To: PIKAL Petr
> > Subject: RE: stem - strange leaves
> >
> > Thank you, I also found that solution but I think it is strange that
> > this happens at all. I have tried different data and sometimes
standard errors.
So this particular example is apparently version-specific.
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
R-help@r-project.o
e thing.
So there's probably more than one reason // was added to C. That and better
editors.
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
___
Mathias,
If it's any comfort, I appreciated the example; 'expected' behaviour maybe, but
a very nice example for staff/student training!
S Ellison
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Matthias
> Gondan
> Se
> >Is it possible to download and run R on Asus ZenFone, if yes, which
> >version
Try Googling 'R on Android'
The top link is
https://www.r-bloggers.com/install-r-in-android-via-gnuroot-no-root-required/
***
This email and any a
anova is defaulting to anova.lm, and that doesn't expect a mixed effects model.
Switch them round to put model2 first:
anova (model2, model1)
S Ellison
***
This email and any attachments are confid
that there is a difference across three types,
is there a reason not to use something like Levene's test to confirm that the
variances differ by more than chance?
S Ellison
***
This email and any attachments are con
ify Upper limit and Lower limit,
though I've not tried omitting them.
S Ellison
***
This email and any attachments are confidential. Any use, copying or
disclosure other than by the intended recipient is unauthorised. If
you have
> I think that I need to
> draw a Hypercube sample for each age class (i.e., for 0, 1, 2, 3, 4, 5, 6, 7)
> in a
> given simulation (i.e., N = 1) and the LHS values for all age classes should
> be
> like the observed cumulative distribution (see attached figure).
> output of randomLHS should be a
> However, my variable is simulated from the cumulative distribution function
> of the Poisson distribution.
Then I am afraid I don't know what you're trying to achieve.
Or why.
However, the principle holds; write a function that maps [0,1] to the 'pattern'
you want, do that and apply it to the
ke a list of either subpopulations or sets
of population parameters, lapply your simulation generator over the list and
(assuming the output from each of those is a vector) use c(that.list,
recursive=TRUE) to concatenate the resulting list of
.
For example:
q <- randomLHS(1000, 3)
colnames(q) <- c("A", "B", "mort")
q[, "mort"] <- qpois(q[,"mort"], 1.5)
S Ellison
***
This email and any attachments are confid
> use
>
> par(mfrow=c(2,2), cex = 1)
This does work as written. But when I first checked single-call setting, an
mfrow change to cex in the same call superseded cex=1; hence my suggestion to
use separate calls to par().
Further checking confirms that the result of a call to par is dependent on
Checking ?par,
" In a layout with exactly two rows and columns the base value
of '"cex"' is reduced by a factor of 0.83: if there are three
or more of either rows or columns, the reduction factor is
0.66."
You should be able to simply set cex to 1/0.83 for a 2x2 layout and by 1/0.66
for
> I'm having trouble with a simple application with metRology.
Well, what you probably need is to contact the maintainer of the metRology
package.
Fortunately that's me.
An immediate problem that I have is that I don't quite understand what you're
doing (in the measurement), so I may need to
t?
... and the R question:
ii) Is it already hiding somewhere in an R package?*
S Ellison
*If it's not, I'll be adding it to one, hence the hunt for due credit/sources
***
This email and any attach
u run the product on the command line, either inside I() or not, what's the
class of the result?
If that is order-dependent for the object types you're combining, while I don't
know why that might be it would go some way to explaining
appear.
>
> How can I do this?
Use unique() on each row and pad with NA?
Example:
uniq10 <- function(x, L=10) {
u <- unique(x)
c(u, rep(NA, L-length(u)) )
}
as.data.frame( t( apply(tmp, 1, uniq10) ) )
assuming tmp is
atrix with the available
flow data
dT.m[as.matrix(dataTrade.ag[1:2]) ] <- dataTrade.ag$Flow
#This relies on a default conversion from data frame factors to a
character matrix, together
#with R's facility for matrix indexing by 2-column matrix
#Then
dataTrade.ag[1:10
> > SQL, for example, generally takes the view that any
> > expression involving 'missing' is 'missing'.
>
> Well, then SQL gets it wrong.
Well, that's a view. But paraphrasing an R Turner from a few lines away in the
same email:
> One should be very, very circumspect about presuming to know
]
#Which returns
#
# FALSE
which - particularly since it appears without warning - is not an obviously
sensible outcome.
I am not suggesting a change to R's logical operations, which have clearly been
thought through (that is evident from NA&FALSE == FALSE&NA == FALSE). But
Maybe a daft question arising from lack of reproducible example, but have you
run ls() manually to make sure there are objects that _exactly_ match "_Figs_" ?
The simplest explanation for a loop doing nothing is that there are no cases.
S Ellison
> The following function is suppo
radians=azimuth
)
arrows(x, y, x+cos(az.rad)*size, y+sin(az.rad)*size, ...)
}
plot(0:6, 0:6, type="n")
arrows.az(x, y, Azimuth, Length)
"..." means you can pass all the other options to arrows()
S Ellison
>
>
> Thanks,
>
> Julio
>
>
<- switch(units,
degrees=azimuth*pi/180,
radians=azimuth
)
arrows(x, y, x+cos(az.rad)*length, y+sin(az.rad)*length, ...)
}
plot(0:6, 0:6, type="n")
arrows.az(x, y, Azimuth, Length)
"..." means you can pass all the
recommend you avoid using common function names as variable names)
If you do need to test elements for zeroes, though, note that '==' and '!=' are
not usually recommended for comparisons with zero owing to finite numerical
representation. So that may well be unwise. See the N
b="")
barplot(height = df$Percent[df$Sex == "Males"], add = TRUE, axes = F,
col="#f8bb85", ylab="",
names.arg=c("18-29", "30-44", "45-59", "60+"))
axis(side=2, at = seq(-35,35,by=5),
labels=format(abs(seq
> -Original Message-
> (yw <- format(posix, "%Y-%V"))
> > # [1] "2015-52" "2015-53" "2016-53" "2016-01"
>
> Which, after checking back with a calendar, would give me reason to believe
> that it using %V does in fact seem to work: it's an input to `format()` and R
> doesn't seem to ignore
Apologies for posting a possibly package-specific question, but I'm not sure
whether this is an R or rstan ussue.
Running rstan under R 3.1.1 in windows 10 I get the well-known error
"Compilation ERROR, function(s)/method(s) not created!
C:/Rtools/mingw_64/bin/g++: not found"
The cause on my sy
ot factors. You will
then get a numerical gradient for each factor instead of a single offset for
each upper level. That isn't really what Placket and Burman had in mind, so I
would not normally start with a P-B design if I wanted to do that. Consider a
response surface model instead.
S
NA)
>
plabor
A slightly more compact variant that avoids the intermediate 'vals' variable is
to apply an anonymous function that does the check internally:
plabor$colD <- apply(plabor, 1, function(x) if(all(is.na(x))) NA else prod(x,
na.rm=TRUE))
S Ellison
***
> I have data set contains one variable "*Description*"
>
> *Description** Category*
>
> 1. i want ice cream food
> 2. i like banana very much fruit
> 3. tomorrow i will eat chick
> Now, how can I add a third column name to that empty df?
You could use functions that generate zero-length objects. Examples:
df$newv <- vector(mode="numeric") #logical by default, so <-vector() would give
you a zero-length logical
df$newi <- integer()
df$newf &
actor, '<-') can use.
*though plenty of reason to warn of unexpected consequences if not, of course
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
om the information you have given.
But in general, subscript errors in a function are often caused by the user
(you) supplying the wrong object type or an object with incorrect dimensions.
So you could start by making sure w.mt is what cosine() expects.
class(w.mt)
dim(w.mt)
str(w.mt)
coul
>From 'An introduction to R' in the html help system:
"If you just want to run a file foo.R of R commands, the recommended way is to
use R CMD BATCH foo.R. "
There is also a short section on 'Invoking R under OS X' in the 'Introduction
to R'; it may
whether couched in terms of count of residuals - is simply to make sure
that you have more independent data than variables when seeking a unique
numerical solution by non-linear least squares. If you don't you'll get
non
lued solution for all of x, y and z.
Are you quite sure that that is what you _meant_?
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
R-help@r-pr
f the answers here, though, I'm sure
that would be appreciated.
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
ic.
But if you must, is there any reason you can't divide the first row by (say)
1000, barplot normally with axes=false, and then put an explicit axis up each
side with something like
axis(2, at=seq(0,3, 0.5), labels= seq(0,2500,500)) ) #first row axis, left
column
axis(4)
S Ellison
> If you are concerned about missing levels -- which I agree is legitimate --
> then
> the following simple modification works (for
> **factors** of course):
>
> > d <- factor(letters[1:2],levels= letters[1:3]) d
> [1] a b
> Levels: a b c
> > f <- factor(d,levels = levels(d), labels = LETTERS[3:1
testseq<=4,'x',testseq)
will return four 'x's and then - because R has to coerce everything to a single
type - character representations of numbers 5:20. That will not then respond
well to subsequent numeric comparisons ...
S Ellison
**
> Well, I think that's kind of overkill.
Depends whether you want to recode all or some, and how robust you want the
answer to be.
recode() allows you to recode a few levels of many, without dependence on level
ordering; that's kind of neat.
tbh, though, I don't use recode() a lot; I generall
27;, while also mapping
> system missing values to system missing values?
You could look at 'recode()' in the car package.
There's a fair description of other options at
http://www.uni-kiel.de/psychologie/rexrepos/posts/recode.html
S Ellison
**
> In other words, try to mislead CRAN.
Well, no. The thought was that if CRAN has agreed an exception, as Uwe had
indicated, you might want a simpler way of maintaining it than discussing it on
every update.
I can see that that would sidestep an enforced regular review, though.
Keep up the g
here the method of subtracting one? Why
> > does subtracting one mean that the (Intercept) term disappears?
See above; '-' _in a formula_ means 'remove the following term'
Following that consistently, if there's a weirdness there, it's that ~0+x works
t
> > Works like a charm, thanks! Still don't know what that error message
> > means though. Any idea?
You tried to negate a character string.
-"601"
'-' can't do that.
[-x] relies on negative _numbers_ to remove elements, not on separate
i
> How can I get the axis numbering and labels to not overlap? I could also
Try specifying las=2 in your plot command?
See ?plot.default and ?par
S Ellison
***
This email and any attachments are confidential. Any use...{{droppe
l reading for
what you are trying to do.
See also the Note and examples in ?"==" which are also essential reading for
comparisons involving floating point numbers; also FAQ 7.31.
S Ellison
***
This email and any atta
> Do you mean that the red line is a regression line?
> Why is the regression (line) weighted?
I suggest you look up 'locally weighted regression' to find out why that is
useful and what it is for.
***
This email and any attachmen
> Heyy I want to apply LASSO method in AFT model. So can you guys please help
> me by sending R code for that.
Try
help.search("LASSO")
or
RSiteSearch("LASSO")
or Google "LASSO method in AFT using R"
> I have one question that how we add one or more outliers in the data set.
See ?c to add values to a vector.
S Ellison
***
This email and any attachments are confidential. Any use...{{droppe
ments to ?plot.lm, which uses panel.smooth
as a panel function.
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
R-help@r-project.org mailing li
ention to the meaning of negative indices (like '-n' in
dd[-n,])
S Ellison
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of susmita T
> Sent: 16 September 2016 13:09
> To: r-help@r-project.org
> Subject: [R] Query to find
re listed in ?attach). attach()is only sensible if you have already completed
all the manipulation needed on the attached object first. Even then, using
with() is safer.
S Ellison
***
This email and any attachments are confidential. Any
rature above).
Not quite enough information here.
If we called
func2(30, 298, 23)
which has an arbitrary third argument, what would you like to happen to the
third argument? And a fourth, fifth and so on? Something consistent for all
arguments, or something different for each depending on i
of 1.0. Dividing by n would imply
incorrectly that individual events have become less probable as the number
increases.
The result you have obtained is what is supposed to happen.
S Ellison
> > p <- runif(50)
> >
> > p
> [1] 0.08280254 0.08955706 0.19754389 0.52812033 0.68
t and use something like
gIntersection() from rgeos or intersect from raster (see
http://gis.stackexchange.com/questions/140504/extracting-intersection-areas-in-r)
S Ellison
***
This email and any attachments
hat legitimate mailing lists exist.
Presumably other email filtering products could be doing the same.
S Ellison
*To be fair to the product**, an email report is available - if you go to the
relevant web portal and manually request it. Of course, the only reason you'd
do that is if you know
> Is there a function in R which calls the code behind a function?
Type the function name without the brackets.
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
Stata's documentation lists this as a meta-analysis tool.
You may want to look at the rma function in the metafor package for various
approaches to that problem.
S Ellison
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Carlos R.
>
1 - 100 of 662 matches
Mail list logo