On Mon, 13 Feb 2023 13:08:18 +0900
Shunran Zhang wrote:
> In the code, calling image(sparseMatrix) works outside
> of a for loop - the image file is written. Calling
> image(as.matrix(sparseMatrix)) also works inside a for loop thus
> eliminating file access problem. However when using
> image
Hi all,
I have just encountered a weird behavior of image(sparseMatrix) when
trying to output plots to files in a for loop.
A sample code is provided below at the end of this mail as well as in
the attachment. In the code, calling image(sparseMatrix) works outside
of a for loop - the image f
Steven,
The default is drop=TRUE.
If you want to retain a data.frame and not have it reduced to a vector under
some circumstances.
https://win-vector.com/2018/02/27/r-tip-use-drop-false-with-data-frames/
-Original Message-
From: R-help On Behalf Of Steven T. Yen
Sent: Sunday, Februar
Great, Thanks. Now I have many options.
Steven from iPhone
> On Feb 13, 2023, at 10:52 AM, Andrew Simmons wrote:
>
> What I meant is that that
>
> mydata[, !grepl("^yr", colnames(mydata)), drop = FALSE]
>
> and
>
> mydata[!grepl("^yr", colnames(mydata))]
>
> should be identical. Some peopl
What I meant is that that
mydata[, !grepl("^yr", colnames(mydata)), drop = FALSE]
and
mydata[!grepl("^yr", colnames(mydata))]
should be identical. Some people would prefer the first because the
indexing looks the same as matrix indexing, whereas some people would
prefer the second because it is
Complain, complain...
x[ names( x ) != "V2" ]
or
x[ ! names( x ) %in% c( "V2", "V3" ) ]
or any other character or logical or integer expression that selects columns
you want...
On February 12, 2023 6:38:00 PM PST, Steven Yen wrote:
>x[“V2”] would retain columns of x headed by V2. What I need
x[“V2”] would retain columns of x headed by V2. What I need is the opposite——I
need a data grime with those columns excluded.
Steven from iPhone
> On Feb 13, 2023, at 9:33 AM, Rolf Turner wrote:
>
>
>> On Sun, 12 Feb 2023 14:57:36 -0800
>> Jeff Newmiller wrote:
>>
>> x["V2"]
>>
>> is more
On Sun, 12 Feb 2023 14:57:36 -0800
Jeff Newmiller wrote:
> x["V2"]
>
> is more efficient than using drop=FALSE, and perfectly normal syntax
> (data frames are lists of columns).
I never cease to be amazed by the sagacity and perspicacity of the
designers of R. I would have worried that x[
Thanks Jeff and Andrew. My initial file, mydata, is a data frame with 92
columns (variables). After the operation (trimming), it remains a data
frame with 72 variables. So yes indeed, I do not need the drop=FALSE.
> is.data.frame(mydata) [1] TRUE > ncol(mydata) [1] 92 >
mydata<-mydata[,!grepl("
x["V2"]
is more efficient than using drop=FALSE, and perfectly normal syntax (data
frames are lists of columns). I would ignore the naysayers, or put a comment
in if you want to accelerate their uptake.
As I understand it, one of the main reasons tibbles exist is because of
drop=TRUE. List-sl
drop = FALSE means that should the indexing select exactly one column, then
return a data frame with one column, instead of the object in the column.
It's usually not necessary, but I've messed up some data before by assuming
the indexing always returns a data frame when it doesn't, so drop = FALSE
In the line suggested by Andrew Simmons,
mydata <- mydata[, !grepl("^yr", colnames(mydata)), drop = FALSE]
what does drop=FALSE do? Thanks.
On 1/14/2023 8:48 PM, Steven Yen wrote:
> Thanks to all. Very helpful.
>
> Steven from iPhone
>
>> On Jan 14, 2023, at 3:08 PM, Andrew Simmons wrote:
>>
>>
Dear R-Help-list,
I want to use the doubleYScale function from latticeExtra to overlap two
lattice graphs (cf. code below). The overlapping works but I lose the
groups of
every lattice, there are only two colors. Reading the documentation,
the arguments style1 and style2 give me the impression
13 matches
Mail list logo