similar to: Access Rows in a Data Frame by Row Name

Displaying 20 results from an estimated 60000 matches similar to: "Access Rows in a Data Frame by Row Name"

2007 Oct 31
3
Find A, given B where B=A'A
Given a matrix B, where B=A'A, how can I find A? In other words, if I have a matrix B which I know is another matrix A times its transpose, can I find matrix A? Thanks, Mike
2008 Feb 20
2
Data frame with 0 rows.
For reasons best known only to myself ( :-) ) I wish to create a data frame with 0 rows and 9 columns. The best I've been able to come up with is: junk <- as.data.frame(matrix(0,nrow=0,ncol=9)) Is there a sexier way? cheers, Rolf ###################################################################### Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
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
2010 Feb 23
4
First. Last. Data row selection
I am in the process of switching from SAS over to R. I am working on very large CSV datasets that contain vehicle information. As I am processing the data, I need to select the first (or sometimes the second) record (by date) for any records that have the same license plate number. In SAS, there is a function called 'first.' that can be used on sorted datasets to pull out those first
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
2003 Jul 28
3
data manipulation: getting mean value every 5 rows
Dear All, I would like to ask you how to accomplish a little tricky data manipulation. I have a large dataset, looking something like: temp line cage number 18 18 1 6678.63 18 18 1 7774.458 18 18 1 7845.902 18 18 1 9483.578 18 18 1 8983.555 18 18 1 9181.052 18 18 1 9458.696 18 18 1 8138.616 18 18 1 7981.994 18 18 1 7556.491 18 18 1 7672.137 18 18 1 6607.776 18 18 1 8383.65 18 18 1 7129.852 18 18
2009 Dec 08
1
extraction of sub-matrix by name
Dear all, sorry to bother you with potentially known issue -- we have noticed that if we select data frame rows by rownames, we get some results back if the match can be done unambiguously, though the match is not perfect (see example), e.g. x{"2",] will return a row if there is a unique row with name starting with "2" (but may be "2375745"!) is that a
2006 Jun 23
1
rearranging data frame rows
Hi All, I have two data frames. The first contains data about a number of individuals, coded in the first column with a name, in an order I find convenient. The second contains different data about the same indivduals, in a different order. Both data frame have the individual names in the first column. I need to reorder the second data frame so the rows are rearranged in the same manner as
2012 Jun 15
1
Divide all rows of a data frame by the first row.
Folks, I call the function calcAmorts like so: calcAmorts(prevAm, amort, myDates) Note that I use the package lubridate. The last line where do.call is called to first divide all the rows by the first row and then rbind gives the following error: Error in do.call("rbind", apply(amortsByYears, 1, "/", amortsByYears[, : second argument must be a list By contrast if
2003 Oct 09
2
AW: Getting rows from a dataframe
Df[x, ] Read 'an introduction to R' and 'FAQ' -----Urspr?ngliche Nachricht----- Von: Mark Lee [mailto:mark.lee at orbisuk.com] Gesendet: Donnerstag, 9. Oktober 2003 18:02 An: r-help at stat.math.ethz.ch Betreff: [R] Getting rows from a dataframe Sorry if this is a silly question. I'm trying to extract all elements of a dataframe at a particular row. I can find no mention
2018 May 22
0
remove rows of a matrix by part of its row name
Hello, Use grep to get the row indices and then subset with a *negative* index to remove those rows. rn <- scan(what = character(), text = " 70/556 71.1/280 72.1/556 72.1/343 73.1/390 73.1/556 ") mat <- matrix(rnorm(6*6), nrow = 6) row.names(mat) <- rn inx <- grep("73\\.", row.names(mat)) new_mat <- mat[-inx, ] new_mat Hope this helps, Rui Barradas On
2018 May 22
4
remove rows of a matrix by part of its row name
Dear R-experts, How can I remove a certain feature or observation by a part of its name. To be clear, I have a matrix with 766 observations as a rows. The row names are like this 70/556 71.1/280 72.1/556 72.1/343 73.1/390 73.1/556 Now I would like to remove all the rows that contain the text 73.1 Any ideas or suggestion please ? Regards ********************** Ahmed Serag Analytical
2009 Aug 26
1
Applying do.call to a data.frame using function arguments
I'm trying to convert a data.frame to a series of strings (row-wise). There was a very good discussion awhile back (2002) entitled "[R] string concatenate across rows of a matrix??" where Tony Plate recommended the following two alternatives (x2 is an R object of type data frame -- a matrix also works for solution #1): 1) apply(format(x2), 1, paste, collapse=" ");
2017 Oct 19
2
Select part of character row name in a data frame
Dear R contributors, I have a problem in selecting in an efficient way, rows of a data frame according to a condition, which is a part of a row name of the table. The data frame is made of 64 rows and 2 columns, but the row names are very long but I need to select them according to a small part of it and perform calculations on the subsets. This is the example: X Y "Unique to
2002 Nov 15
1
collapse rows in a matrix
Hi, all, I have a little problem to solve. I'd like to collapse rows which are next to each other but have same value to one row. The following is an example. say x is a data frame like: X1 X2 X3 X4 X5 a 1 0 0 0 1 b 1 0 1 0 1 c 1 0 0 0 1 d 1 0 0 0 1 e 1 0 0 0 1 f 1 1 0 0 1 g 1 1 0 0 1 notice that a, c,d,e are the same. since c,d,e are next to each
2017 Oct 19
0
Select part of character row name in a data frame
Quoting Francesca PANCOTTO <f.pancotto at unimore.it>: > Dear R contributors, > > I have a problem in selecting in an efficient way, rows of a data > frame according to a condition, > which is a part of a row name of the table. > > The data frame is made of 64 rows and 2 columns, but the row names > are very long but I need to select them according to a small
2008 Aug 08
2
Tcl\tk not supported on this system
In trying to install the pbatR package, I was greeted with the error Error: package 'tcltk' does not have a name space Execution halted Directly installing the package tcltk2 returned the following error: Loading required package: tcltk Error in firstlib(which.lib.loc, package) : Tcl/Tk support is not available on this system I have seen from previous posts that tcl/tk must be
2010 Apr 05
2
find the "next non-NA" value within each row of a data-frame
#I wish to find the "next non-NA" value within each row of a data-frame. #e.g. I have a data frame mydata. Rows 1, 2 & 3 have soem NA values. mydata <- data.frame(matrix(seq(20*6), 20, 6)) mydata[1,3:5] <-  NA mydata[2,2:3] <-  NA mydata[2,5] <-  NA mydata[3,6] <-  NA mydata[1:3,] #this loop accomplishes the task; I am tryign toi learn a "better" way for(i
2018 May 22
0
remove rows of a matrix by part of its row name
Hello, Please always cc the list. As for the question, yes, it does. If you want to remove just the ones with exactly 73.1 use the pattern grep("^73\\.1$", etc) Explanation: Beginning of string: ^ End of string: $ Escape special characters: \\ (needed because the period is a special character.) Hope this helps, Rui Barradas On 5/22/2018 12:50 PM, Ahmed Serag wrote: > Thank
2017 Oct 19
2
Select part of character row name in a data frame
Thanks a lot, so simple so efficient! I will study more the grep command I did not know. Thanks! Francesca Pancotto > Il giorno 19 ott 2017, alle ore 12:12, Enrico Schumann <es at enricoschumann.net> ha scritto: > > df[grep("strat", row.names(df)), ] [[alternative HTML version deleted]]