Displaying 20 results from an estimated 4000 matches similar to: "converting a data-frame by a defined rule"
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
>
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
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
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"
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",
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 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 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,
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
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"
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);
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
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
2009 Jan 17
3
converting multiple variable numbers
thanks for the great help!
But I have one additional question (hope I can work alone then);
I want to replace the values of a vector, like this:
x <- c(1,2,2,3,3,4,4,4,5,1)
x[x==1] <- c(12)
x[x==2] <- c(13)
x[x==3] <- c(17)
x[x==4] <- c(20)
x[x==5] <- c(22)
is there a way to do that just in one or two code lines?
I tried
x[x == c(1:5)] <- c(12,13,17,20,22)
but that
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
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
===>
2009 Jan 17
2
splitting a string / finding a numeric value within a string
Hi,
I have this variable;
x <- c("test_01.log")
and I want to extract the number (01) out of the variable.
So that I get;
> x
[1] 1
I tried strsplit, but I don't know how to refer to the result.
Can someone help me with that?
[[alternative HTML version deleted]]