Displaying 20 results from an estimated 2000 matches similar to: "problem selecting rows meeting a criterion"
2006 Aug 16
1
help about agnes
Hello.
I have the following distance matrix between 8 points:
[1,] 0.000000 3.162278 7.280110 8.544004 7.071068 9.899495 6.403124 8.062258
[2,] 3.162278 0.000000 5.000000 6.403124 4.472136 8.944272 6.082763 8.062258
[3,] 7.280110 5.000000 0.000000 1.414214 1.000000 5.000000 4.242641 5.830952
[4,] 8.544004 6.403124 1.414214 0.000000 2.236068 4.123106 4.472136 5.656854
[5,] 7.071068 4.472136
2006 Aug 15
4
nls
Is there anyway to change any y[i] value (i=2,...6) to make following NLS workable?
x <- c(0,5,10,15,20,25,30)
y <- c(1.00000,0.82000,0.68000,0.64000,0.66667,0.68667,0.64000)
lm(1/y ~~ x)
nls(1/y ~~ a+b*x^c, start=list(a=1.16122,b=0.01565,c=1), trace=TRUE)
#0.0920573 : 1.16122 0.01565 1.00000
#Error in numericDeriv(form[[3]], names(ind), env) :
# Missing value or
2010 May 06
2
splitting character strings and converting to numeric vectors
This seemingly should be quite simple but I can't solve it:
I have a long character vector of geographic data (data frame column named
"XY") whose elements vary in length (from 11 to 14 chars). Each element is
structured as a set of digits, then an underscore, then more digits, e.g:
> data.frame(head(as.character(XY)))
head.as.character.XY..
1 -448623_854854
2
2010 May 12
1
removing duplicate rows
I'm trying to identify and remove rows in a data frame that are duplicated
only on particular columns within it (i.e. not on all columns). The
"unique" function looks for uniqueness across all columns of a data frame.
Identifying unique rows based only on specific columns of interest returns
only those columns, not all of the columns in the original frame. I tried
this, and then
2009 Jul 23
5
error message: .Random.seed is not an integer vector but of type 'list'
I'm trying to run this simple random sample procedure and keep getting the
error message shown. I don't understand this; I've designated x as a
numeric vector, so what is going on here? Thanks.
> x = as.vector(c(1:12));x
[1] 1 2 3 4 5 6 7 8 9 10 11 12
> mode(x)
[1] "numeric"
> sample(x, 3)
Error in sample(x, 3) :
.Random.seed is not an integer vector
2018 May 21
2
removing part of a string
dear all,
I am stuck on the following problem. Give a string like
ss1<- "z:f(5, a=3, b=4, c='1:4', d=2)"
or
ss2<- "f(5, a=3, b=4, c=\"1:4\", d=2)*z"
I would like to remove all entries within parentheses.. Namely, I aim to
obtain respectively
"z:f()" or "f()*z"
I played with sub() and gsub() but without success..
Thank you very
2020 May 19
5
[PATCHv2] SSE2/SSSE3 optimized version of get_checksum1() for x86-64
I've read up some more on the subject, and it seems the proper way to
do this with GCC is g++ and target attributes. I've refactored the
patch that way, and it indeed uses SSSE3 automatically on supporting
CPUs, regardless of the build host, so this should be ideal both for
home builders and distros.
Getting the code to build right in c++ mode (checksum_sse2.cpp only)
was a bit of an
2010 Jul 07
3
quantiles on rows of a matrix
I'm trying to obtain the mean of the middle 95% of the values from each row
of a matrix (that is, the highest and lowest 2.5% of values in each row
are removed before calculating the mean). I am having all sorts of
problems with this; for example the command:
apply(matrix1,1,function(x) quantile(c(.05,.90),na.rm=T))
returns the exact same quantile values for each row, which is clearly
2009 Jul 23
5
Random # generator accuracy
Dan Nordlund wrote:
"It would be necessary to see the code for your 'brief test' before anyone
could meaningfully comment on your results. But your results for a single
test could have been a valid "random" result."
I've re-created what I did below. The problem appears to be with the
weighting process: the unweighted sample came out much closer to the actual
2011 Oct 24
3
extract the p value
OK, what is the trick to extracting the overall p value from an lm object?
It shows up in the summary(lm(model)) output but I can't seem to extract it:
> test2 = apply(aa, 1, function(x) summary(lm(x[,1] ~ 0 + x[,3] + x[,6])))
> test2[[1]]
Call:
lm(formula = x[, 1] ~ 0 + x[, 3] + x[, 6])
[omitted summary output]
F-statistic: 40.94 on 2 and 7 DF, p-value: 0.0001371
It does not seem
2020 May 18
6
[PATCH] SSE2/SSSE3 optimized version of get_checksum1() for x86-64
This drop-in patch increases the performance of the get_checksum1()
function on x86-64.
On the target slow CPU performance of the function increased by nearly
50% in the x86-64 default SSE2 mode, and by nearly 100% if the
compiler was told to enable SSSE3 support. The increase was over 200%
on the fastest CPU tested in SSSE3 mode.
Transfer time improvement with large files existing on both ends
2011 Sep 23
2
converting object elements to variable names and making subsequent assignments thereto
This has got to be incredibly simple but I nevertheless can't figure it out
as I am apparently brain dead.
I just want to convert the elements of a character vector to variable names,
so as to then assign formulas to them, e.g:
z = c("model1","model2"); I want to assign formulas, such as lm(y~x[,1]) and
lm(y~x[,2]), to the variables "model1" and
2009 Nov 21
7
consecutive numbering of elements in a matrix
Within a very large matrix composed of a mix of values and NAs, e.g, matrix A:
[,1] [,2] [,3]
[1,] 1 NA NA
[2,] 3 NA NA
[3,] 3 10 17
[4,] 4 12 18
[5,] 6 16 19
[6,] 6 22 20
[7,] 5 11 NA
I need to be able to consecutively number, in new columns, the non-NA
values within each column (i.e. A[1,1] A[3,2] and A[3,3] would all be set
to one, and
2010 Dec 26
2
object names from character strings
I realize this is probably pretty basic but I can't figure it out.
I'm looping through an array, doing various calculations and producing a
resulting data frame in each loop iteration. I need to give each data
frame a different name. Although I can easily create a new character
string for writing each frame to an output file, I cannot figure out how
to convert such strings to
2010 Mar 11
3
NAs and row/column calculations
I continue to have great frustrations with NA values--in particular making
summary calculations on rows or cols of a matrix containing them. For
example, why does:
> a = matrix(1:30,nrow=5)
> is.na(a[c(1:2),c(3:4)]);a
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1 6 NA NA 21 26
[2,] 2 7 NA NA 22 27
[3,] 3 8 13 18 23 28
[4,] 4 9 14 19 24 29
2006 Oct 23
2
getting the by() function to work properly
Hola everyone,
Solving this issue would be a huge time saver for analyzing my thesis data, so I'll try to be as concise as possible and hope that someone can give me a hand.
I am trying to run a function that I created, which works fine until I try to use it with the by function. That function is listed at the bottom (f3) just in case that might be the issue. Essentially I have compiled a
2018 May 21
0
removing part of a string
Hello,
Try this.
ss1 <- "z:f(5, a=3, b=4, c='1:4', d=2)"
ss2 <- "f(5, a=3, b=4, c=\"1:4\", d=2)*z"
fun <- function(s) sub("(\\().*(\\))", "\\1\\2", s)
fun(ss1)
#[1] "z:f()"
fun(ss2)
#[1] "f()*z"
Hope this helps,
Rui Barradas
On 5/21/2018 2:33 PM, Vito M. R. Muggeo wrote:
> dear all,
> I am stuck
2009 Nov 24
2
linear regression on groups of consecutive rows of a matrix
I want to perform linear regression on groups of consecutive rows--say 5 to
10 such--of two matrices. There are many such potential groups because the
matrices have thousands of rows. The matrices are both of the form:
> shp[1:5,16:20]
SL495B SL004C SL005C SL005A SL017A
-2649 1.06 0.56 NA NA NA
-2648 0.97 0.57 NA NA NA
-2647 0.46 0.30 NA NA
2009 Aug 04
2
R's database capabilities
I admit that I've not done a thorough search on this topic, but from the
several instructional manuals and/or tutorials I've looked at, I don't see
any mention of relational database capabilities in R? Have I missed
something, and if so, can someone point me in the right direction to get
started? Thanks!
Jim Bouldin, PhD
Research Ecologist
Department of Plant Sciences, UC Davis
2000 Aug 11
2
slow sparc questions
I've got a couple of SPARCstation 2s (about as fast as a fast 486, for most
thing) that I'm going to be using for some testing. I realize that these
machines are a bit slow, but when connecting via OpenSSH, it's MUCH slower
than connecting to my 486-DX 50. The point where it waits is just after
"debug: Sent encrypted session key.". The pause is for about 10 seconds,
while