Questions tagged [spread]

This tag relates to the R spread function. For the javascript spread syntax - please use spread-syntax.

Some of the features are:

  1. Powerful Formula Engine with 300+ Excel Functions
  2. Full Excel Import/Export, PDF, and Print
  3. Support Input, Display, and Data Visualization Controls
  4. Visual Drag-and-Drop Designers
420 questions
0
votes
0 answers

Why dosen't it change when using spread funtion?

In this case, a is changed. var a = [{a: 1, b: 2}, {a: 3, b: 4}, {a : 5, b : 6}]; a.forEach(x => x.a = 7); 0: {a: 7, b: 2} 1: {a: 7, b: 4} 2: {a: 7, b: 6} But in this case a is not changed. var a = [{a: 1, b: 2}, {a: 3, b: 4}, {a : 5, b :…
erin
  • 1
  • 1
0
votes
2 answers

Why do I have to spread my object twice when copying state from my react object

I have this object below, I want to test that when i perform an action to change the state of the group key in the state that it updates correctly. As you can see there are way more key value pairs in this object than just group so I would like to…
0
votes
1 answer

Conditional mutate based on a column of duplicate data and conversion from long to wide format using dplyr

I am trying to reorganize some data from long to wide format. There are many individuals (MRNs), each of whom had sequencing done a different number of times (seq_date) and I want to create a data frame that shows the change in the Val over…
0
votes
1 answer

How can I Combine using Spread Operator in TypeScript for an Object

I need to add values to a object using the Spread operator. But when I use it the previous values getting removed from the object. My object is like let newObj = { name: 'sachin', lastname: 'Tendulkar', full_name: 'Sachin Ramesh Tendulkar', test: { …
Renjith Krishnan
  • 2,446
  • 5
  • 29
  • 53
0
votes
3 answers

Where is the truthy value for the ternary operator to execute upon in this code?

Some background for this coding problem. Our termTopics function needs to count how many times each of those topics was mentioned in the surveys, and then return an array with the number of mentions in the following order: smart city, arts funding,…
0
votes
0 answers

Can't convert from long to wide

I am trying to convert data from long format to wide format using spread function in R, it works but not correctly and transforms dataset wrongly. dbv_fc1<-read.csv("dbtest_forum.csv",header = TRUE,na.strings=0) data_new <- dbv_fc1 %>% spread(test,…
Usman
  • 29
  • 5
0
votes
2 answers

Is it possible, 2 spread have 1 sheet to use farpoint spread

For example, 'A' spread and 'B' spread have same spread sheet(same design, and same formulars). So, if change the value in 'A' spread than change the same value in 'B' spread automatically. It is sure the same cell. Is it possible to simply?…
cardbt
  • 1
  • 1
0
votes
3 answers

Spread operator error in return value, parse error

When trying to directly return an item that contains the spread operator I get a parse error. If I assign it to an object before returning it there is no parse error. I'd like to know why. When I saw the parse error point to the spread operator my…
0
votes
2 answers

Replace an Array of Objects with a different Array in JS

I have an Array of Items. Each Item in the Array, has a set of Properties. One of them is called config: object[]. It is an array of Objects. Normally, I provide the full object with the correct config array of objects, but for some of my tests, I…
user10104341
0
votes
2 answers

Why spread operator turn my array into numbers

i have a = [[1,2,3],[4,5,6]] How come when i write console.log(...a.shift()) it gives me 1 2 3 but not 1,2,3 nor [1, 2, 3] can anyone explain me the mechanism behind this?
0
votes
0 answers

Issues spreading data after removing outliers

I put my data into long format, in order to remove outliers (I grouped by grade and condition, and then removed by 1.5 * IQR), however, I'm having issues getting it back into wide format. The final two columns (condition and variable (36, 37) are…
James
  • 459
  • 2
  • 14
0
votes
3 answers

Repeated columns a into new row

I have repeated values in column a and I want these to become new row with information from column b. I've tried the tidyr function for gather and…
Sparky
  • 349
  • 1
  • 12
0
votes
1 answer

Using rest/spread syntax to merge an array of objects into a single object

This bit of code works as intended; however, it's not scalabe for any kind of input: const input = [{optionA: {a: 1}, optionB: {b: 1}, optionC: {c: 1}]; input.map(({optionA, optionB, optionC}) => { return Object.assign({}, optionA, optionB,…
Armeen Moon
  • 18,061
  • 35
  • 120
  • 233
0
votes
4 answers

Why does this function returns undefined?

I want to check if one of arguments equal 3. If it does i want to return true but i get undefined. Why is that ? function isThree(...args){ args.forEach(val => { if(val === 3){ return true; } else{ return false; } …
Dean Novak
  • 65
  • 3
  • 10
0
votes
1 answer

Spread columns in R generates an out of memory

I have a survey form and I need to group this dataset to a single row, but I have some problems with the use of spread and group. My dataset has the next format: data country date_ user_id int_id user_name ext_name q_order questions …
Fernando
  • 7
  • 3