Displaying 20 results from an estimated 200 matches similar to: "Are loops handled differently in newer versions of R?"
2005 Mar 08
1
Multidimensional Scaling (MDS) in R
Hi;
I am working with the similarity matrix below and I would like to plot
a two-dimensional MDS solution such as each point in the plot has a
label.
This is what I did:
data <- read.table('c:/multivariate/mds/colour.txt',header=FALSE)
similarity <- as.dist(data)
distance <- 1-similarity
result.nmds <- nmds(distance)
plot(result.nmds)
(nmds and plot.nmds as defined at
2010 May 22
1
How to find all single minima, i.e. only each one within each next part of analyzed vector (table)
Dear R users,
How to find all single minima within each next part of analyzed vector (table)
Select all minima (mass_value=min & mass_value<2)
(many) in vector(table),
BUT first put mask on table in order to select
within one window mask (5 elements) only one local minimum, and next to search within
the next time window mask the second minimum (only one local along second mask)
2005 Nov 04
1
Stress in multidimensional scaling
Hello,
We are trying to find a function to compute "stress" in our
multidimensional scaling analysis of a dissimilarity matrix. We've used
"dist()" to create the matrix and "cmdscale()" for the scaling. In order
to determine the number of dimensions we would like to plot stress vs.
dimensions. However, we cannot find a pre-made command. It seems that
other
2003 Jun 30
3
if else statements in R
Hi, there
I am a grad student struggling to get my syntax right in a model I am
building in R.
I am trying to specify a variable,W, in a loop, such that on the first
iteration, it is equal to Wo, my starting value, which I have already
specified with
Wo<-9.2
On any other iteration other than the first, I want W to equal the
previous value of W in the iteration. plus an increment from
2002 Jul 11
2
Nested anovas in R not doing what they ought to...
Hi, there
I first sent this e-mail a couple months ago, to no avail.Since I am not a member on your mailing list, so could you please cc: a response to me? I'll be sure to check the list today for replies.
I am currently attempting to perform an ANOVA with both nested and normal factors. My problem is that R is treating my nested factors the exact same way as it would interaction terms.
2008 Jul 06
2
Issue with postscript figures using WinAnsi encoding
Hi there,
I've hit a bump in writing postscript files with special characters in
the WinAnsi encoding on a windows machine.
Here's some sample code:
###########################################
postscript(file = "test.eps", encoding="WinAnsi.enc",
width = 3, height = 5.5, onefile = TRUE, horizontal=FALSE, family =
"sans",
title =
2008 Jul 09
2
sorting a data frame by rownames
Hi there,
I'm sure there's an easy answer to this, and I can't wait to see it.
The question: is there an easy way to sort a data frame by it's row names?
My dilemma:
I've had to pull apart a data frame, run it through a loop to do some
calculations and generate new variables, and then re-construct the chunks
back into a data frame at the end.
Doing this preserves the row
2007 Feb 12
1
Trying to replicate error message in subset()
Hi, there
I am trying to replicate an error message in subset() to see what it is
that I'm doing wrong with the datasets I am trying to work with.
Essentially, I am trying to pass a string vector to subset() in order to
select a specific collection of cases (i.e., I have data for these cases in
one table, and want to select data from another table that match up with
the cases in the
2008 Jul 09
1
matplot help
Hi,
My question is how do I gain control over what values the X and Y axis show. Below is a sample plot I have made and want the X axis to represent a time vector with values taking the form Q1.60, Q2.60, Q3.60...Q1.90..etc...Currently the X axis starts with value 0 and increases by 1 through the end of the sample.
win.graph()
matplot(v.0,log.diff.v.6,type="l",lty=1, col=2,
2012 Feb 10
2
Regain play analysis patches
Hi all,
In the last couple of months, there have been two proposed patches for
the regain play analysis code.
The first by Nathan Rennie-Waldock:
http://lists.xiph.org/pipermail/flac-dev/2011-December/003070.html
simply adds some more higher sample rates.
The second by Earl Chew:
http://lists.xiph.org/pipermail/flac-dev/2012-January/003067.html
is more comprehensive. Neither of the
2008 Jul 15
2
extracting elements from print object of Manova()
Hi there,
Does anyone know how to extract elements from the table returned by Manova()?
Using the univariate equivalent, Anova(), it's easy:
a.an<-Anova(lm(y~x1*x2))
a.an$F
This will return a vector of the F-values in order of the terms of the model.
However, a similar application using Manova():
m.an<-Manova(lm(Y~x1~x2))
m.an$F
Returns NULL. So does any attempt at calling the
2004 Jul 29
1
Kudos to the R support team
Hi there,
I just wanted to take a quick second to thank everyone who maintains this
service- just in case you don't hear it enough, there are a plethora of people
who rely on this service (as evidenced by the help archives), and even if they
don't say it, are greatly thankful for what you do here. Not only are you
providing a service to people who are learning R, but indeed helping
2013 Mar 01
2
solving x in a polynomial function
Hi there,
Does anyone know how I solve for x from a given y in a polynomial
function? Here's some example code:
##example file
a<-1:10
b<-c(1,2,2.5,3,3.5,4,6,7,7.5,8)
po.lm<-lm(a~b+I(b^2)+I(b^3)+I(b^4)); summary(po.lm)
(please ignore that the model is severely overfit- that's not the point).
Let's say I want to solve for the value b where a = 5.5.
Any thoughts? I did
2007 Feb 01
2
Losing factor levels when moving variables from one context to another
Hi, there
I'm currently trying to figure out how to keep my "factor" levels for a
variable when moving it from one data frame or matrix to another.
Example below:
vec1<-(rep("10",5))
vec2<-(rep("30",5))
vec3<-(rep("80",5))
vecs<-c(vec1, vec2, vec3)
resp<-rnorm(2,15)
dat<-as.data.frame(cbind(resp, vecs))
2003 Jul 15
7
Excel can do what R can't?????
Hi there
I thought this would be of particular interest to people using 'optim'
functions and perhaps people involved with R development.
I've been beaten down by R trying to get it to perform an optimization on a
mass-balance model. I've written the same program in excel, and using the
'solver' function, it comes up with an answer for my variables (p, ACT,
which
2004 Jul 29
3
extracting the t-statistic: just the numbers, please
Hi, there
I am quite sure there is an easy answer to this, but I am unsure how to gather
a bunch of t-statistics in an organized format.
I am trying to generate a list of t-statistics for a randomization routine. If
I try to collect a bunch of t-statistics from a run, this is what happens:
> M <- 10 ; simt <- NULL
> for(i in 1:M)
+ {
+ perm<-sample(site,replace=F)
+
+
2003 Jul 01
2
strange error message
Hi, there
I have a loop that is producing data, but is also generating an error message
that I can't understand.
Here's the loop and the error message:
> bio<-matrix(NA, ncol=9, nrow=366)
> W<-NULL
> M<- length(Day) #number of days iterated
>
> for (i in 1:M)
+ {
+
+
+ if (Day[i]==1) W[i] <- Wo else W[i] <- (W[i-1]+(Gr[i]/Ef))
+
+
+ C<-
2007 Jan 23
1
How to evaluate an lm() object for generating warning statement in a function
Hi, there
I tried this post on R-help but did not generate any replies, so I thought
I might try the waters here since it's a more programming-based group.
I have written a function that will allow me to calculate the variance
components for a model II (random effects) single factor ANOVA (perhaps
this is
me re-inventing the wheel, but I handn't yet come across anything in R that
does
2003 Jul 08
2
specifying multiple parameter starting values in nlm
Hi there
I am having trouble figuring out how to get an nlm function to report estimates
for two parameter values in an estimation.
The way I've got it goes something like this:
f <- function (q, r)
{
here, I have a second loop which uses q, r to give me values for c, d below. a
and b are already specified; this loop is a mass-balance function where I am
trying to find values of q,
2008 Jul 15
1
manipulating (extracting) data from distance matrices
Hi all,
Does anyone have any tips for extracting chunks of data from a distance matrix?
For instance, if one was interested in only a subset of distance
comparisons (i.e., that of rows 4 thru 6, and no others), is there a
simple way to pull that data out?
>From some playing around with an example (below), I've been able to
figure out that a distance matrix in R is stored as a single