31,029 questions
2
votes
2
answers
92
views
Make a new column based on the count of rows, in an existing column, that meet a condition
My dataframe is called detections. One column is OBSERVER. That column contains the initials of 32 different people. Some of those observers are responsible for 1000+ observations (i.e. 1000+ lines ...
0
votes
3
answers
190
views
How to use regex in R to shorten strings by one space
I have some old data files with a large number of writing errors. An example is attached below, where some of the numbers in the .dat file are 9 digits or characters long rather than the expected 8.
...
3
votes
1
answer
122
views
Replacing several rows of data in a column efficiently using condition in a pipeline
I have the following dataframe:
df <- data.frame(
Form=rep(c("Fast", "Medium", "Slow"), each = 3),
Parameter =rep(c("Fmax", "TMAX", "B&...
-1
votes
1
answer
216
views
Why replace works with a boolean mask?
The R documentation for replace states:
replace replaces the values in x with indices given in list by those given in values. If necessary, the values in values are recycled.
Usage
replace(x, list, ...
0
votes
1
answer
117
views
How to use the win32com library to modify a Word document and save it to a new Word file
I'm using Python with pywin32 to find and replace text in a Word document (a.docx).
The code finds the target string "123", but when I save the document with the replaced strings to a new ...
0
votes
1
answer
81
views
Change micropython unicode notation from \xb0 to \u00b0 in string
I am using Micropython on the ESP32.
I have the following string, which includes the unicode character \xb0.
a = 'abc\xb0def'
First, I will need to change the notation to the \U00XX form, second I ...
-1
votes
0
answers
46
views
How to replace string by new line in Powershell 5 [duplicate]
I have a file with some strings like below for which I want to replace the || with newline using powershell 5.1.
This is || some test || string
I've follow some advices in this thread and I'm trying ...
0
votes
2
answers
129
views
Replace values in multiple columns in a data frame based on conditions in another data frame? [duplicate]
I'm working with a data frame where the color of an object (red or green) was recorded in ordinal classes corresponding to percent coverage.
I am looking to replace all the classes with their ...
-2
votes
1
answer
124
views
Arabic Word Normalization and Search Ignoring Prefixes and Suffixes in quran app [closed]
I’m developing a Qur’an search application that allows users to search for Arabic words and find their occurrences across the Qur’an.
To improve accuracy, I added a feature that removes Arabic ...
3
votes
1
answer
89
views
Replace part of strings with corresponding values from table in R
I have a list of file names that encode some information as a time stamp. I would like to replace the time stamp with the appropriate corresponding information, while retaining the rest of the ...
0
votes
2
answers
118
views
Search / replace in R with a capture group
In a Quarto book, I mention R functions as back-quoted strings in text like this, always ending in ()
test <- "The functions `lm()` and `car::vif()` are good test cases"
I would like to ...
2
votes
3
answers
182
views
How to properly replace long strings in Perl
Let's say I want to replace every occurrence of 12345 in file1 with the contents of file2. The following code works:
use strict;
use warnings;
local $/;
open my $fh, 'file1' or die "$!";
...
0
votes
3
answers
199
views
:args and ripgrep in neovim
Question
I am trying to find a string across multiple files using ripgrep where the string has lots of characters that would need to be manually escaped if I were to subsequently replace the string ...
0
votes
2
answers
84
views
c# regex replace string within a specified string with spaces [duplicate]
can you please help me on how can I replace the strings inside <value></value> with emplty strings using regex please.
Input string:
"This is a sample string <value>another ...
0
votes
0
answers
40
views
nvim : map multiple-words
I want to define a map for a several-words expression.
In ~/.config/nvim/init.vim :
:map abc a-b-c
works perfectly well.
But I want to do something like
:map a\ b\ c a-b-c
If I type "a b c"...