Displaying 20 results from an estimated 1000 matches similar to: "Memory management in R"
2016 Apr 24
0
assign color to subsets
now after this:
df_both <- subset(df, grepl("t1", Command) & grepl("t2", Command))
I use factor to apply the subset to df but then the Command level becomes 0
df_both$Command=factor(df_both$Command)
str(df_both)
$ Protocol : Factor w/ 0 levels:
Do you know what is the reason?
Thanks for replying
On Sunday, April 24, 2016 12:18 PM, jim
2016 Apr 24
1
assign color to subsets
'grepl' returns a logical vector; you have to use this to get your subset.
You can use:
df_tq <- subset(df, grepl("t1", Command))
df_t2 <- subset(df, grepl("t2", Command))
# if you want to also get a subset that has both, use
df_both <- subset(df, grepl("t1", Command) & grepl("t2", Command))
Jim Holtman
Data Munger Guru
What is
2016 Apr 30
3
how to use AND in grepl
Hi all,
I have one factor variable in my df and I want to extract the names from it which contain both "t2" and "pd":
'data.frame': 36919 obs. of 162 variables
$TE :int 38,41,11,52,48,75,.....
$TR :int 100,210,548,546,.....
$Command :factor W/2229 levels
2016 Apr 10
0
what is the faster way to search for a pattern in a few million entries data frame ?
On 04/10/2016 03:27 PM, Fabien Tarrade wrote:
> Hi Duncan,
>> Didn't you post the same question yesterday? Perhaps nobody answered
>> because your question is unanswerable.
> sorry, I got a email that my message was waiting for approval and when I
> look at the forum I didn't see my message and this is why I sent it
> again and this time I did check that the
2023 Jan 14
2
Removing variables from data frame with a wile card
Thanks to all. Very helpful.
Steven from iPhone
> On Jan 14, 2023, at 3:08 PM, Andrew Simmons <akwsimmo at gmail.com> wrote:
>
> ?You'll want to use grep() or grepl(). By default, grep() uses extended
> regular expressions to find matches, but you can also use perl regular
> expressions and globbing (after converting to a regular expression).
> For example:
>
2023 Jan 14
1
Removing variables from data frame with a wile card
You'll want to use grep() or grepl(). By default, grep() uses extended
regular expressions to find matches, but you can also use perl regular
expressions and globbing (after converting to a regular expression).
For example:
grepl("^yr", colnames(mydata))
will tell you which 'colnames' start with "yr". If you'd rather you
use globbing:
2016 Apr 22
0
subset by multiple letters condition
You can use the grepl() function to give you logicals for each criterion,
then combine them as needed. For example:
# example version of Command
Command <- paste0("_localize_", c("PD","t2","t1_seq", "abc", "xyz",
"PD_t1"))
hasPD <- grepl("PD", Command, fixed=TRUE)
hast1 <- grepl("t1", Command,
2019 Aug 09
3
Underscores in package names
I do not follow you Gabriel. Package name must not use digit numbers.
Tarbal will use them, taken from the DESCRIPTION file, version field.
That's why I consider the weird case name you presented as irrelevant, and
not to be considered.
Le ven. 9 ao?t 2019 ? 20:41, Gabriel Becker <gabembecker at gmail.com> a
?crit :
>
>
> On Fri, Aug 9, 2019 at 11:05 AM neonira Arinoem
2016 Apr 28
2
Combinaciones sin repetición...con restricciones
Hola, Carlos.
Primero, muchas gracias por el código. No es exactamente lo que quería,
porque la parte "Detección de presencia de "cual_1" y "cual_2"... no
excluye aquellas combinaciones en las que está presente también el objeto
c, pero me ha servido de base e inspiración para elaborar otro código.
He copiado la primera parte de tu función, para crear todas las
2016 Apr 23
1
subset by multiple letters condition
Thanks Jean, Does anyone know how to set these [hast1] and [hast2] as the colors of a plot?
On Friday, April 22, 2016 7:39 AM, "Adams, Jean" <jvadams at usgs.gov> wrote:
You can use the grepl() function to give you logicals for each criterion, then combine them as needed. For example:
# example version of Command
Command <- paste0("_localize_",
2013 Feb 05
2
R Regular Expressions - Metacharacters
I thought that I can use metacharacters such as \w to match word characters
with one backslash. But for some reason, I need to include two backslashes.
> grepl(pattern='\w', x="what")
Error: '\w' is an unrecognized escape in character string starting "\w"
> grepl(pattern='\\w', x="what")
[1] TRUE
I can't find the reason for this
2023 Feb 12
2
Removing variables from data frame with a wile card
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-slice (single-dimension) indexing works equally well with both standard and tibble types of data
2017 Jun 29
0
Different date formats in one column
I doubt your actual file looks like the mess that made it to my email
software (below) because you posted HTML-format email. Read the Posting
Guide, and in particular figure out how to send plain text email.
You might try the "anytime" contributed package, though I suspect it too
will choke on your mess. Otherwise, that will pretty much leave only a
brute-force series of regular
2020 Sep 22
2
Encontrar un dato y añadirlo a otra columna
Buenas,
A ver si alguien sabe como hacer lo siguiente:
Tengo un df con letras y numeros, quiero que si me detecta un numero en concreto me a?ada dicho numero en otra columna.
Algo asi
df<-data.frame(c("AV 23","PEPE 34","QWE","AV 24","WERRR ER34","AV 25"))
colnames(df)<-c("nombre1")
df[grepl("AV
2017 Jun 29
1
Different date formats in one column
Thanks Jeff. This is a nice way of solving this problem. What about the cases with 0015-02-21?Many thanks.?Best,Farnoosh
On Wednesday, June 28, 2017 10:49 PM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:
I doubt your actual file looks like the mess that made it to my email
software (below) because you posted HTML-format email. Read the Posting
Guide, and in particular
2013 Jan 21
2
Regex for ^ (the caret symbol)?
Hello R-helpers,
I am trying to search for string that includes the caret symbol, using the
following code:
grepl("latitude^2",temp)
And R doesn't like that. It gives me:
> temp<-c("latitude^2","latitude and latitude^2","longitude^2","longitude
and longitude^2")
> temp
[1] "latitude^2" "latitude and
2009 Oct 06
2
Help file doesn't display correctly
Dear R Developer,
It seems to be a problem with help file. Not sure if it is related to
the new format of Rd parser. Multiple lines are joined together
without proper line break.
> ?mean
There were 14 warnings (use warnings() to see them)
## All lines are joined together and not easy to read.
> warnings()
Warning messages:
1: In grepl("^[[:blank:]]*$", buffer[length(buffer)]) :
2011 Feb 19
1
Accessing Package NEWS (NEWS.Rd)
Okay. So, after having spent quite some time never really tracking down
why my package NEWS files were unacceptable to readNEWS(), I
noticed that there was recent (to me anyway) development that allowed
the NEWS to be done as an Rd file. Sweet! A more standard format...
I converted a NEWS file in one of my unreleased packages to Rd format.
checkNEWS() gave it a thumbs up.
But then it went south.
2023 May 30
3
why does [A-Z] include 'T' in an Estonian locale?
Inspired by this old Stack Overflow question
https://stackoverflow.com/questions/19765610/when-does-locale-affect-rs-regular-expressions
I was wondering why this is TRUE:
Sys.setlocale("LC_ALL", "et_EE")
grepl("[A-Z]", "T")
TRE's documentation at
<https://laurikari.net/tre/documentation/regex-syntax/> says that a
range "is shorthand for
2012 Jun 23
1
globalVariables()
Dear r-devel list members,
By placing a call to the new (with R 2.15.1) globalVariables() in the development version of the Rcmdr package, I've succeeded in reducing the "notes" produced by R CMD check from dozens to two. But I still get the following notes, even though '.commander.done' is in the call to globalVariables():
------------- snip ------------
* checking R code