Questions tagged [mutated]
77 questions
0
votes
2 answers
How can I extract negative values from an existing column into a new column
I have a dataframe (sy2.1) with a column (Vannstand2.cm) containing both positive and negative values of water level. I want to separate the negative and positive values into two new columns, whilst still keeping the original column. I have tried to…

Saron B
- 39
- 6
0
votes
1 answer
In using dplyr in R, how to merge 2 separate mutate statements operating on the same object?
The below MWE code works as intended. In summary:
the first data1 <- ...mutate(...) adds a new column "minusD" calculated as (i) the current row "plusB" value + (ii) prior row "PlusB" value if the id is the same when moving from one row to the next…

Curious Jorge - user9788072
- 2,548
- 1
- 9
- 22
0
votes
1 answer
mutate column in a for loop if the iterated column name contains a certain month
I am trying to get a for loop to iterate over each total return column in x and if the column name includes Jan, Apr, Jul or Oct mutate the Index.Wgt column in Data by replacing it with the Rebal_Wgt column.
In the other months Index.Wgt will grow…

Delagator123
- 31
- 3
0
votes
3 answers
Hos can I add a column porcentaje based on other column in my data frame?
I would like to create a column in my data frame that gives the percentage of each category. The total (100%) would be the summary of the column Score.
My data looks like
Client Score
1 RP 125
2 DM 30
Expected
Client …

Clara Rodriguez
- 55
- 5
0
votes
1 answer
mutate not adding the correct column name when performing calculation
When I try to add a column within a function using inputs from the function, a column is added with the wrong name. Here is a sample of the data:
AllGlut1 <- data.frame(Date = c("11/1/2021", "11/2/2021", "11/3/2021"), Row = c(3, 6, 8), d.15N.14N =…

Andi Noakes
- 21
- 5
0
votes
1 answer
Add and change key/value in ordered dictionary without mutating
I am trying to split a value into three different ones with new keys and add them to my dictionary. But I always get the error message: RuntimeError: OrderedDict mutated during iteration
def csv_to_dic(file):
with open(file, "r") as csvfile:
…

JensJacobs
- 3
- 5
0
votes
0 answers
Why the reference to an object in java is not modified when re-assigning the object?
I have this piece of code, and I would like to know why the reference of my variable x is not modified ? It still points to the first object assigned:
public class HelloWorld{
public static void main(String []args){
Object x = new Object();
…

darthfather
- 377
- 3
- 12
0
votes
2 answers
forloop inside dplyr mutate
I would like to do a few column operations using mutate in more elegant way as I have more than 200 columns in my table that I would like transform using mutate.
here is an example
Sample data:
df <-…

Deep
- 77
- 7
0
votes
1 answer
Javascript regex replace has to keep german mutated vowels
In a search field there should only be allowed regular characters and german mutated vowels like ä, ö, ü, Ä, Ö, Ü and ß.
My regex looks like:
/(<([^>]+)>)|[^a-zA-Z0-9äöüÄÖÜß\s]/ig
The replace:
phrase.replace(regex, "")
Before the…

Bernhard Kraus
- 329
- 1
- 3
- 21
0
votes
1 answer
R dplyr identifying a condition sequence in one column and mutating another (or so)
I have eye tracking data in the following form:
smp x y time dur
1 1 491 798 62 0
2 2 491 798 62 0
3 3 491 798 62 0
4 4 491 798 62 0
5 5 491 798 62 0
6 6 491 798 62 0
7 7 491…

Chris
- 1,647
- 1
- 18
- 25
0
votes
1 answer
Mutate dataframes by matching ids in r
I have three data frames:
df1:
id score1
1 50
2 23
3 40
4 68
5 82
6 38
df2:
id score2
1 33
2 23
4 64
5 12
6 32
df3:
id score3
1 50
2 23
3 40
4 68
5 82
I want to mutate the three scores to a dataframe like this,…

William Liu
- 339
- 1
- 2
- 9
0
votes
2 answers
Swift - GCD mutable array multiple threads issue "mutated while being enumerated"
I am currently developing a game where spheres are falling from the sky. While collecting spheres you gain points and after a certain amount of points all spheres accelerate to another speed.
New spheres are continuously added to an Array (4…

hardyfelix
- 212
- 3
- 11
0
votes
1 answer
ruby 2.0, why is #each_line mutating File object
I'm running irb as a one-off text preprocessing tool. I ran into immediate trouble just printing the text.
foo = File.open "bar"
foo.each_line {|l| puts l}
This prints as intended and returns #.
However, if I call #each_line…
user2016239
0
votes
1 answer
NSArrayM was mutated while being enumerated
App crashes with error:
*** Terminating app due to uncaught exception 'NSGenericException', reason: '*** Collection <__NSArrayM: 0x21481c10> was mutated while being enumerated.'
This happen only if I move over mapview when my annotations is…

Pavel Kaljunen
- 1,291
- 2
- 26
- 53
-1
votes
1 answer
How can I create a new column in R with aggregated values from another column
I would like to create a column with aggregated values from the column country
To an aggregated/classified column of subregions. For example,

Costa Wesele
- 1
- 1