dy been referred to. You may also find aggregate() useful, as
it gives you back a data frame that includes the conditioning variables if you
tell it to. Alse ave, if you want to do something like mean-centring a data set
based on group means rather than t
> I am working with large numbers and identified that R looses
> precision for such high numbers.
Yes. R uses standard 32-bit double precision. See ?double in your R help
system. And welcome to finite precision arithmetic, which is a very widely
known issue in digital comuting ever since it w
You could use a variant of apply(), probably sapply
For example
d <- as.data.frame( matrix(sample(0:1, 200, replace=TRUE), ncol=5))
head(d)
sapply(d, table)
S Ellison
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Beha
gsub("(.{9}).+", "\\1", "31JAN2002:00:00:00.000")
or you could convert to date and reprint:
d <- as.Date("31JAN2002:00:00:00.000", format="%d%b%Y")
format(d, "%d%b%Y")
#albeit with lowecase month
All of those should work on vect
I was unable to run your code; 'fac' is missing and npk$fac in teh
interaction.plot returns NA.
> data(npk, package="MASS")
> fit <- by(npk, npk$block, function(bydata) fitted.values(lm(yield ~ N,
> data=bydata)))
> fit <- unlist(fit)
> interaction.plot(npk$N, npk$block, fit, xlab="N",
> ylab="y
> -Original Message-
> I have changed some code in R file inside the stats package
> (dendrogram.R).
That was brave. Others have already commented on its wisdom...
> Now I wan to test and run the stats package
> with the new updated code, what should I do in detail?
1. Read and foll
> Stats is a base package, so that won't work. Base packages
> are built and installed differently from other packages.
Dang! Of course it is. Scratch previous response.
The irony is that my first thought was indeed "Read 'R Installation and
configuration' with special attention to 'Building f
ing
to black. You are plotting only six lines all of which plot correctly as
black when I run the code because the first 6 values in the colour vector you
supply are all black.
If you want to plot 6 different colour lines, try, for example, col=1:6.
Hope that helps you clear things up!
S
>But I don't want to plot random colors.
>...
> That's why I have this vector with length 24 - each one matches one line in
> the "npk" dataset.
... which is not what interaction.plot, or matplot, needs; it needs one per
line on the plot.
>How can I inform to the interaction.plot function the co
> -Original Message-
> x<-dat.col
>
> Now, is there a function (or combination of functions) that
> will let me assign the character string "dat.col" to a new
> object (called y) without actually typing the characters
> "dat$col", i.e. just by referring to x?
Yes.
dat <- data.frame
the guess from th e
label values.
On the down side, nuritional components are likely to have very different
units, scaling and uncertainty so the weighting is going to be very hard to
justify. Ideally, I'd do this - if at all - on a nice large selection of
products I knew the answers fo
> I am trying to replace community numbers with community
> names (character).
> I am using the following code:
>
> data[data$commNo==786, "commNo"]<-"Name of the Community"
>
> Unfortunately, I get the error message
> missing values are not allowed in subscripted assignments of
> data frame
d so a pattern like "a^b"
> could never match anything.
... unless a or b are newlines and you are matching multi-line expressions,
when ^ and $ match before and after line breaks as well as beginning and end of
string.
S Ellison
*
> > I need a quick help with the following graph (I'm a lattice newbie):
> >
> > require("lattice")
> > npp=1:5
> > names(npp)=c("A","B","C","D","E")
> > barchart(npp,origin=0,box.width=1)
> >
> > # What I want to do, is add a single vertical line
> positioned at x = 2
> > that lays over the
der in which
labels are associated with factor levels and the (separate) values of contrasts
associated with those factor levels at modelling time.
The cost of that control is some complexity, and the time needed to learn
what's going on to use it all properly.
Hope that helps ...
S E
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of bsm2
> Sent: 23 January 2013 20:00
> To: r-help@r-project.org
> Subject: [R] Pasting a list of parameters into a function
>
> I need to repeat a function many times, with diff
ng only over
the remaining parameter, y
That looks awfully like what you seem to want, with no change to your negative
log-likelihood function at all.
S Ellison
***
This email and any attachments ar
> -Original Message-
> I'd love to write a code that would allow me replace the example code:
>
> fit1F <- mle2(LL, fixed=list(xhalf=6))
>
> with something like:
>
> var<-xhalf
> val<-6
>
> fit1F <- mle2(LL, fixed=list(var=val))
>
> or
>
> var<-c("xhalf","=")
> val<-6
>
> fit1F <- ml
> I've checked my iteration loop with other dataset, i've not
> problems with integer numbers or other dataset with decimals
> but not all decimals dataset.
Any R data set that is 'not all decimals' will be represented internally as
floating point* (eg c(1, 2, 3, 1.5) consists of four floating
odified file, as will updating
R, so you'd essentially never know which version of the file you're using.
Using a modified copy, named differently and accessed via a different path that
is immune to updates is far safer.
S Ellison
> After applying the NLS for a model like y=exp(a*x), and I get
> a result showing the summary as:
> Estimate Std. Error t value Pr(>|t|)
> 2.6720 1.4758 1.811 0.3212
>
> My question is what this t-statistics tests? And what's the
> meaning of Pr?
t is (estimate/std.err) and can be us
Thanks, Ellison. Another question is if this p-value is a good parameter to
test if the fitting is good,
Absolutely not.
***
This email and any attachments are confidential. Any use, copying or
disclosure other than by the intende
On 8 Feb 2013, at 01:24, "Antonio Silva" wrote:
> # Two-sided p-value should be estimated with
> dt(t,summary(fit1)$df[2]) # isn't it?
No, on two counts.
>
First, dt is the density; you need pt, the cumulative probability, not dt.
Second, pt(t, ...) would calculate the one sided lower tail pro
On the same help page, it says "'RNGkind' is a more friendly interface to query
or set the kind of
RNG in use."
Try
RNGkind()
to see the currently selected RNG. The same function with kind= specified will
also change to another
S Ellison
> -Original Mess
n.zip <- ceiling(zip*n)
n.pois <- n-n.zip
sample( c( rpois(n.pois, lambda), rep(0,n.zip) ) )
}
#Example
rzip(50, 3.5, zip=0.5)
Having said that, I'd bet there's a package out there that already does it
better...
S Ellison
>
>
>
&g
ee ?DateTimeClasses for a lot of information on
dates and times, and (probably) ?as.POSIXct for changing something in seconds
(as the Examples say, 'a large integer') into a date-time class which you
should be able to conv
> -Original Message-
> I hava some questions about R and other "softas".
> Which applications (softas) I can use with R? Can I connect R
> with Microsoft? Can I connect R with SPSS and how I can do it?
Information on transferring data to and from other systems can be found under
"Impo
scope. You probably don;t have a
writeable directory called "base"
Try
testInstalledPackages(scope="base",errorsAreFatal=FALSE)
S Ellison
***
This email and any attach
> Should I create an output directory somewhere either in Program Files where
> R is installed or in my working directory?
If I wanted to create a writeable test directory I'd put it in my own
workspace, not the program files space.
But why do you think you need to create an output directory?
coefficient.
effects() is doing somethig quite different; the help page tells you what its
doing mathematically. It has an indirect physical interpretation: for simple
designs like this, effects() output for the coefficients comes out as the
coefficient multiplied by sqrt(n), w
a cpu core/thread
> fully occupied forever.
> 64 bit R with 16GB RAM on Win7 64, i5 cpu should be capable.
> So if anyone knows the reason, that will be appreciated.
> Thank you for any advice.
>
A look at the ?read.table section on 'memory usage' may help.
In par
On 12 Mar 2013, at 20:45, "Peter Ehlers"
mailto:ehl...@ucalgary.ca>> wrote:
Cool. I didn't know dingos had kidneys. I thought they just ate kids.
That would be the Australian ones, at least allegedly.
The canonical UK reference to the cited anatomical features is Adam
> My question: what does it mean asymmetry distribution could
> affect PCA ? and also outliers could affect factors?
It means what it says. PCA will be affected by asymmetry and outliers will
affect the principal components (sometimes loosely called 'factors') In
particular an extreme outl
not of length length(x)
low.comp <- if(closed[1]) "<=" else "<"
high.comp <- if(closed[2]) ">=" else ">"
do.call(low.comp, list(lower, x)) & do.call(high.comp, list(upper, x))
}
#Examples
within
> There _is_ a function ?within.
Drat! of course there is. I even use it, though not often.
> Maybe your function can be
> named 'between'
Good thought - thanks
Steve E
***
This email and any attachments are confidential. Any u
lim=c(0,100),
> xlab="MRA diagnosis", ylab="Predicted probability (%)")
Add yaxp=c(0,100,20) to your boxplot call.
See ?par for what this means.
S Ellison
***
This email and any at
> -Original Message-
> 1) Is there a way to implement such calls to external tools,
> so they become platform independent? I mean, so that these
> calls will work both on a *nix and a Windows system?
No - at least, not generally, for the more or less obvious reason that *nix
tools are
> > 2) Is there a way to generate platform independent paths? So that
> > "path/2/input.tbl" on *nix systems becomes "path\2\input.tbl" on a
> > Windows system?
>
> R already does that automatically.
Clarification. R does that automatically _for paths used by R_ (including, on
my system, the
>Error in integrate(fx[[2]], 0.056, 1) :
> maximum number of subdivisions reached
>
> Can anyone help?
At the risk of longer integration time, look at the 'subdivisions' argument in
?integrate and consider inc
the same directory as scripts. Consider web log analysis
for one - why would the script be in the server-writeable log file directory?
S Ellison
***
This email and any attachments are confidential. Any use...{{
>
> My concern is with the reported proportions of variance for the 3
> components after varimax rotation. It looks like each of my 3 components
> explains 1/15 of the total variance, summing to a cumulative proportion
> of 20% of variance explained. But those 3 components I retained should
>
>> I have a data file 'stop' to be scanned in
>> R.
>> But I want to ignore one specific number '21' there. Putting differently,
>> I
>> want to get all numbers in the file except 21. Is there any command to
>> achieve it?
>>
See the na.strings argument to scan, and note that it can be a vecto
clients make it possible to transfer files, which can help if you want to save
files at the linux end Nd then transfer to windows.
S Ellison
***
This email and any attachments are confidential. Any u
> I would like to use predict.lm to obtain a set of predicted
> values based on a regression model I estimated.
>
Do you want predictions - which will always be the same - or randomly
distributed data that is based on the model prediction plus random error?
*
shell doesn't work, consider, for example, openPDF from the Biobase package
And you could use any search engine to search for "display jpeg in R" or
"display PDF from R" or "import image into R" and so on.
S Ellison
trix: lu itself does
not return the simple form you might expect from the usual literature LU
decomposition for a tridiagonal matrix)
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
___
it can;t handle them.
The help file doesn't say what as.table doesn't do, perhaps because the list
would be quite long. It would have headed off this post, though, if it
mentioned that the default method accepted only a table,
> as.table(dat1)
> #Error in as.table.default(dat1) : cannot coerce to a table
You _can_ coerce to a matrix first:
as.table( as.matrix(dat1) )
S Ellison
***
This email and any attachments are confidential. Any use...{{dro
> -Original Message-
>> How do I find and remove the two duplicate rows?
> Try ?unique()
See also ?duplicated and consider the usage
d[ !duplicated(d), ]
where d is your data frame. But read the 'details' part of the help page
ill the gaps?)
There are several imputation packages about; look up 'imputation in R' to get a
selection.
S Ellison
***
This email and any attachments are confidential. Any use.
the mean. huber in MASS and huberM in
robustbase are often appropriate for that kind of situation.
If the extreme values are not known to be unreliable, see previous posts...
S Ellison
*Reverence for data is fundamental, but that doesn't mean being blind to the
apparently limitless number
ous as unusually large values, you probably should have
set the bounds differently.
Try taking logs and see if that gives you a more or less symmetric
distribution?
S Ellison
***
This email and any attachme
#Returns a list of vectors of locations of each word, sorted
alphabetically
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
R-help@r-project.
> One might wonder if the "Excel error" was indeed THAT or
> perhaps a way to get the desired results, give the other
> issues in their analysis?
The prior for the incompetence/malice question is usually best set pretty
heavily in favour of incompetence ...
S
*
> From a quick read, the Excel error prior for incompetence
> looks high but some of the other issues hint that the prior
> for the overall findings was remarkably in favor of malice.
That's p(malice|evidence), not p(malice); surely that must be the posterior? ;-)
'tain't a great advert fo
> I have run a regression and want to calculate the likelihood
> of obtaining the sample.
> Is there a way in which I can use R to get this likelihood value?
See ?logLik
And see also ?help.search and ??. You would have found the above by typing
??likelihood at the command line in R
> - the mean-> mean(x)
> - the uncertainty on-> std.error(x) ? Or sd(x)?
> - the standard deviation of x -> ?
> - the uncertainty on the standard deviation -> ?
>
> Anyone has an idea?
1. Use R's help system to look up 'standard deviation' and 'mean'
e.g.:
??'s
hen tells you that you have a missing value where you need either TRUE or
FALSE.
Play with
num!=NA #returns NA
and
if(NA) "Not there" #returns error
is.na() returns TRUE for NA's, so 'if' knows what to do with the answer.
S Ellison
ns ( if V2 were correctly numeric) you
could try
boxplot(V2~V1+V3, data=Daten)
S Ellison
From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of
maggy yan [kiot...@gmail.com]
Sent: 11 May 2013 16:40
To: R-help@r-project.org
Subject: [R
ts really weird because I don't think that I separated the sex in the codes
> above
Look again; the boxplot is clearly distinguished by sex.
Try
means<-tapply( Daten$weight, interaction(Daten$Dosis,Daten$sex, drop=TRUE),
mean)
S Ellison
Or cast to vector:
> set.seed(28)
> x<- sample(1:40,20,replace=TRUE)
> qx<-quantile(x,probs=0.10)
> qx
> #10%
> #3.8
> as.vector(qx)
> #3.8
***
This email and any attachments are confidential. Any use...{{dropped:8}}
0
> > [9,] 22 22 19 7
> > [10,] 30 20 5 22
> > [11,] 2 12 24 15
> > [12,] 5 21 13 22
> > [13,] 23 17 28 3
> > [14,] 1 7 24 14
> > [15,] 12 15 8 8
ifelse( apply(mx, 1, function(x
he calculation is
http://www.itl.nist.gov/div898/handbook/eda/section3/eda35a.htm
if you followed that, you would find that 356 turns up somewhere important ...
A clue: It is unlikely to be coincidence that you have 358 data points in 2
groups and that the 356 turns up in the column headed "Df" in th
> -Original Message-
> It may be helpful not to worry about the technical details,
> just to look at the source code defining the function: if it
> is defined in a place where a variable can be seen, it can
> see that variable.
I too find R's lexical scoping rules straightforward.
H
> > I too find R's lexical scoping rules straightforward.
> > However, I'd say that if your code relies on lexical
> > scoping to find something, you should probably rewrite your code.
>
> Except of course that almost every function relies on lexical
> scoping to some extent!
This could get m
> I am trying to do some D o E. I would like to find
> the optima
> (maxima) of a 2 dimensional lm with quadratic terms.
> I'm sure there is a really simple solution but i can't find it.
At least part of this problem is solved by the rsm package; that fits a
quadratic response surface
> -Original Message-
> I have a list with gene names, fold changes (=expression
> level) and chromosomes.
>
> Names fold change chromosome
> hz 1.5 2
>
>
> If I plot fold change versus chromosome (or vice versa):
>
> plot (ch, fc)
>
> I see only the chromos
t a smoother through; gene ID is usually categorical. To be
sensible you'd need some continuous quantitative x- and y- coordinates.
S Ellison
***
This email and any attachments are confidential. Any
See R Faq (http://cran.r-project.org/doc/FAQ/R-FAQ.html) with particular
attention to FAQs 7.31 and 9.1 paragraph 3.
Essentially, computational precision is finite.
S Ellison
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org]
l fractional factorial design toolkit.
Something tells me you won't get a balanced 2x2x2x2x3 fractional in 16 or fewer
runs though. I think 18 is possible.
S Ellison
***
This email and any attachments are confidential. Any
nced' in as much as the 3-level factor does not have
all levels equally represented) will behave adequately for a conjoint analysis
I'm afraid I can't say.
S Ellison
***
This email and any attachments are confidential. A
> cool, im none the wiser now, but thanks anyway
That would be because your IT questionnaire requires telepathy to understand
what the writer wanted to know.
My take on these, in case it helps:
1. Is R a Clientsoftware / Serversoftware / Systemsoftware?
R can run both on a client or on a serv
tely, so a warning is
issued."
Could that be the situation you are in? If it is, it's not the new data that
causes the problem, but the original fit.
S Ellison
***
This email and any attachments are conf
> I'm new to this and struggling away with ggplot. I need to
> plot some line graphs for about 4 series. I have the values
> to plot and also the value of the standard error of the
> value. Is it possible to plot the standard error bars when
> the value are already calculated as opposed to
> How to make R write out:
>
> Balance = 2 + 3 * IntGDP + 5 * IntUnemployment + 0.3 * d1
>
> from the table below:
>
> Balance Intercept IntGDP GDPNum IntUnemployment
> IntInflationd1 d2 d3
> 3 2 3 5
> 0.3 0
reason it should give the same result.
And it often - quite correctly - doesn't.
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
R-help@r-proj
aphics) 3-D plot at
http://streaming.stat.iastate.edu/~stat506/notes/ordkrigeexamp.pdf
S Ellison
> I'm completely new at R... I have sinkhole survey data (lat, long, and
> elevation) and have been trying to plot a rotatable 3d plot
> for several hours... cannot get it right. Examp
> I keep getting this "Error in x^2 : non-numeric argument to
> binary operator"
> using multiple different codes, ones which have been verified
> to work by my professor and other students.
I confirm the previous poster's lack of error in running the code supplied. I
also agree that something
> If I use a nested ifelse statement in a loop it takes me 13
> minutes to get an answer on just 50,000 rows.
> ...
> ifelse(strataID[i+1]==strataID[i], y<-x[i+1], y<-x[i-1]))
maybe take a closer look at the ifelse help page and the examples?
First, ifelse is intended to be vectorized. If you
> What does the sudden appearance of "Contacting Delphi
> ..the oracle is unavailable.
> We apologize for any inconvenience." mean? A bug? It appears
> at plotting.
If you have an ordinary plot command, that is very strange indeed. It's a help
message ... of sorts*. It should be no more li
> I get this error : " Error in file(file, "rt") : cannot open
> the connection"
>...
> saspath="\"C:/Program Files/SAS/SASFoundation/9.2",
I don't know the package but your saspath only contains one quote mark, so you
have given it "C:/Program Files/SAS/SASFoundation/9.2 to open. W
I agree completely; bquote is a neat way of doing the job.
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
R-help@r-project.org mailing list
https
c(a, b)
g <- factor( rep( letters[1:2], c(length(a), length(b) ) ), )
summary( aov(y~g) )
Since this is a one way problem the type of SS won't matter, but in other cases
it would be crucial to at least understand why - and to what extent - anova can
be unsafe* on unbalanced data.
S El
> I'd greatly appreciate your help in making a bar graph with multiple
> variables plotted on it. All the help sites I've seen so far only plot 1
> variable on the y-axis
> ...
>
> I've spent several hours looking for code to do this but didn't find
> anything. I'd use the Excel graph except that
> You typed a ` without closing it:
> barplot(xtab(`profits`,data=Forbes2000))
>
> anyway: pushing the escape button should also return you to
> the R-prompt (at least on a Windows platform)
But why is the OP using a backtick at all? It's not necessary in this instance
(and in fact it's ver
ons zoo for RollingMeans, TTR for MovingAverages, forecast for ma
and a possible solution using filter. One of those might help.
S Ellison
***
This email and any attachments are confidentia
etc so you will need to use
those names in ggplot.
Steve E
>
>
>
> On Wed, Oct 24, 2012 at 11:22 PM, S Ellison
> wrote:
>
>
>
> > I'd greatly appreciate your help in making a bar
> graph with multiple
> > variables plotted on
Hmisc and sfsmisc but I don't know whether either of those the one you
were looking for; you'll have to go back to your code to see which library it
used to load.
S Ellison
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.o
A look at the R data import/export page supplied in the R HTML help system (see
the link at top left) says that stata files are handled by the foreign package.
S Ellison
From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of
different from zero.
S Ellison
From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of
Houhou Li [lidar...@yahoo.com]
Sent: 28 October 2012 23:55
To: r-help@r-project.org
Subject: [R] Why are coefficient estimates using ML and REML are
> I tried:
> which(3ddata==x) # 3ddata is name of data set, x is the observed extreme
> value But this couldn't help me.
You'll need which(3ddata$long==x) if 3ddata is a data frame* with columns long,
lat, time, or something like 3ddata[ ,'long'] if it's a matrix with dimnames or
[,1] if just a
eck the file encoding
and set accordingly?
iii) See if the offending first character(s) can sensibly be stripped before
reading the file?
S Ellison
***
This email and any attachments are confidential. Any use, copying or
disclosure
isation, 0 iterations
> Return code 100: Initial value out of range."
>
> Dear sir how we give the initial value to estimate the parameters.
i) Avoid cross-posting; some folk get a bit snippy about that.
ii) read the help page for maxLik and look for an ar
icated model terms. For example, fac1+fac1/fac2 expands to
fac1 + fac1 + fac1:fac2 ... which reduces to fac1+fac1:fac2.
All this is specified in some detail in ?formula.
S Ellison
***
This email and any attachments are confidentia
par(mar)
Example:
windows() #or X11()
par(mar=c(6.5, 4,4,2)+0.1)
plot(1:10, xlab="")
axis(1, line=4)
Also consider using par(mgp) to get the axis labels a bit closer to the axis,
or using mtext() to place x axis labels.
S Ellison
**
> To start-with, how do I omit the axis label?
> I tried xlab=NULL in the plot command
NULL is the default for xlab (see ?plot.default, which probably gives most of
the information you need)
Try 'xlab=""' or xlab=NA.
S
***
This
iting for R-help answers; for example, Ted Harding's at
https://www.harding.edu/fmccown/r/ and the R Graph Gallery at
http://rgraphgallery.blogspot.co.uk/
S Ellison
***
This email and any attachments are confidential. Any use
(x, at=n+1) is the kind of thing you'd need to do.
S Ellison
***
This email and any attachments are confidential. Any use...{{dropped:8}}
__
R-help@r-project.org mailing
> I want to plot the legend for the following two lines:
> ...
> Any ideas how?
Try ?legend
S Ellison
***
This email and any attachments are confidential. Any use...{{
s...
#Example:
set.seed(1023)
x<-rnorm(200, 1e9)
# Compare
199*var(x)/200 #"Population" variance
#with
mean(x^2)-mean(x)^2
#Other seeds give differently wrong numbers.
#See FAQ 7.31 for why
S Ellison
***
This em
301 - 400 of 662 matches
Mail list logo