Displaying 20 results from an estimated 8000 matches similar to: "vector replacement 1/0 to P/A"
2008 Jun 27
2
converting numbers to characters
Hi,
I need to convert numbers to characters in order
to index an array when I encountered the number
100000 which turned into "1e+05".
Does anyone know how to get around this problem?
Lana Schaffer
Biostatistics/Informatics
The Scripps Research Institute
DNA Array Core Facility
La Jolla, CA 92037
(858) 784-2263
(858) 784-2994
schaffer at scripps.edu
2009 Feb 13
1
error with make
Hi,
I am trying to compile the R-dev version on a unix Suse machine
and got errors.
Would someone be able to help me determine what to do to fix
these errors:
make[1]: Entering directory `/lustre/people/schaffer/R-devel/m4'
make[1]: Nothing to be done for `R'.
make[1]: Leaving directory `/lustre/people/schaffer/R-devel/m4'
make[1]: Entering directory
2004 Aug 20
3
Partial Least Squares
Friends,
Is there a Partial Least Squares package implemented in R?
Thanks,
Lana
[[alternative HTML version deleted]]
2008 Jul 03
1
subset function within a function
Hi,
I am using this subset statement and it works
outside a function.
LIS[[i]]<- lapply(LI, subset, select=cov[[i]])
However, wrapped inside a function this statement
produces the same values for every LIS[[1]] which
is only the first subset of LI.
Does anyone know why is not working correctly inside
a function?
ff = factor(covariate)
nLev <- nlevels(ff)
cov <-
2004 Jul 23
2
graphing with error bars
I am not able to find information about doing line plots with error bars in the R- help information.
Would someone like to tell me if this can be done in R and either get me started or lead me
to information about how to do the error bars?
Thanks,
Lana
2004 Jul 07
1
command line interface
How can plots (histograms) be implemented with the command line interface to R?
Lana Schaffer
2007 Jul 31
5
extract columns of a matrix/data frame
Hello all,
I have a matrix whose column names look like
a1 a2 b1 b2 b3 c1 c2
1 2 3 7 1 3 2
4 6 7 8 1 4 3
Now, I can have any number of a's. not just two as shown above and same goes for b's and c's. I need to extract all the a's columns and put them in another matrix, extract all b's columns and put them in some matrix
2013 Oct 11
3
matrix values linked to vector index
Hi,
In the example you showed:
m1<- matrix(0,length(vec),max(vec))
1*!upper.tri(m1)
#or
?m1[!upper.tri(m1)] <-? rep(rep(1,length(vec)),vec)
#But, in a case like below, perhaps:
vec1<- c(3,4,5)
?m2<- matrix(0,length(vec1),max(vec1))
?indx <- cbind(rep(seq_along(vec1),vec1),unlist(tapply(vec1,list(vec1),FUN=seq),use.names=FALSE))
m2[indx]<- 1
?m2
#???? [,1] [,2] [,3] [,4] [,5]
2012 Jul 11
4
Help with loop
Hi,
I have two dataframes:
The first, df1, contains some missing data:
cola colb colc cold cole
1 NA 5 9 NA 17
2 NA 6 NA 14 NA
3 3 NA 11 15 19
4 4 8 12 NA 20
The second, df2, contains the following:
cola colb colc cold cole
1 1.4 0.8 0.02 1.6 0.6
I'm wanting all missing data in df1$cola to be replaced by the value of
df2$cola.
2013 Apr 26
2
speed of a vector operation question
Hello,
I am dealing with numeric vectors 10^5 to 10^6 elements long. The values are
sorted (with duplicates) in the vector (v). I am obtaining the length of
vectors such as (v < c) or (v > c1 & v < c2), where c, c1, c2 are some scalar
variables. What is the most efficient way to do this?
I am using sum(v < c) since TRUE's are 1's and FALSE's are 0's. This
2010 Sep 16
1
Weibull simulation- number of items to replace is not a multiple of replacement length
Hi,
I write below code for simulation for weibull- estimating parameters by weibullMLE function,
Although I define metrix for the variables still I got this message: number of items to replace is not a multiple of replacement length
Any suggestion
> est=matrix (NA, 2,2)
> se=matrix (NA, 2,2)
> for ( p in 1:2) {
+ sampleSize <- 20
+ shape.true <- 1.82
+ scale.true <- 987
+
2010 Jul 15
2
replace negative numbers by smallest positive value in matrix
Hi Group,
I have a matrix, and I would like to replace numbers less than 0 by
the smallest minimum number. Below is an
small matrix, and the loop I used. I would like to get suggestions on
the "R way" to do this.
Thanks,
Juliet
# example data set
mymat <- structure(c(-0.503183609420937, 0.179063475173256, 0.130473004669938,
-1.80825226960127, -0.794910626384209, 1.03857280868547,
2017 Jun 27
2
paste strings in C
Dear R-devs,
Below is a small example of what I am trying to achieve, that is trivial in
R and I would like to learn how to do in C, for very large matrices:
> (mymat <- matrix(c(1,0,0,2,2,1), nrow = 2))
[,1] [,2] [,3]
[1,] 1 0 2
[2,] 0 2 1
And I would like to produce:
[1] "a*C" "B*c"
Which can be trivially done in R via something like:
foo
2008 Sep 21
1
How to put given values in lower triangle of splom-plot?
Dear R-experts,
I have found a splom-modification online which is given below. This
works perfectly, but I would like to have a matrix of given
correlation values to be used in the lower triangular part
(lower.panel) of the splom-plot instead of calculated correlation
values. Here is the matrix I would like to use (it can be any other
convenient data structure):
2007 Mar 12
1
How to avoid a for-loop?
Hi all,
as I am trying to move slowly from just "working" to "good" code, I'd
like to ask if there's a smarter way than using a for-loop in tasks like
the example below.
I need to obtain the extrema of the cumulated sum of a detrended time
series. The following code is currently used, please have a look at the
comments for my questions and remarks:
system.time({
X
2009 Aug 26
3
changing equal values on matrix by same random number
Dear all,
I have about 30,000 matrix (512x512), with values from 1 to N.
Each value on a matrix represent a habitat patch on my
matrix (i.e. my landscape). Non-habitat are stored as ZERO.
No I need to change each 1-to-N values for the same random
number.
Just supose my matrix is:
mymat<-matrix(c(1,1,1,0,0,0,0,0,0,0,0,
0,0,0,0,2,2,2,0,0,0,0,
0,0,0,0,2,2,2,0,0,0,0,
3,3,0,0,0,0,0,0,0,4,4,
2011 Oct 01
1
class definition
Hi everybody!
I have a matrix of class "myClass", for example:
myMat <- matrix(rnorm(30), nrow = 6)
attr(myMat, "class") <- "myClass"
class(myMat)
When I extract part of ''myMat'', the corresponding class ''myClass'' unfortunately disappear:
myMat.p <- myMat[,1:2]
class(myMat.p)
Please for any advice / suggestions, how
2006 Mar 21
1
rownames, colnames, and date and time
I noticed something surprising (in R 2.2.1 on WinXP)
According to the documentation, rownames and colnames are character vectors.
Assigning a vector of class POSIXct or POSIXlt as rownames or colnames
therefore is not strictly according to the rules.
In some cases, R performs a reasonable typecast, but in some other cases
where the same typecast also would be possible, it does not.
Assigning a
2006 Mar 21
1
rownames, colnames, and date and time
I noticed something surprising (in R 2.2.1 on WinXP)
According to the documentation, rownames and colnames are character vectors.
Assigning a vector of class POSIXct or POSIXlt as rownames or colnames
therefore is not strictly according to the rules.
In some cases, R performs a reasonable typecast, but in some other cases
where the same typecast also would be possible, it does not.
Assigning a
2006 Jul 03
1
rownames, colnames, and date and time
Hi all
I was wondering whether there has ever been an update on the rownames and
colnames behaviour as described by Eric below?
I still get the same behaviour, exactly as described by Eric, on my WinXP
installation of R-2.3.0. I also posted a message to r-help on Friday but
looking through the online archives it seems to have not made it to the
list. I would agree with Eric that a consistent