search for: row2

Displaying 20 results from an estimated 77 matches for "row2".

Did you mean: row
2009 Nov 13
3
sum(row1==y) if row2=x
Hi to all is there any construct to sum data=data.frame(row1=c(1,1,3,1,2,3,2,2,1,3,4,5,2,3,2,1) , row2=c(2,2,1,1,1,2,1,2,1,1,1,1,2,2,2,1) ) Means I would like to get all y of row1 if in row2 of the data.frame is an x f.e row1=3 and row2=2 so I would like to get 6 And is there another construct to get the count of pairs where row1=3 and row2=2 means the result should be 2 I could do this with loop...
2009 Aug 27
1
generating multiple sequences in subsets of data
...into an existing data set based on subsets of the data. I've done this using a for loop with a small subset of data, but attempting the same process using real data (200k rows) is taking way too long. Here is some sample data and my ultimate goal > row1<-c(0,1,2,3,4,5,1,2,3,4) > row2<-c(1,1,1,1,1,1,2,2,2,2) > stuff<-data.frame(row1=row1,row2=row2) > stuff row1 row2 1 0 1 2 1 1 3 2 1 4 3 1 5 4 1 6 5 1 7 1 2 8 2 2 9 3 2 10 4 2 I need to derive 2 columns. I need a sequence for e...
2010 May 11
1
create a data.frame for aov
Hi R-experts, I try to find a way to transfer a matrix to a data.frame that is used as input of aov. can you give me advice for that? >mdat <- matrix(c(1,2,3, 11,12,13), nrow = 2, ncol=3, byrow=TRUE, dimnames = list(c("row1", "row2"), c("Col1", "Col2", "Col3"))) >mdat      Col1 Col2 Col3 row1    1    2    3 row2   11   12   13 ===>       row   col    dat 1    row1  col1  1 2    row1  col2  2 3    row1  col3  3 4    row2  col1  11 5    row2  col2  12 6    row2  col3  13...
2008 Dec 16
1
refer to next line within a data-frame an select cases
Hi, I have a problem sorting and selecting entries within a data-frame and I don't know if it is possible to solve it with R ... (probably yes, but I have no idea how). Following Data; row1 row2 a 12 pos NA a 3 neg NA a 5 neg NA a 11 pos NA I want to extract the values in row 2 in the lines with an "a" in row1. But I want to have two vectors: vector x with all a-values (in row2) when the label in the next line is "pos" and vector y with all a-values when t...
2010 Mar 30
1
Adding RcppFrame to RcppResultSet causes segmentation fault
...etermines column types). std::vector<ColDatum> row1(numCol); row1[0].setStringValue("a"); row1[1].setDoubleValue(3.14); row1[2].setFactorValue(levelNames, numLevels, 1); row1[3].setDateValue(RcppDate(7,4,2006)); frame.addRow(row1); // Second row. std::vector<ColDatum> row2(numCol); row2[0].setStringValue("b"); row2[1].setDoubleValue(6.28); row2[2].setFactorValue(levelNames, numLevels, 1); row2[3].setDateValue(RcppDate(12,25,2006)); frame.addRow(row2); RcppResultSet rs; rs.add("PreDF", frame);
2008 Dec 16
2
converting a data-frame by a defined rule
Hi, I have a data frame with several columns. Now I want to transfer the data into a new variable (also a data frame), but I only want a part of the data, defined by a rule ... for example; I have following data frame: row1 row2 row3 x 2 3 x 1 4 y 5 3 y 2 3 I know want a data frame, only with lines containing x in row1. I know how to do that for one row (f <- d$row2[d$row1=="x"]). But how can I do that for all rows in one step? So that I get this for f: row1 row2 row3 x 2 3 x 1 4
2005 Nov 28
7
combine two columns
Hi, I have an R programming problem and I havent found anything in the documentation yet: I have a data matrix, in which two neighbouring columns represent replicates of the same experiment, e.g. something like this: A A B B C C row1 1 1 1 2 2 2 row2 1 1 1 1 1 2 I would like to test, if the values for the two replicates in a row are the same or if they differ and generate a new matrix with the results of the tests, something like this: A B C row1 T F T row2 T T F Any hint will be appreciated! Georg
2012 Aug 03
3
embedding data frame in R code?
I would like to insert a few modest size data frames directly into my R code. a short illustration example of what I want is d <- read.csv( _END_, row.names=1 ) , "col1", "col2" "row1",1,2 "row2",3,4 __END__ right now, the data sits in external files. I could put each column into its own vector and then combine into a data frame, but this seems ugly. is there a better way to embed data frames? I searched for the answer via google, but could not find it. it wasn't obvious in t...
2010 May 31
2
accessing a data frame with row names
Readers, I have entered a file into r: ,column1,column2 row1,0.1,0.2 row2,0.3,0.4 using the command: dataframe<-read.table("/path/to/file.csv",header=T,row.names=1) When I try the command: dataframe[,2] I receive the response: NULL I was expecting: row1 0.2 row2 0.4 What is my error with the syntax please? Yours, r251 mandriva2009
2009 Jun 13
3
How Can I insert another column data into the CSV file when I use FasterCSV?
Hi, All, Suppose I have a CSV file, there is data in it. * Column 1 Column2 Column 3 Column 4 Row1 a b c Row2 a2 b2 c2* You know, the column 4 is no data Now, I would like to insert data to Column 4, after save, the CSV file will be: * Column 1 Column2 Column 3 Column 4 Row1 a b c...
2010 Sep 06
1
Creating named.list from two matrix columns
Hi Friends, I am new to R. On R utility class pages, creating "named.list" is described with this command : new("named.list",a=1,b=2) For large matrix having two columns, such as : "row1" 2334 "row2" 347 "row3" 379 ... I want to create a named.list like : $row1 [1] 2334 $row2 [1] 347 ... Can anyone explain how "named.list" variable can be created by using two specified columns of a dataframe or matrix object, where one of the two columns is assigned as a name (...
2012 Mar 20
2
anova.lm F test confusion
...134 184.36 1 61.022 50.182 7.355e-11 *** 3 133 161.73 1 22.628 18.609 3.105e-05 *** Why aren't the 2nd row F values from each of the anova tables the same??? I thought in each case the 2nd row is comparing model 2 to model 1? I figured out that for anova.lm(model1,model2) F(row2)=Sum of Sq(row2)/MSE of Model 2 and for anova.lm(model1,model2,model3) F(row2)=Sum of Sq(row 2)/MSE of Model 3 <-- I don't get why the MSE of model 3 is being included if we're comparing Model 2 to Model 2 Any help/explanations would be appreciated! -- View this message in conte...
2009 Mar 05
3
Dropping rows conditionally
...any challenges on the way especially on data management (data cleaning). I have been wanting to drop all the rows if there values are `NA' or have specific values like 1 or 2 or 3. mdat <- matrix(1:21, nrow = 7, ncol=3, byrow=TRUE, dimnames = list(c("row1", "row2","row3","row4","row5","row6","row7"), c("C.1", "C.2", "C.3"))) mdat<-data.frame(mdat) mdat C.1 C.2 C.3 row1 1 2 3 row2 4 5 6 row3 7 8 9 row4 10 11 12 ro...
2018 Nov 27
1
Subsetting row in single column matrix drops names in resulting vector
Dmitriy Selivanov (selivanov.dmitriy at gmail.com) wrote: > Consider following example: > > a = matrix(1:2, nrow = 2, dimnames = list(c("row1", "row2"), c("col1"))) > a[1, ] > # 1 > > It returns *unnamed* vector `1` where I would expect named vector. In fact > it returns named vector when number of columns is > 1. > Same issue applicable to single row matrix. Is it a bug? looks very > counterintuitive. Thi...
2010 Sep 10
4
for loop help please!
Hi Everyone, I have a 2-dim data.matrix(e.g., table1) in which row1 specifies a range of values. row2 - rown specify the number of times I want to replicate each corresponding value in row1. I can do this with the following function: rep(c(table1[1,]),c(table1[X,])) #where X would go from 2 - n. Now, I can do this manually by changing the values of X and save each resulting array/vector in an o...
2013 May 01
1
Combine multiple tables into one
...1 #[4,]??? 0??? 0??? 0??? 4 A.K. >Hi, > ?>I am trying to combine multiple tables into one, where the elements that are created as a result of the merge to be filled with zeroes. > >In other words, to go from this: > >#Create tables to combine >row1 <- c(1,1) >row2 <- c(1,2) >row3 <- c(0,1) >row4 <- c(0,4) >table1 <- rbind(row1,row2) >table2 <- rbind(row3, row4) >table1 ?> ? ? ? ? [,1] [,2] >row1 ? ?1 ? ?1 >row2 ? ?1 ? ?2 >table2 ? >? ? ? ? [,1] [,2] >row3 ? ?0 ? ?1 >row4 ? ?0 ? ?4 > >To thi...
2008 Sep 04
1
restricted bootstrap
...ater than 100m apart example data: main data: y<- c(1, 2, 9, 5, 6) x<-c( 1, 3, 5, 7, 9) z<-c(2, 4, 6, 8, 10) a<-c(3, 9, 6, 4 ,4) maindata<-cbind(y, x, z, a) y x x a [1,] 1 1 1 3 [2,] 2 3 3 9 [3,] 9 5 5 6 [4,] 5 7 7 4 [5,] 6 9 9 4 distance matrix: row1<-c(0, 123, 567, 89) row2<-c(98, 0, 345, 543) row3<-c(765, 90, 0, 987) row4<-c(654, 8, 99, 0) dist<-rbind(row1, row2, row3, row4) [,1] [,2] [,3] [,4] row1 0 123 567 89 row2 98 0 345 543 row3 765 90 0 987 row4 654 8 99 0 Thanks for all of the help in the past and now Cheers...
2004 Aug 18
1
header line generated write.table
I want to write following data frame into a CSV file: Col1 Col2 Col3 Row1 1 1 1 Row2 2 2 2 where Row1, Row2 are the row names and Col1, Col2, Col3 are the column names. The correct CSV file should be: ,"Col1","Col2","Col3" Row1,1,1,1 Row2,2,2,2 However, the one generated by R using write.table(x, file="xyz.csv", sep=",&...
2013 Jan 02
2
rbind: inconsistent behaviour with empty data frames?
...e continue: df1 <- data.frame(matrix(0, 0, 2)) names(df1) <- names(df2) foo bar 2 1 a 3 2 b So now data frames combined successfully, but the row names have been increased by one. Finally, if row names are strings, it works okay: row.names(df2) <- c("row1", "row2") rbind(df1, df2) foo bar row1 1 a row2 2 b Is this behaviour by design? [[alternative HTML version deleted]]
2007 Nov 12
1
update matrix with subset of it where only row names match
I guess this has a simple solution: I have matrix 'mat1' which has row and column names, e.g.: A B C row1 0 0 0 row2 0 0 0 .... rown 0 0 0 I have a another matrix 'mat2', essentially a subset of 'mat1' where the rownames are all in 'mat1' e.g.: B row3 5 row8 6 row54 7 I want to insert the values of matrix mat2 for column B (in reality it could be some or all of column names A, B or...