similar to: How do you refer to the row above in a data frame ?

Displaying 20 results from an estimated 1000 matches similar to: "How do you refer to the row above in a data frame ?"

2009 Aug 27
1
generating multiple sequences in subsets of data
I'm running into a problem I can't seem to find a solution for. I'm attempting to add sequences 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 >
2006 Mar 28
1
weights in glm (PR#8720)
Full_Name: Robert Pusz Version: 2.2.1 OS: Windows Submission from: (NULL) (157.25.9.126) Hello, In my opinion something is wrong with 'weights' option in glm. My code is following: ###begin of the code#### cl <- c(5012, 106, 3410, 5655, 1092, 1513, 557, 1351, 3133, 2063, 3257, 4179, 5582, 5900, 8473, 4932, 3463, 5596, 2262, 0, 2638, 1111, 4881, 4211, 6271, 5257, 6926, 6165, 0, 0,
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 <-
2009 Dec 02
2
Help: barchart() {Lattice}
Hi R Users, I'm using following data/code (data is attached also) to produce a stacked barplot. # Sample Data: Names Col1 Col2 Col3 Row1 -20 40 -10 Row2 30 -20 40 Row3 30 10 -20 Row4 20 20 -10 # R Code: dta<-read.table("data.txt", header=TRUE, row.names="Names") barchart(data.matrix(dta), horizontal=FALSE, stack=TRUE, par.settings = simpleTheme(col =
2009 Dec 02
1
barchart() {Lattice} -- auto.key()
Hi R Users, I'm using following data/code (data is also attached) to produce a stacked barplot. *I need help with changing legend boxes, currently I'm using "rectangles=TRUE". Is it possible to get small squares instead -- may be with a small gap between colored squares.* Currently there is no gap between the colored rectangles. # Sample Data: Names Col1 Col2 Col3 Row1 -20 40
2009 Nov 26
3
barchart() {Lattice} help.
Hi R Users, I'm trying to plot a stacked barplot. Here is data: Sample Col1 Col2 Col3 Row1 -2 4 -1 Row2 3 -2 4 Row3 3 5 -2 Row4 4 1 -1 I'm using following R code: library(lattice) dta<-read.table("data.txt", header=TRUE, row.names="Sample") barchart(data.matrix(dta), horizontal=FALSE, stack=TRUE, col=2:4,
2008 Sep 04
1
restricted bootstrap
Hello List, I am not sure that I have the correct terminology here (restricted bootstrap) which may be hampering my archive searches. I have quite a large spatially autocorrelated data set. I have xy coordinates and the corresponding pairwise distance matrix (metres) for each row. I would like to randomly sample some number of rows but restricting samples such that the distance between them is
2013 May 01
1
Combine multiple tables into one
Hi, May be this helps: dat1<- as.data.frame(table1) ?dat2<- as.data.frame(table2) names(dat2)<-c("V3","V4") library(plyr) res<-join(dat1,dat2,type="full") ?res[is.na(res)]<- 0 ?res #? V1 V2 V3 V4 #1? 1? 1? 0? 0 #2? 1? 2? 0? 0 #3? 0? 0? 0? 1 #4? 0? 0? 0? 4 ?combinedtable<-as.matrix(res) ?colnames(combinedtable)<- NULL ?combinedtable #???? [,1] [,2]
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
2009 Mar 05
3
Dropping rows conditionally
Dear R-help team, I am getting addicted to using R but keep on getting many 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",
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"
2014 Sep 26
2
[LLVMdev] Canonicalizing vector masking.
Hi, I received an internal test case from a game team (it wasn't about this in particular), and I was wondering if there was maybe an opportunity to canonicalize a particular code pattern: %inputi = bitcast <4 x float> %input to <4 x i32> %row0i = and <4 x i32> %inputi, <i32 -1, i32 0, i32 0, i32 0> %row0 = bitcast <4 x i32> %row0i to <4 x float>
2009 Dec 27
4
how to create a simple loop ?
I have a 5-row matrix called “data”. There are headers. it look like this : Row 1 Row2 Row3 Row4 Row5 Line1 … … … … Line2 … … … … Line3 … … … … … Line 1838 … … … … I want to calculate several simple arithmetic means for Row5, that
2011 Jan 14
4
test
Hi, i have that table Thesis Day A B C 1 0 83.43 90.15 22.97 1 0 85.50 94.97 16.62 1 0 83.36 95.38 20.70 1 0 84.47 92.16 23.58 1 0 83.98 95.33 19.39 1 0 82.86 93.78 24.55 1 0 83.39 92.67 19.56 1 0 85.17 95.24 17.95 1 0 81.62 93.32 28.49 1 0 82.99 92.85 19.73 1 0 81.11 95.67 27.20 1 0 83.39 94.69 16.51 1 0 79.56 89.87 30.39 1 0 80.54 93.32 21.76 1 0 82.11 92.58 22.17 1 14 85.65 94.00 19.19 1 14
2013 Oct 25
0
[LLVMdev] Is there pass to break down <4 x float> to scalars
Liu Xin <navy.xliu at gmail.com> writes: > I think we are solving a same problem. I am working on shader language > too. I am not satisfied with current binaries because vector operations > are kept in llvm opt. > > glsl shader language has an operation called "swizzle". It can select > sub-components of a vector. If a shader only takes components "xy"
2009 Dec 02
1
Fw: Re: Help: barchart() {Lattice}
I HAVE BEEN ASKED TO BE REMOVED FROM THIS LIST OVER 20 TIMES, PLEASE CAN I BE REMOVED!!!!!!!!!!!!! --- On Thu, 3/12/09, Peng Cai <pengcaimaillist@gmail.com> wrote: From: Peng Cai <pengcaimaillist@gmail.com> Subject: Re: [R] Help: barchart() {Lattice} To: "Felix Andrews" <felix@nfrac.org> Cc: r-help@r-project.org Received: Thursday, 3 December, 2009, 10:17 AM Got it
2011 Nov 07
2
adjusting levelplot color scale to data
Hi guys, I have a matrix with values varying from approximately -0.7 to 0.33 that I want to create a heatmap/levelplot with. When I execute the levelplot function for my matrix, I end up getting colors that are adjusted to the max and min rather than around 0. In other words, ideally I would like to have a color ramp that goes from red (negative number), to white (0), to blue (positive);
2008 Apr 25
4
Equivalent of Excel pivot tables in R
Can somebody tell me how to do the equivalent of a pivot table in R ? For example, if I have : var1 var2 var3 a x 10 b y 20 a z 10 b z 20 a z 10 b z 20 I could have : x y z a 1 0 2 b 0 1 2 where entries in the table are counts of var3.
2012 Mar 09
1
index values of one matrix to another of a different size
> Hello, > > Is this the fastest way to use indices from one matrix to reference rows > in another smaller matrix? I am dealing with very big data (lots of columns > and I have to do this lots of times). > > ######sample data ############## > vals = matrix(LETTERS[1:9], nrow=3,ncol=3) > colnames(vals) = c('col1','col2','col3') > rownames(vals)
2012 Feb 14
4
Color cells of a matrix as in Excel
All, I frequently make spreadsheets in Excel in which I rank values in columns by stop-light colors (red is bad, yellow is OK, green is good). Image and heatmap expect a matrix in which all the data are in the same scale, but I frequently have different scales in different columns. ie. Column one runs from 1-10 while column 2 runs from 1-100. I thus need to define a separate color ramp for each