Displaying 20 results from an estimated 3000 matches similar to: "Subsetting row in single column matrix drops names in resulting vector"
2018 Nov 21
3
Subsetting row in single column matrix drops names in resulting vector
Hi Rui. Thanks for answer, I'm aware of drop = FALSE option. Unfortunately
it doesn't resolve the issue - I'm expecting to get a vector, not a matrix .
??, 21 ????. 2018 ?. ? 20:54, Rui Barradas <ruipbarradas at sapo.pt>:
> Hello,
>
> Use drop = FALSE.
>
> a[1, , drop = FALSE]
> # col1
> #row1 1
>
>
> Hope this helps,
>
> Rui Barradas
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
2018 Nov 27
1
Subsetting row in single column matrix drops names in resulting vector
> > The behaviour of a[1,] is unchanged, for backwards compatibility
> > reasons. But in pqR one can explicitly mark an argument as
> > missing using "_". When an array subscript is missing in this way,
> > the names will not be dropped in this context even if there is
> > only one of them. So a[1,_] will do what you want:
> >
> > > a =
2018 Nov 22
0
Subsetting row in single column matrix drops names in resulting vector
The problem is that the drop is only applied (or not) after the subsetting, so what R does is:
- Getting the subset, which means a 1 x 1 matrix.
- Only then It either returns that as is (when drop=FALSE), or removes ALL dimensions of extent 1, regardless of whether these are rows or columns (or higher dimensions).
And it can't keep any names, because what name should be returned? The name
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
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
===>
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",
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,
2017 Aug 11
3
Help to create bugzilla account
Hi mailing list and R-core. Could someone from R-core please help me to
create account in bugzilla? I would like to submit issue related to gc() to
wishlist.
Related context is here -
https://stat.ethz.ch/pipermail/r-devel/2017-July/074715.html
--
Regards
Dmitriy Selivanov
[[alternative HTML version deleted]]
2017 Aug 11
2
Help to create bugzilla account
2017-08-11 16:00 GMT+02:00 Martin Maechler <maechler at stat.math.ethz.ch>:
>>>>>> Dmitriy Selivanov <selivanov.dmitriy at gmail.com>
>>>>>> on Fri, 11 Aug 2017 17:33:31 +0400 writes:
>
> > Hi mailing list and R-core. Could someone from R-core please help me to
> > create account in bugzilla? I would like to submit issue
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
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 =
2017 Aug 12
3
Help to create bugzilla account
Strange because in my all my experiments calling malloc.trim always helped
- memory reported by top decreased to the level it supposed to be. Do you
have in mind case when calling malloc.trim won't do anything? Also
shouldn't MALLOC_TRIM_THRESHOLD_ env variable has impact on malloc.trim
calls? At the moment seems any value is ignored...
12 ???. 2017 ?. 6:09 ?? ???????????? "Simon
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
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
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 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 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
>
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
2010 Mar 30
1
Adding RcppFrame to RcppResultSet causes segmentation fault
Hi,
I'm a bit puzzled. I uses exactly the same code in RcppExamples
package to try adding RcppFrame object to RcppResultSet. When running
it gives me segmentation fault problem. I'm using gcc 4.1.2 on redhat
64bit. I'm not sure if this is the cause of the problem. Any advice
would be greatly appreciated. Thank you.
Rob.
int numCol=4;
std::vector<std::string>