Displaying 20 results from an estimated 20000 matches similar to: "Avoiding loops"
2010 Mar 23
1
information module Wilks' lambda criterion
Hi everybody,
I was wondering if you can help me about a module. In fact, I'm looking for
a package or module about Wilks' lambda criterion in R environment. I didn't
find it in R website (
http://cran.cict.fr/web/packages/index.html#available-packages-W or
http://search.cpan.org/faq.html).
If this module exists, could you show me the command line.
Thank you very much for your help,
2009 Nov 20
3
help me avoid nested for() loops!
Hi R folks,
I have a massive array (object name "points") in the following form
[,1] [,2]
[1,] 1369 22
[2,] 1370 22
[3,] 1368 23
[4,] 1369 23
[5,] 1370 23
[6,] 1371 23
(10080 rows truncated)
These represent pixel coordinates of interest in a jpeg image. I need
to find the distance from each point to all other points of interest.
The only way I can see to do this
2006 Mar 12
1
alias_method interferes ApplicationHelper
Hello,
I''m using Ruby 1.8.4 (darwinport), rails-1.0.0 (gem) , Powerbook / Mac
OS X 10.4.5 , Webrick.
How come Rails always raises NoMethodError for my helper (must_fill and
rp or number_to_currency_rp) in application_helper.rb ?
I doubt that alias_method is the culprit, but if i give #
comment then there will be no errors at all ... :/
what am i doing wrong? is it a bug or stupid me? Thx
2006 Dec 31
4
Does SQL group by have a heavy duty equivalent in R
I have hundreds of humans who have undergone SNP genotyping at hundreds of
loci. Some have even undergone the procedure twice or thrice (kind of an
internal control).
So obviously I need to find those replications, and confirm that the results
are the same. If there is discordance then I need to address it.
I tried to use the aggregate function
nr.attempts
2008 Dec 09
2
Better way to find distances between points in a set?
I was playing around a bit to see how I could find the two points in a
set of points (or ordered pairs) furthest from each other.
Here's what I did:
1) created a Nrow by 2col matrix, so each row contains an x,y coordinate
pair.
2) fed the matrix to a nested mapply (cv is my matrix):
mapply(function(k,l) mapply(function(x,y,a,b)
+
2010 Aug 04
2
discrete ECDF
Dear list;
I just created a utility function that replicates what I have done in
the past with Excel or OO.org by putting a formula of the form
=sum($A1:A$1) in an upper-corner of a section and then doing a "fill"
procedure by dragging the lower-rt corner down and to the right. When
divided by the grand sum of the entries this function then calculates
a 2D-discrete-ECDF.
I
2008 Dec 22
2
How can I avoid nested 'for' loops or quicken the process?
Hi All,
I'm still pretty new to using R - and I was hoping I might be able to get
some advice as to how to use 'apply' or a similar function instead of using
nested for loops.
Right now I have a script which uses nested for loops similar to this:
i <- 1
for(a in Alpha) { for (b in Beta) { for (c in Gamma) { for (d in Delta) {
for (e in Epsilon)
{
Output[i] <-
2010 Jun 26
3
converting result of substitute to 'ordidnary' expression
Dear R users,
As substitute() help page points out:
Substituting and quoting often causes confusion when the argument
is 'expression(...)'. The result is a call to the 'expression'
constructor function and needs to be evaluated with 'eval' to give
the actual expression object.
And indeed I am confused. Consider:
> dat <- data.frame(x=1:10,
2010 Jun 26
3
converting result of substitute to 'ordidnary' expression
Dear R users,
As substitute() help page points out:
Substituting and quoting often causes confusion when the argument
is 'expression(...)'. The result is a call to the 'expression'
constructor function and needs to be evaluated with 'eval' to give
the actual expression object.
And indeed I am confused. Consider:
> dat <- data.frame(x=1:10,
2010 Nov 04
2
count occurrence and distance of characters in string
Hello all,
I want to know how often one character occurs in a given string
and the distance from between every two occurences. (distance = other
characters between them).
thanks
2011 Feb 17
2
sort by column and row names
Hello, All,
How can one sort on column and row names. For example:
How can this
X1 X3 X2
X1 1 0 0
X3 0 1 0
X2 0 0 1
become this?
X1 X2 X3
X1 1 0 0
X2 0 1 0
X3 0 0 1
Thank you for your time!
Jim
[[alternative HTML version deleted]]
2010 Jul 28
2
read.delim()
I am reading in a very large file with names in it and R is truncating the number of rows it reads in. The separator in this file is a pipe '|' and so I use
dat <- read.delim('pathToMyFile', header= TRUE, sep='|')
It turns out that it is reading up to row 61145 and stopping and I think I see why, but am not sure of the best solution to this problem. I see the name of
2009 Jul 30
3
Looping through R objects with $ operator and tags
Hi all,
Suppose I want to set the values in a column to the log of the values
of another column like so:
object$LogDist <- log10(object$Distance)
How do I loop through the objects if I have object1, object2, etc to
perform this function?
object1$LogDist <- log10(object1$Distance)
object2$LogDist <- log10(object2$Distance)
object3$LogDist <- log10(object3$Distance)
I was trying to
2010 Feb 13
2
lm function in R
Hello,
I am trying to learn how to perform Multiple Regression Analysis in R. I
decided to take a simple example given in this PDF:
http://www.utdallas.edu/~herve/abdi-prc-pretty.pdf
I created a small CSV called, students.csv that contains the following data:
s1 14 4 1
s2 23 4 2
s3 30 7 2
s4 50 7 4
s5 39 10 3
s6 67 10 6
Col headers: Student id, Memory span(Y), age(X1), speech rate(X2)
Now
2008 Aug 06
4
defining the distance between axis label and axis
Hi,
How can I make the distance between an axis-label and the axis bigger?
I haven't found anything in par()...
2008 Dec 10
1
subset point data set by distance ranges
Greetings
I'm using R 2.8 with recent (last month) versions of the packages I need to
use at present.
I'm interested in examining hierarchical spatio-temporal patterns in a data
set. The data consist of 94 points (X, Y, UTM coordinates) at which catch
rates for a fish were recorded and there are also estimates of prey
available for these fish at the same locations.
2007 Oct 20
2
formatting a list
Hi,
I am new to R and need to read in a file with 19 columns and 7000 rows
and make it into a list of 7000 lists with 19 items each. For a
simpler case of 10 by 10 table I used x <-scan("file",
list(0,0,0,0,0,0,0,0,0,0)), perhaps clumsy, but it did the job.
However with the large 19x7000 (which needs to be transposed) I am not
sure how to go about it.
Coudl somebody suggest a way?
2011 Jan 08
3
Question on list objects
Hi, I have 2 questions on list object:
1. Suppose I have a matrix like:
dat <- matrix(1:9,3)
Now I want to replicate this entire matrix 3 times and put entire result in a list object. Means, if "res" is the resulting list then I should have:
res[[1]]=dat, res[[2]]=dat, res[[3]]=dat
How can I do that in the easilest manner?
2. Suppose I have 2 list objects:
list1 <- list2
2012 Apr 30
2
Generate Dendrogram
Hi
I have a distance matrix which is computed by user defined method. I
would like to plot the dendrogram. I would like to use different color
and want the leaves laying down bottom.
The script like this. I am not familiar with R. I followed the example
shown in
http://stat.ethz.ch/R-manual/R-devel/library/stats/html/dendrogram.html
dist.obj <- as.dist(matrix.distance)
hc.obj <-
2009 Nov 17
1
hclust too slow?
Hi,
I am new to clustering in R and I have a dataset with approximately 17,000
rows and 8 columns with each data point a numerical character with three
decimal places. I would like to cluster the 8 columns so that I get a
dendrogram as an output. So, I am simply creating a distance matrix of my
data, using the 'hclust' function, and then plotting the results (see below,
my data is