Displaying 20 results from an estimated 801 matches for "melt".
Did you mean:
meet
2011 Aug 25
1
Specifying argument values in a function
Hello all,
I am trying write a fairly simple function that provide a quick way to
calculate several distributions for a data set. I am trying to provide
a function that has a argument that specifies which distribution is
outputted (here "norm" or "cumu"). I also have a melt argument but
that seems to be working fine. I have been able to get my function
working well for just one distribution but when I add another and try
to add a "dist.type" argument (with potential values "cumu" and
"norm"), I get an error message (see below). I am havin...
2008 Dec 10
4
tapply within a data.frame: a simpler alternative?
...10, len=100)
> my.df <- data.frame(x = rep(x, 3), y=c(3*sin(x), 2*cos(x),
> cos(2*x)), # note how the y values have a different maximum
> depending on the group
> group = factor(rep(c("sin", "cos", "cos2"), each=100)))
> library(reshape)
> df.melt <- melt(my.df, id=c("x","group")) # make a long format
> df.melt <- df.melt[ order(df.melt$group) ,] # order the data.frame
> by the group factor
> df.melt$norm <- do.call(c, tapply(df.melt$value, df.melt$group,
> function(.v) {.v / max(.v)})) # calculat...
2017 Jul 24
0
Compare output of Violin plot from ggplot2 and vioplot . Need Explanation
Hi,?
I have made violin plot with both ggplot2 and vioplot package with same data.?
The results and code are as follows.?
################### ?Loading data?
data.melt <- dget("https://gubox.box.com/shared/static/rirth0eym114afwyjxwe128sjzipzdym.txt")
################### ?Violin plot by library(vioplot)
library(vioplot)
data.use_11<- data.melt$value[data.melt$ident == 0]
data.use_12<- data.melt$value[data.melt$ident == 1]
data.use_13<- data...
2011 Oct 27
2
Syntax Check: rshape2 melt()
This is my first excursion into using reshape2 and I want to ensure that
the melt() function call is syntactically correct.
The unmodifed data frame is organized this way:
head(tds.anal)
site sampdate param quant
1 UDS-O 2006-12-06 TDS 10800
4 STC-FS 1996-06-14 Cond 280
7 UDS-O 2007-10-04 Mg 1620
9 UDS-O 2007-10-04 SO4 7580
19 JCM-10B 2007-06...
2008 Feb 28
1
Errors melt()ing data...
Hi,
I'm trying to melt() some data for subsequent cast()ing and am
encoutering errors.
The overall process requires a couple of casts()s and melt()s.
########Start Session 1##########
## I have the data in a (fully) melted format and can cast it fine...
> norm1[1:10,]
Pool SNP Sample.Name variable val...
2011 Sep 22
7
need help on melt/cast
...aframe from:
ID T0 T1 T2
A 1 2 3
B 4 5 6
C 7 8 9
to:
ID Variable Value
A T0 1
A T1 2
A T2 3
B T0 4
B T1 5
B T2 6
C T0 7
C T1 8
C T2 9
i tried to use melt cast but it gives me all the time not exactly what I
need.
Thank you.
[[alternative HTML version deleted]]
2008 Jul 25
3
melting a list: basic question
Dear list,
I'm trying to use the reshape package to perform a merging operation
on a list of data.frames as illustrated below,
> a <- 1:10
> example <- list( data.frame(a=a, b=sin(a)), data.frame(a=a,
> b=cos(a)) )
>
> melt(example, id = a)
this produces the desired result, where the data.frames have been
coerced into one with a common identifier variable "a". However, it
seems that if "a" is of mode numeric it is not recognized as an id
variable,
> a <- as.numeric(1:10)
>
> exa...
2008 Feb 07
1
Problems reshaping data with cast()
Hi,
I'm trying to cast() some data, but keep on getting the following error...
> norm.all.melted.height <- transform(all.melted.height,
+ norm.height = value / ave(value,
SNP, Pool, FUN = max)
+ )
Warning messages:
1: In FUN(X[[147L]], ...) :
no non-missing arguments to max; returning -Inf
2: In FUN(X[[147L]], ...)...
2009 Jan 22
1
melt stumbles over deleted columns
I have a data frame that is the result of a cast (reshape) operation. I
deleted the variable column and tried to melt the resulting data frame.
Depending on which method I use to delete the column I get different
error messages when melting:
> head(tinfos)
vpn group trial_no item relation trial_type rt variable #
1 102 2 1 4351 diag1 distractor 8471 fix_d 27
2 102 2...
2010 Dec 10
1
melt causes errors when characters and values are used
Hello,
I am finding that the melt function from the reshape library causes
errors when applied to a data.frame that contains numeric and character
columns. For example,
melt(id.vars="ID",data.frame(ID=1:3,date=c("a","b","c"),value=c(1,4,5)))
ID variable value
1 1 date a
2 2...
2013 Nov 23
1
how to melt variable to one variable
I want to make a stacked bar plot with one bar for two variables from my
data "chir", the two variables have about 100 values like no, yes and na. I
want to show how many no, yes and na they both have together with the
stacked bar. I tried to melt these to variables first like this:
melt1=melt(data_chir, measure.vars=c("N1_re", "N2_re"), var="zpd")
but it says " arguments imply differing number of rows: 98, 196"
maybe there is another way to make the plot without melt?
thanks in advance!
[[alter...
2011 Oct 31
1
reshape2: Lost Values Between melt() and dcast()
Working with 5 subset streams from my source data frame, three of them
successfully call dcast(), but two fail:
jerritt.cast <- dcast(jerritt.melt, site + sampdate ~ param)
Aggregation function missing: defaulting to length
and
winters.cast <- dcast(winters.melt, site + sampdate ~ param)
Aggregation function missing: defaulting to length
Yet both data frames have the values in their .melt data frames:
summary(jerritt.melt)
si...
2012 Jul 25
2
reshape -> reshape 2: function cast changed?
Hi,
I used to use reshape and moved to reshape2 (R 2.15.1). Now I tried some of my older scripts and was surprised that my cast function wasn't working like before.
What I did/want to do:
1) Melt a dataframe based on a vector specifying column names as measure.vars. Thats working so far:
dfm <- melt(df, measure.vars=n, variable_name = "species", na.rm = FALSE)
2) Recast the dataframe:
dfc <- cast(dfm, Var1 + Var2 + Var3 + Var4 ~ species,max) # with reshape
dfc <- dcast(d...
2010 Jun 18
3
inverse function of melt
Dear list,
I'm looking for an inverse function of melt(which is in package reshape).Namely, I had a data frame like this
(Table1)
YEAR VAR1 VAR2 VAR3
1995 7 3 45
1996 5 6 32
1997 6 10 15
I transformed my data by using the melt function and my data was reshaped in the following...
2016 Jun 24
3
Ayuda ggplot2
...004 y así ....y no X2003, X2004 que es
como están apareciendo.
Este es mi código:
library(reshape2)
library(ggplot2)
emp <- read.csv("C:/Users/usuario/Documents/tamano_empresas.csv",
header=TRUE, sep=";", comment.char="" , strip.white=FALSE, dec = ",")
melted = melt(emp, id.vars="Empresas")
ggplot(data=melted, aes(variable, value)) + geom_line(aes(colour =
Empresas, group = Empresas)) + facet_wrap(~ Empresas)
Agradezco cualquier ayuda. Adjunto el dataset.
Muchas gracias.
------------ próxima parte ------------
Se ha borrado un adjunto en...
2012 Oct 17
1
Comparing dcast and reshape
I'm in the middle of my own little intellectual exercise comparing
dcast() and reshape() and have successfully stumped myself. I want to
melt() a data frame, then dcast() it into a new form. After doing so, I
want to duplicate the process using reshape().
So far, I can do the melt and cast
require(reshape2)
Raw <- data.frame(site = c(1, 1, 1, 1, 2, 2, 2, 2),
id = c(1, 1, 2, 2, 1, 1, 2, 2),
i...
2013 Nov 17
1
melt dataframe
Hi,
Try:
dat1 <- read.csv("precipitationRglimclim.csv",header=TRUE,stringsAsFactors=FALSE,sep="\t")
library(reshape2)
dat2M <- melt(dat1,id.var=c("year","month","day"))
dat2M1 <- dat2M[with(dat2M,order(year,month,day,variable)),]
?dim(dat2M1)
#[1] 1972320?????? 5
?row.names(dat2M1) <- 1:nrow(dat2M1)
?colnames(dat2M1)[4:5] <- c("site","rain")
16436*120
#[1] 1972320
A....
2013 Jan 16
4
Changing frequency values to 1 and 0
...with a large data set, where I grouped several species in one
group (guild). Then I reshaped my data as shown below. Now, I just want to
have "Rep" only as 1 or 0.
I'm not being able to change the values of rep>=1 to 1... tried many things
and I'm not being successful!
> melting=melt(occ.data,id.var=c("guild", "Site", "Rep", "Año"),
measure.var="Pres")
> y=cast(melting, Site ~ Rep ~ guild ~ Año)
Aggregation requires fun.aggregate: length used as default
> y[1:10,,"gui4a",1:2]
, , Año = 2003
Rep
Si...
2005 Jul 26
3
Melting TDM card
...modules. I installed
it (in the correct type PCI slot) , plugged in the power, and fired up the
system. A few minutes later everyone in the office is complaining about
something burning. I open the server again, and the top of the Digium card
is black, slightly deformed, and looks and smells of melted plastic. The
funny thing is.the card still works just fine (as far as my testing has
revealed, anyway. I haven't tried ringing the lines, just placing calls
from them). Maybe this is how Digium knows if a card is returned used or
not?
Still, nothing was touching the card, it was in the...
2011 Mar 10
2
Reshape, melt and cast query
I have a dataset that is based on crop output for a single crop
*sugarcane*...but
each observation is further subdivided into 3 kinds of sugarcane
i have read the file and have also used melt it to sort it on the
basis of *crop
group* using
melt(sugarcane, m=c("Crop_group")) -> canefile
this is how it has cast the data
variable value
1 Crop_group Sugarcane (first ratoon)
2 Crop_group Sugarcane (planted crop)
3 Crop_group Sugarcane (planted crop)...