Displaying 20 results from an estimated 30000 matches similar to: "Unique rows"
2006 Aug 01
4
Overlay Boxplot with scatter plot
I am trying to make a box plot and overlay it with a scatter plot from
another data.frame. I was able to successfully create the boxplot, but
when i tried using points(x~y...) the dots did not show up.
example code
aa<-(300,300,300,300,600,600,600,600,900,900,900,900)
bb<-(13,12,14,11,56,44,34,75,22.,34,22,98,59,55,56)
cc<-(13,12,14,11,56,44,34,75,22.,34,22,98,59,55,56)
2007 Aug 10
7
Help wit matrices
Hello all,
I am working with a 1000x1000 matrix, and I would like to return a
1000x1000 matrix that tells me which value in the matrix is greater
than a theshold value (1 or 0 indicator).
i have tried
mat2<-as.matrix(as.numeric(mat1>0.25))
but that returns a 1:100000 matrix.
I have also tried for loops, but they are grossly inefficient.
THanks for all your help in advance.
Lanre
2008 Jun 22
5
Re move row.names column in dataframe
Hello,
aa<-c(1,1,2,2,3,3,4,4,5,5,6,6)
bb<-c(56,56,33,33,53,53,20,20,63,63,9,9)
cc<-data.frame(aa,bb)
uniquedf <- unique(cc)
View(uniquedf)
Why does the column "row.names" appear in the new dataframe and how do I get
rid of it.
"uniquedf$row.names <- NULL" does not seem to work.
For what I'm doing this is a useless column and can cause confusion and/or
2006 May 17
1
Example Syntax for if - then- and - else Statements
Hello R users,
I am a fairly new R user, however, one of the problems I am having is
the use of applying if-, and-, then-, else- statements in R against
datasets & dataframe. Rtips mentions it, but without simple examples I
am not quite sure what my syntax should look like. I am particularly
interested in syntax that can be used with the transform function. for
example
if foo[,1] ==
2005 Aug 25
4
covariance matrix under null
Hello
I am fitting a Cox PH model using the function coxph(). Does anyone know how
to obtain the estimate of the covariance matrix under the null hypothesis.
The function coxph.detail() does not seem to be useful for this purpose.
Thanks,
KD.
[[alternative HTML version deleted]]
2007 Oct 11
2
Matching and merging two rows with missing values
Hello,
I have two rows which are almost identical but miss different values at
different locations. I would like to merge these two rows so that the
missing values are replaced by the element in the same column on the other
row making one row. If both rows contain a NA, NA remains in the output.
1 2 3 4 5
Row1 AA AG GG NA NA
Row2 NA AG GG AA NA
The
2006 Aug 09
3
objects and environments
Dear list,
I have two functions created in the same environment, fun1 and fun2.
fun2 is called by fun1, but fun2 should use an object which is created in fun1
fun1 <- function(x) {
ifelse(somecondition, bb <- "o", bb <- "*")
## mymatrix is created, then
myresult <- apply(mymatrix, 1, fun2)
}
fun2 <- function(idx) {
if (bb == "o) {
#
2005 Dec 06
2
how to extract row& col names from a matrix
Dear all,
I like to extract row names & column names from the named matrix......
like......
a<-matrix(1:6,2)
ro<-c("aa","bb")
co<-c("dd","ee","ff")
dimnames(a)<-list(ro,co)
a
>
dd ee ff
aa 1 3 5
bb 2 4 6
from the above matrix "a"
I like to extract
rownames separately like
2006 Jun 30
3
data extraction
Dear mailing list I have a data that have 20,000 rows and 20 columns. Io
wonted to extract the 10th row only. Example the 10th, 20th, 30th 40th…..20000
th. can you please help me how do I do that.Than kyou.
Example is below.
Inpute:
AG GG GG AG
CC CC CC CC
CT CC CT CT
GG GG GG GG
CC CC CC CC
GG GG GG GG
CC CC CC CC
GG CG CG GG
GG GG GG GG
*CC CC CC CC*
AA AG AG AA
AA AA AA AA
GG AG AG GG
GG AG AG
2006 Apr 06
3
convert a data frame to matrix - changed column name
I have a question, which very easy to solve, but I can't find a solution.
I want to convert a data frame to matrix. Here my toy example:
> L3 <- c(1:3)
> L10 <- c(1:6)
> d <- data.frame(cbind(x=c(10,20), y=L10), fac=sample(L3, + 6, repl=TRUE))
> d
x y fac
1 10 1 1
2 20 2 1
3 10 3 1
4 20 4 3
5 10 5 2
6 20 6 2
> is.data.frame(d)
[1] TRUE
> sapply(d,
2005 Jan 05
1
unlist kills R
When I try to unlist a very large list, R is killed
without any other warning:
A<-as.list(as.data.frame(matrix(1:21639744,nrow=3578,ncol=6048)))
with
AA<-unlist(A)
or
AA<-c(A,recursive=TRUE)
I get a
R terminado (killed)
and the end of the session.
I think I'll need to get more RAM (now 1Gb, any other
solutions welcomed) to be able to do this but,
shouldn't I get a more gentle
2007 Dec 13
6
spliting strings ...
Hi everyone,
I have a vector of strings, each string made up by different number of words. I want to get a new vector which has only the first word of each string in the first vector. I came up with this:
str <- c('aaa bbb', 'cc', 'd eee aa', 'mmm o n')
str1 <- rep(1, length(str))
for (i in 1:length(str)) {
str1[i] <- strsplit(str, "
2007 Aug 28
1
substituting elements in vector according to sample(unique(vector))
Hello!
Assuming I have a vector, such as
v <- c(1,2,1,2,3,3,1)
This vector has three unique elements: 1, 2, and 3.
> unique(v)
[1] 1 2 3
If I shuffle this vector of unique elements, I get something like this:
> sample(unique(v))
[1] 3 2 1
In the vector v I started with, I would now like to replace each element in
unique(v) with the corresponding element (i.e. the element with the
2008 Feb 14
4
plot each column of a matrix or dataframe versus x in a single plot
How do a plot several columns of a matrix at once in a single plot
versus a single x-variable?
The default plot.matrix or plot.dataframe commands plot each column
versus each other column in several sub-plots. I want to plot each
column versus a single other vector (x) as several lines or points in
one plot.
I can do it by hand: get the range of all variables (i.e. columns of
the matrix or
2008 Feb 07
1
How to split a factor (unique identifier) into several others?
Hello,
I have a data frame with a factor column, which uniquely identifies
the observations in the data frame and it looks like this:
sample1_condition1_place1
sample2_condition1_place1
sample3_condition1_place1
.
.
.
sample3_condition3_place3
I want to turn it into three separate factor columns "sample",
"condition" and "place".
This is what I did so far:
#
2006 Jun 18
1
about the analysis of strings, thanks
Dear R-helpers:
thank your for your attention.
i am a newer to R and i am doing some protein category classification based on
the amino acid sequence.while i have some question urgent.
1. any packages for analysis amino acid sequence
2. given two sequences "AAA" and "BBB",how can i combine them into "AAABBB"
3. based on "AAABBB",how can i get some
2007 Mar 08
2
Removing duplicated rows within a matrix, with missing data as wildcards
I'd like to remove duplicated rows within a matrix, with missing data
being treated as wildcards.
For example
> x <- matrix((1:3), 5, 3)
> x[4,2] = NA
> x[3,3] = NA
> x
[,1] [,2] [,3]
[1,] 1 3 2
[2,] 2 1 3
[3,] 3 2 NA
[4,] 1 NA 2
[5,] 2 1 3
I would like to obtain
[,1] [,2] [,3]
[1,] 1 3 2
[2,] 2 1 3
2007 Aug 20
1
Select rows of matrix
Hi
I would appreciate if anyone could help me with an elegant solution of
the following:
I have a matrix that contain a small number of -Inf values.
How can form a new matrix from the old one that excludes all the rows
with -Inf values ?
Thank you.
Jacob
Dept of Statistics
University of Johannesburg
South Africa
[[alternative HTML version deleted]]
2005 Aug 03
1
filter data set unique, duplicate..
Hello
First, thanks for the help for an earlier question about error handling!
I have problem filtering a dataset.
I'm trying to filter the data in the y columns based on the values in the x
column, e.g.:
x y1 y2 yn
1.0 1 NA 3
2.0 1 NA 11
2.0 2 NA NA
3.0
2005 Sep 15
2
R: deleting rows
hi all
hopefully some one can help.
assume that i imported the following data into R (say the data frame is
called a)
x1 x2 x3
1 NA 3
1 2 NA
1 2 3
3 NA 6
4 5 9
7 5 6
7 8 9
NA 7 9
How can i construct a new data frame that only contains those rows that
does not contain the NA's? is these a quick way?
ie
x1 x2 x3
1 2 3
4 5 9
7 5 6
7 8 9
in this example we can simple use