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
> 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
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
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
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
> 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
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
> 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
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
)
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
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
> -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
> 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
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
> 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
>
> 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
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
*
> I want to keep only the part inside the two points. After lots of headache
> using grep() when trying something like this:
>
> grep('.(.*?).','df.subject_test.RData',value=T)
>
>
> Does anyone have any suggestion ?
gsub("df\\.(.+)\\.RData", "\\1", 'df.subject_test.RData')
Steve E
***
> -Original Message-
> > x<-"/mnt/AO/AO Data/S01-012/120824/"
>
> I would like to extract "S01-012"
> gsub("/mnt/AO/AO Data/(.+)/.+", "\\1", x)
#does it, as does
> gsub("/mnt/AO/AO Data/([\\w-]+)/.+", "\\1", x, perl=TRUE)# \w is perl RE;
> the default is POSIX, which would be.
>
> We are currently trying to migrate 3 users of "R" to a citrix based
> environment, but are coming across major issues trying to install the
> packages to the relevant image.
Why can't you open a virtualised OS instance, install and start R in the normal
way, install the packages normally in R
> If I want to divide the column of a matrix by the sum of the column, should I
> loop over the columns or can I use apply family?
Looping's unnecessary.
See ?scale or ?sweep, with ?colSums for two non-looping answers; apply() also
works if you give it a suitable function argument.
S
**
Inability to access a repository index is very often an indication of a failed
internet connection from R. In Windows that is often a result of incorrect
proxy settings or other internet connection settings. The R Windows FAQ, 2.19
("The Internet download functions fail") may have the answer...
> > Is there an easy way to check whether a variable is within +/- 10%
> > range of another variable in R?
You could use
2*abs(A-B)/(A+B) < 0.1
which avoids an apply().
I've assumed you meant different by under 10% of the mean of the two, hence the
2/(A+B); if you meant 10% of something else, s
C and R code for pt and qt in R (the cumulative probability distribution and
the inverse, quantile, function respectively) is available in the R source
code, which you can obtain from CRAN; see
http://CRAN.R-project.org/mirrors.html - see the source code link from any of
the listed mir
Keith Jewell said:
> ... from reading ?all.equal I would have expected
> scale = 1 and the default scale = NULL to give identical results for the
> length
> one numerics being passed to all.equal.
>
> Can anyone explain?
Inspectng the code in all.equal.numeric, I find
xy <- mean((if (cplx)
nd then
> earima(lh, order = c(1,0,0)) #First example from arima
#Returns (or at least displays) ...
Welcome to the new Arima!
Call:
Arima(x = lh, order = c(1, 0, 0))
Coefficients:
ar1 intercept
0.5739 2.
environment from one object directly
to another object.
This kind of thing is exactly what makes watching R-help so worthwhile.
S Ellison
***
This email and any attachments are confidential. Any use...
> I'm stuck trying to begin an axis label in ggplot with a superscript.
For a crude work-round, you could try
ggplot(mydata) +
aes(x = x, y = y) +
geom_line() +
ylab(expression(paste(' '^{14}, "C&qu
> Thanks Joshua and Sven - I completely forgot about which() .
Also
na.omit(p[p<=0.05])
#and
p[p<=0.05 & !is.na(p)]
S.
***
This email and any attachments are confidential. Any use...{{dropped:8}}
> I want to plot( 11:20 ) in a plot.
> if i just type the code above, the y value will be from 11 to 20, now i
> want the
> value from a given range like 0 to 40, how can i do it?
See the ylim= argument to plot.default; eg
plot(x, y, ylim=c(0,40))
Also look at ?par and note that plot() and
> But i use a<-10/b , b is some value ,may be 5, maybe 5.5
If you do floating point arithmetic on integers you'll usually get floating
point answers, including the 5.0.
See FAQ 7.31 for the usual floating point problem, and ?all.equal for the usual
answer to it. You could see if a result is cl
all.equal, which is documented on the help page
you were referred to.
S Ellison
***
This email and any attachments are confidential. Any use, copying or
disclosure other than by the intended recipient is unauthorised. If
you hav
> 3. all.equal(a, as.integer(a))
Closer, but be aware that all.equal will not always return TRUE or FALSE and -
more importantly - as.integer truncates towards zero and does NOT generally
round to the nearest integer.
a <- 4 - sqrt(2)^2 #Analytically 2
all.equal(a, as.integer(a))
# [1] "Mean re
ubstr(x, 9,12),
Precipitation=as.numeric(substring(x,13)))
}
decode.lst(lst1Sub)
S Ellison
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Zilefac Elvis
> Sent: 22 October 2014 16:38
> To: R. Help
>
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf Of Clint Bowman
>
> ?read.fortran
Also read.fwf if it's in a file.
S
***
This email and any attachments are con
title). Don't miss out section 10.7,
"Scope"; it's important, but follows 'advanced examples' which are less
important for a beginner.
After that, Google.
And after that, R-help again.
S Ellison
***
acter representation depends only on how much you decide to
round when converting to character format. That is essentially arbitrary, so
any games you play with conversion to character are just telling you how many
digits you decided to round each number to, not how many there were to start
with
> I want to change R-3.1.1 to the default, so that when I type which R, I get
> /usr/local/R-3.1.1
Change your PATH to include the R 3.1.1 directory instead of the version 2
directory?
S
***
This email and any attachments are
> A solution on the link below provides the steps of updating R without losing
> packages in Unix.
> http://zvfak.blogspot.se/2012/06/updating-r-but-keeping-your-installed.html
>
> How could I do that on windows 7 platform?
See the R Windows FAQ, FAQ 2.8.
***
> I have already tried options(max.print=99) but does not show the desired
> result.
> As posted above it want to share the outcome with the business owner where
> there could be multiple entries.
Then just print the multiple entries. See ?duplicated for finding them
Otherwise, use things lik
, 50))
xyplot(y~x|parts, data=dati,
panel = function(x, y, ...) {
panel.xyplot(x, y, ...)
panel.segmented(x, y, ...)
}
)
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
_
panel.xyplot(x, y, ...)
panel.segmented(x, y, ...)
}
)
#And just to see if it works for panel-grouped data:
set.seed(1023)
dati$parts <- sample(gl(2, 50))
xyplot(y~x|parts, data=dati,
panel = function(x, y, ...) {
panel.xyplot(x, y, ...)
panel.segmented(x, y,
xact command you used above. If you used a different plotting
system for the bar plot the alignment would be very hard to guarantee, so stay
with base graphics for both.
S Ellison
***
This email and any attachments are confiden
ately clear why you’re looping. grepl returns a vector of
logicals; you have a vector of character strings. Consider replacing 'if'
constructs with 'ifelse' - albeit a complicated ifelse() - and doing the whole
thing without a loop.
S Ellison
**
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Luigi
> Marongiu
> if I have a sample set of the following numbers x1=0.09, x2=0.94, x3=0.48,
> x4=0.74, x5=0.04 I can calculate the variance easily.
Not without concatenating them into a vector, you ca
t from
" amet is not the only instance of 'amet', and there is more than one instance
of 'instance', 'is', 'of' and 'and'."
S Ellison
***
This email and any attachments a
*x) + sin(w*x) to get alpha and beta, and hence
a and p. Those values could then be used as starting values for optim or
similar.
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
_
> Could you please explain about
>
> sub("^([0-9]*).*$", "\\1", fields)
See ?regex and the extensive online literature on regular expressions.
S Ellison
***
This email and any attachments are confid
If it's not what you meant, you'll need
to provide the picture.
S Ellison
***
This email and any attachments are confidential. Any use, copying or
disclosure other than by the intended recipient is unauthorised. If
you
E,...){
x<-subset(x,subset)
do.call(type,list(x=x[[var]],...))
}
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
R-help@r-projec
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of debra ragland
> via R-help
> some sample data
> p<-matrix(c(rep(c(F,T,F),3), rep(c(T,F,T),3), rep(c(T,T,F),3),
> rep(c(F,F,T),3)))
i) Something wrong with p, here; it's a single column matrix. did you mean
p4<-matrix(c(rep(c(F,T
se in optim() - is pretty much
completely different from MCMC using a Gibbs sampling algorithm
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
Meeting2", "Meeting3", "Meeting4","Meeting5")
>
> and have gotten a '+' at the end meaning I am missing something.
You are missing the closing bracket on the boxplot() command.
Just finish with a ')'
S Ellison
**
> It is clear that a ) although is a type of bracket it is called a
> parenthesis, just as ,
> is called a comma, which is a type of punctuation mark.
These things are called parentheses because of what they do, not what they are.
A parenthesis is any word or phrase inserted as an explanation or
> I want to get the table like "output". Any possibility to get it in R?
What do the rows represent in 'output'? Places? Times? Individuals?
What do the numbers in the table relate to? Individual bird identifier? Number
of birds?
th names of the right format.
I() wrapped round a matrix or data frame does nothing like what is needed if
you include it in a data frame construction, so either things have changed
since the tutorial was written, or the authors were not handling a matrix or
data frame with I().
S Ellison
**
s's names method:
names.eem <- function(x, ...){ "AnotherName"}
str(test1)
# List of 1
# $ AnotherName: chr "justaname"
# - attr(*, "class")= chr "eem"
So it isn't your '<-', it's because you overrode 'names'
S
#x27;meanness', no-one
has yet pointed to Trey Causey's analysis of R-help's alleged meanness at
http://badhessian.org/2013/04/has-r-help-gotten-meaner-over-time-and-what-does-mancur-olson-have-to-say-about-it/
Up to 2013, it was apparently getting
df[order(df[,"x"]),]
or
df[order(df$x),]
And just to prevent yet more confusion, you might also want to avoid 'df' as a
name. 'df' is the function that returns the density of the F distribution ...
S Ellison
***
f the closest Latitude/Longitude pair to your GPS location?
And once you have the distances you could use order() or rank() to pick the top
5 (maybe using head()) or just rank() on the distances.
And once you've picked a set you can still additionally check whether a
location was within the box.
S
Apologies if I've missed a post, but have the default treatment of posts and
reply-to changed on R-Help of late?
I ask because as of today, my email client now only lists the OP email when
replying to an R-help message, even with a reply-all, so the default reply is
not to the list.
I also noti
r calculations).
I wouldn't exactly call it statistics - it's based on recommendations for
measurement science and they assume a pretty simple deterministic model and
that has little or nothing to do with model fitting and inference.
S Ellison
> -Original Message-
> From: R
Does
do.call('cbind', list_of_dataframes)
do what you want?
S Ellison
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Wolfgang
> Waser
> Sent: 09 February 2016 09:03
> To: Dénes Tóth; r-help@r-project.org
> Subject:
ation matrix, if you want to see how
closely individuals are associated, but correlation is a possible step on the
way.
S Ellison
***
This email and any attachments are confidential. Any use, copying or
disclosure other than by the in
rp1 <- as.character(nwCorp1) ?
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
c(NA, NA, letters[1:5]) )
you can do things like
x[is.na(x)] <- "Empty Space"
x
or
x[is.na(x)] <- ""
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
27;, paste(names(dfr[1:20]),
collapse="+")))
)
test.FN(scope=scope)
}
test.step(X.des, Y)
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
ample, to sort by the first column of a matrix mm:
oo <- order(mm[,1])
mm[oo,]
order() also takes multiple sort fields so can sort by several columns
simultaneously (eg sort by first column and within that by third column etc)
> > What I need is this:
> > [[1]]
> > [1] 1 2 3
> > [[1]]
> > [2] 1 2 3
> > [[1]]
> > [2] 1 2 3
Try
rep(list(1:3), 3)
S Ellison
***
This email and any attachmen
between two and
only two groups. Your files seem to have more than two years, which - at least
until my telepathic inference improves - seems likely to cause a problem for
t.test and var.test. Perhaps you were looking for pairwise.t.test?
S Ellison
***
inomial family is allowing for overdispersion and stata is not.
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 m
Is there a reason not to use the convex hull for area calculations? Any curve
you put through the points would surely be at least as arbitrary as a straight
line.
S Ellison
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Alexander
> Shenk
> Are you aware of any function what would query the original function call
> arguments no matter what happens in the function?
Use missing() first.
If you can't use missing() first, or use it early in a parent function and pass
a flag, you could perhaps pass a copy of the parent function call t
E, ...)
}
lapply(names(cl), Write, x=cl, filename="myclust.txt")
(Ignore the NULLs returned)
Anything more structured than that and you'll have to write a write.kmeans
replacement for write that structures the results as you need them later.
S Ellison
rdinates for each cluster. If you assign that list to an object you can then
write a separate function to format and write out the coordinates and use
lapply to run that on the list. Or you can include formatted write calls in the
by.index function, writing to a file as before.
ction from glm comes up, there's a
strong likelihood that someone will point out that the covariances are not
necessarily sufficient for reliable confidence intervals on prediction (and
look! that just happened). You might want to hunt around for more authoritative
comment on that if the intervals/st
> Apparently, abs(1 - 0.95) is not equal to 0.05, which I find however quite
> disturbing.
It's normal.* See R FAQ 7.31 in the html help system.
S Ellison
*... and common to all computers that use binary.
***
This em
> I want to write the inside function (3^(x[i]+x[j])) in a more condensed form
> cause this will help me when the multiple summations are more than two
indices<-c(i,j) #or whatever you want
3^sum( x[indices] )
S Ellison
***
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
**
> 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
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
**
> 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
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
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}}
__
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
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
>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
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
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}}
__
> 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 &
> 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
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
***
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
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
> -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
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
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
<- 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
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
>
>
Since the standard normal distribution goes to infinity in both
directions, you can't have random normal constrained to +-1.5.
You can have _truncated_ standard normal, though, if that's really what
you want.
+-1.5 is/are the normal quantiles at pnorm(c(-1.5,1.5)). So if we
generate 500 uniform
101 - 200 of 662 matches
Mail list logo