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

R spread function using tidyverse to get wide format of colon separated column

I have dataframe of id of car workshop and cars they fix: id = c(1,2,3,4,5) cars = c("Toyota; Fiat","Crysler","Ford; BMW; Audi", "BMW; Porsche; Audi; Fiat; Peugeot", "") cbind.data.frame(id,cars) id cars 1 …
M.wol
  • 901
  • 3
  • 10
  • 21
0
votes
2 answers

spread() is producing NA values.(R programming)

I am downloading data from census.gov using R library tidycensus data. then i am transforming data using spread(). Each geoid has many columns with estimate value, but it is producing NA for rest of the columns. actual data data after applying…
0
votes
1 answer

Cancel EnterCell event of spread farpoint

My program use spread farpoint as a 3rd-party control, it has a TextBox control and a Spread control for showing data. When user change active cell in spread, I want to validate that the TextBox must not empty. If the TextBox is empty, EnterCell…
huypham99
  • 67
  • 7
0
votes
1 answer

Is this reduce function using spread or rest?

I am having a little trouble differentiating between spread and rest. Could someone explain to me if either spread or rest is being used within the reduce functions return statement? This is what I am not understanding: return [currentValue,…
0
votes
1 answer

JavaScript: Pass unknown number of arguments from one method to another

Here is what I would like to do. I have two methods, the first of which can accept any number of arguments. This method is an intermediary, it does not know how many arguments it is going to receive, but it needs to pass all its arguments along to…
Nate
  • 95
  • 7
0
votes
2 answers

Using pivot_longer and pivot_gather to tidy a dummy-filled dataframe

Friends, hello! I have a dataframe of some 2 million employees from one industry and the firms they have worked with from 2000-2019. It looks something like this:  | ID | FIRM | NAICS | Q1 | Q2 | Q3 | Q4 | | A  |   001 |   100 |  1 |  1 |  1 | …
0
votes
2 answers

Spread a data.frame with repetitive column

I have a large data.frame that I am trying to spread. A toy example looks like this. data = data.frame(date = rep(c("2019", "2020"), 2), ticker = c("SPY", "SPY", "MSFT", "MSFT"), value = c(1, 2, 3, 4)) head(data) date ticker value 1 2019 SPY …
Jordan Wrong
  • 1,205
  • 1
  • 12
  • 32
0
votes
1 answer

Transpose data from multiple rows per person to one row per person in R

I've got data set showing each persons' candy preferences. Each person has multiple rows to display all of the candy that they like, like shown below. Name ID Candy Alex 101 Kit Kat Alex 101 Twix Sam 102 …
alechengg
  • 3
  • 2
0
votes
1 answer

For of and for loop different results

Can anyone explain, why the first solution using a regular for loop infinitely loops, whereas the second solution using a for of loop doesn’t. The code is identical, so I would expect the same results. const flatten = (arr) => { let newArr =…
Altaf
  • 399
  • 1
  • 5
  • 15
0
votes
1 answer

How do i use spread operator for multiple vuex modules?

I looked into another post describing that this should work, but I keep getting the errormessage: 'TypeError: Cannot convert undefined or null to object' computed: { ...mapGetters ("candidates", ["people"] ), ...mapGetters…
0
votes
0 answers

How to transform from long format to wide format when the vector of factor is different by each object?

I have a multiple tibble in a list, later the data were unlisted using rbindlist. With these data I try to transform from long format to wide format, but the factor used to get this result is different in each case, and this affects the spread…
0
votes
1 answer

AssertionError using the spread operator

Trying to write a function using the spread operator to add an element to an array. Below is the code I wrote which keeps returning AssertionError: expected [ Array(5) ] to deeply equal [ 'foo', 1 ] var chocolateBars = ["snickers", "hundred grand",…
0
votes
2 answers

Un-paired t-test using data within one column

I want to do an unpaired t-test to examine if values differ between sites in each type category. So my question is, within types (AB or CD), do values (valueA or valueB) differ between sites (A or B)? Here is an example of my data: dat <-…
cgxytf
  • 421
  • 4
  • 11
0
votes
2 answers

How to change a R table from long to wide with dates as well?

I have a dataframe of purchasing events and ages of the individual. Name Item Date PersonA Apple 1/1/14 PersonA Banana 1/1/13 PersonA Pear 1/1/12 PersonB Orange 1/1/15 PersonC Kiwi 1/1/17 PersonC Grapes …
0
votes
2 answers

Spreading a dataframe with two grouping columns

I have a data set of teachers as follows: df <- data.frame( teacher = c("A", "A", "A", "A", "B", "B", "C", 'C'), seg = c("1", '1', "2", "2", "1", "2", "1", "2"), claim = c( "beth", 'john', 'john', 'beth', 'summer', …
NewBee
  • 990
  • 1
  • 7
  • 26