Displaying 20 results from an estimated 100000 matches similar to: "extracting selected rows, based on a 'list' of values"
2010 Nov 29
1
Extracting selected rows from a matrix
Hi,
I have matrix of 104 columns and 30000 rows (Each Row has rowname).
I have 13 different list of selected rownames (character) say 1000 each. Now I want to extract the all the columns according to the rownames in each the list.
How can I do that in R ?
1 ) For a single list
2) For all the 13 list at a time
Regards,
Pankaj Barah
Department of Biology,
Norwegian University of
2011 Apr 13
1
Extracting selected rows from a matrix to a submatix
I have a matrix M
> dim(M)
[1] 30380 561
I have another list L contains , that contains some row names of matrix M
str (L)
chr [1:21037]
Now I want to extract the submatrix subM (21037 , 561) from the matrix M by matching the rownames (M) to the 21037 rownames o f L
How do I do that ?
Thanks and regards,
Pankaj Barah
Pankaj Barah Department of Biology
Norwegian University
2011 Feb 08
2
Extrcat selected rows from a list
Hi,
I have two lists
1) List1- 30,000 rows and 104 columns
2) List2- a list of 14000 selected rownames from List 1
Now, I want to extract all the 104 columns of List1 matching with the 14000 selected rownames from List2.
Psedocode will be something like this:
match rownames(List2) with rownames(List1)
extract selected matched 104 coloumns from (List1)
strore in-> List3
So the
2010 Feb 18
2
Extracting values from a list
I have run a kruskal.test() using the by() function, which returns a list of
results like the following (subset of results):
Herb.df$ID: 4-2
Kruskal-Wallis chi-squared = 18.93, df = 7, p-value = 0.00841
--------------------------------------------------------------------
Herb.df$ID: 44-1
Kruskal-Wallis chi-squared = 4.43, df = 6, p-value = 0.6187
So then, how do extract a vector
2011 Oct 25
2
Extracting dataframe rows containing NAs in one column
Hi,
I am working on a data set which looks like this:
> head(temp)
Day Month Year PW ROW
1 1 1 1959 NA 6.40
2 2 1 1959 6.65 6.35
3 3 1 1959 2.50 3.60
4 4 1 1959 0.60 2.25
5 5 1 1959 0.85 0.30
6 6 1 1959 0.00 2.20
I am trying to extract all the rows containing NA. I can extrat all the rows
without NAs in column 4 using
>
2011 Jul 22
2
Extracting components from a 'boot' class output in R
Dear R user,
I used the following to do a bootstrap.
>bootObj<-boot(data=DAT, statistic=Lp.est,
R=1000,x0=3)
I have the following output from the above bootstrap. How
can I extract components of the output.
For example, how can I extract the std.error?
> bootObj
ORDINARY NONPARAMETRIC BOOTSTRAP
Call:
boot(data = DAT, statistic = Lp.est, R = 1000, x0 = 3)
Bootstrap Statistics
2009 Jul 06
2
Extracting only the non-repeated rows of matrices
I have 2 matrices. One which contains a complete set of row combinations.
Another which contains a subset of the first. What I would like to extract
is the rows which are in the first but not repeated in the second. For
instance if the following were my two matrices,
A
[,1] [,2] [,3] [,4]
[1,] 1 2 3 4
[2,] 1 2 3 5
[3,] 1 2 3 6
[4,] 1 2 3
2013 Jan 12
1
How to extract value for specific rows in an array?
Hi everyone,
I have a dataset that contains depths measurements every 30 sec for several
days.
The subset of data that I am working on looks like this:
Date Day Depth
18442.00 29 41.0
18442.00 29 43.5
...
18442.04 29 40.3
18442.04 29 35.1
...
18443.00 30 16.5
...
Since my data is collected
2009 Apr 16
2
Help- extracting values
I have csv files imported in r each with 2 columns and many many rows. I have sorted the data in them but want to extract some values.
The first column is an ID
The second is a p-value ( now sorted in increasing order with NA's last)
I want to extract the rows with a p-value of less than 0.05)
What commands would help
the table is called AnovaSort with column headings MCI & p-value
Many
2006 May 18
2
extracting values from data.frame given arbitrary keys
Hi all.
I have a pure R programming question.
Having a data.frame with a 'data' variable and some (>1) ID variables
(either numeric or factors), I would extract a sequence of data values given
a sequence of ID values.
Here's an example. Build a dataset:
n1 <- 5
n2 <- 2
v1 <- rep(factor(1:n1),2)
v2 <- rep(1:n2,5)
x <- rnorm(10)
dat <- data.frame(x=x, v1=v1, v2=v2)
2007 Mar 02
5
extracting rows from a data frame by looping over the row names: performance issues
Hi,
I have a big data frame:
> mat <- matrix(rep(paste(letters, collapse=""), 5*300000), ncol=5)
> dat <- as.data.frame(mat)
and I need to do some computation on each row. Currently I'm doing this:
> for (key in row.names(dat)) { row <- dat[key, ]; ... do some computation on row... }
which could probably considered a very natural (and R'ish) way of
2010 May 20
2
How to extract rows from data frame based on unique variable groupings
R community,
I would like to know how to extract rows from a data frame (DF) such that
each row in the new data frame (D.F) represents the first instance of
a unique variable pairing in the original dataframe (ordered first by
variable V1 then by variable V2). The unique function does not seem
to be able to accomplish this. I imagine there must be a simple solution for this,
but I can't
2009 Jun 06
2
extract rows having negative values
Hello,
I have a matrix with 6 columns and 12 rows. I want to extract out those IDs
(rownames) from my matrix which have a negative values. For each ID(row) if
the negative value is even under 1 column it needs to be extracted out. I
will be grateful for any correct suggestion.
Thanks
Manisha
Here is the matrix that I am working on:
ID
A
B
C
D
E
F
1
-4.18972
-3.8946
2008 Dec 11
1
Extract rows from data frame based on row names from another data frame
Hi all,
Is there a function to extract row names from a data frame based on
row names from another data frame? I can write a loop function to do
this, but this may be inefficient in terms of processing.
thanks for any information,
Wade
2012 May 30
2
Extracting rows from a dataset
Dear R help,
I have a dataset with 1's and 0's.? Here, each row is the observation for an insect.? If the animal is present in light area at a particular time, response is 1 and if it is present in dark area, the response is 0.? I would like to do some formating on the data for analysis.? To be specific, I need the rows where the animal starts in the light (1), went to dark (0), and came
2010 Apr 25
1
How to assign scores to rows based on column values
Hi,
I'm trying to assign a score to each row which allow me to identify which
rows differ. In the example file below, I've used "," to indicate column
separators. In this example, I'd like to identify that row 1 and row 5 are
the same, and row 2 and row 4 are teh same.
Any help much appreciated. Also, any comments on what the command lines do
would be fantastic.
Thanks!!
2012 Aug 14
4
Subsetting rows by multiple levels of selected values
Dear list,
Let's say we have a data frame as follows,
>expand.grid(a=1:5,b=c(1,5,10,20),DV=c(0.1,0.2,0.3))->df1
>df1$DV<-rgamma(60,shape=10)
columns a and b are two levels. DV is the column with values we are
interested in.
Then another data frame df2 with values as follows
data.frame(a=c(2,2,3,4,5),b=c(5,10,1,5,20))->df2
Now I want to a subset of df1 that match df2 at the
2005 Mar 18
3
extract rows in dataframe with duplicated column values
Hi
I want to extract all the rows in a data frame that have duplicates
for a given column.
I would expect this question to come up pretty often but I have
researched the archives and surprisingly couldn't find anything.
The best I can come up with is:
x <- data.frame(a=c(1,2,2,3,3,3), b=10)
xdup1 <- duplicated(x[,1])
xdup2 <- duplicated(x[,1][nrow(x):1])[nrow(x):1]
xAllDups <-
2012 Mar 09
1
extracting the i-th row of a matrix in a list of lists
Hi,
what is the proper of of "passing a missing value" so I can extract
the entire i-th row of a matrix (in a list of lists) without
pre-computing the number of cols?
For example, if I know that the matrices have 2 columns, I can do the following:
set.seed(1)
x0 <- lapply(1:10, function(i) replicate(4, list(matrix(rnorm(10), nc=2))))
lapply(lapply(x0, '[[', 3), '[',
2008 Jul 08
3
extracting index list when using tapply()
Hello,
The quick version of my question is how can I extract a matrix instead of
a vector using tapply()? I would like to be able to access both the results
of tapply() and also the index variables.
In case further explanation would help: I am analyzing a large (3million
rows x 9 columns) spatial/temporal dataset and am attempting to calculate
the number of unique years containing any data