Questions tagged [dcast]

267 questions
1
vote
1 answer

How to do a plotly graph after a dcast table?

I have a database including day and places, with other relevant information. I am currently using the dcast function in order to count each occurence in a day and place (that in the real database are represented by numbers). Later, I want to do a…
L8call
  • 87
  • 1
  • 1
  • 6
1
vote
2 answers

R tidyr spread Error: Duplicate identifiers for rows

I'm having an issue with the tidyr::spread()function on R. Previously I runned the melt() function to remove NAs values and shrink my data. `NPP0 <- melt(NPP, variable.names("3", "13", "14", "15", "16", "24", "25", "26"), na.rm=T)` It worked…
1
vote
2 answers

Convert Speech Start and End Time into Time Series

I am looking to convert the following R data frame into one that is indexed by seconds and have no idea how to do it. Maybe dcast but then in confused on how to expand out the word that's being spoken. startTime endTime word 1 1.900s …
Andrew Olson
  • 143
  • 6
1
vote
0 answers

dcast (data.table) error, attempts aggregation with no duplicates

First, I apologize for clunky formatting...I do not program, just trying to learn r and run some analyses... I am running dcast to reshape a dataset from long to wide. This code was used previously without issues, but now about 6 months later it…
smd
  • 11
  • 1
1
vote
2 answers

Dcast aggregate from melted data to long format

I did this successfully with one subset of a data frame but I can't seem to get it to work with my other subset. There is info for about 4000 orders with a range of 0 - 8 months and sentiment of 0-5. The goal is to melt the data with id's of 'order'…
ILikeWhiskey
  • 551
  • 5
  • 12
1
vote
1 answer

Reordering columns with multiple variables in var.values after dcast

I have used dcast to put a data.table into a wide format. Since I have many columns now (because I specified multiple variables in the var.values argument, I'd like to reorder the columns. This is an example for the data I have…
1
vote
1 answer

R cast can't deal with unique rows

Question I have cluster.id and corresponding to these cluster.id's I have the different letters found in each cluster (as simplification). I'm interested in which letters are generally found together over the different clusters (I used the code…
CodeNoob
  • 1,988
  • 1
  • 11
  • 33
1
vote
2 answers

Error when using pander on a data.table created with data.table::dcast

this is more a question of interest, as I found a work-around, although I don't find it pretty. When I updated the pander package (to 0.6.1) an error started to occure whenever I try to to use pander() on a data.table in wide format that was…
I Ho
  • 147
  • 1
  • 6
1
vote
2 answers

R - rotating a difficult data frame

Suppose I've got sales data for three sales reps selling a variety of products. What makes it difficult is that each rep sells a different combination of products, and not necessarily the same number of them, either: Bob sells Products A, B, and…
1
vote
1 answer

Transpose R data frame and concatenate values that occur in multiple columns

I need to transform a data frame in R from something like this: id past present future id1 A A B id2 B C id3 A C id4 B B A To this: id A B …
Lisa
  • 323
  • 1
  • 3
  • 11
1
vote
1 answer

R - dcast from Reshape2 - order by value variable and not variable name

I have following data.frame named countries_tools. It consists of 3 columns (a datetime column (for the last 13 months), a name column (with countries) and a visits column (people visiting the page from those particular countries)): datetime …
agustin
  • 1,311
  • 20
  • 42
1
vote
1 answer

R transforming data from columns to rows by variable

I am facing a problem with transforming my data frame. I would like to count how often (once in how many days) does each client buy. I thout that it would be easiest to transform my data about transactions formated as: Transatcion_ID Client_ID …
AAAA
  • 461
  • 6
  • 22
1
vote
3 answers

Formula for dcast'ing a data.frame

I have a data.frame with colnames: A01, A02, ..., A25, ..., Z01, ..., Z25 (altogether 26*25). For example: set.seed(1) df <- data.frame(matrix(rnorm(26*25),ncol=26*25,nrow=1)) cols <- c(paste("0",1:9,sep=""),10:25) colnames(df) <-…
dan
  • 6,048
  • 10
  • 57
  • 125
1
vote
2 answers

group a column by values of second column based on condition from third column in data.table

I have a large data.table from which I want to group one column based on the value of another column that meets the criteria from a third column. I can do this with a loop but I wonder if it can be done in data.table? The table looks like this: …
Camilo
  • 201
  • 2
  • 6
1
vote
2 answers

Reshape data from long to wide format - more than one variable

I’m trying to reshape my data from long to wide formula using the dcast function from reshape2. The objective is to use different variables in the value.var parameter but R doesn't let me use more than one value in it. Is there any other way I…
Juanma
  • 195
  • 2
  • 4
  • 12