search for: melted

Displaying 20 results from an estimated 796 matches for "melted".

2011 Aug 25
1
Specifying argument values in a function
..., 0, 200) ) my.norm <- function(x, melt=TRUE) { #Normalized distribution N.dist <- as.data.frame(sapply(1:length(x), function(i) (x[[i]]/rowSums(x[,c(1:4)]))*100 )) norm.melt <- melt.data.frame(N.dist) if (melt == TRUE) ##Default is a melted data frame return(norm.melt) if (melt == FALSE) return(N.dist) } ## So this single distribution function works fine my.norm(dat, melt=TRUE) my.fun <- function(x, melt=TRUE, dist.type=norm) { #Normalized distribution N.dist <- as.data...
2008 Dec 10
4
tapply within a data.frame: a simpler alternative?
Dear list, I have a data.frame with x, y values and a 3-level factor "group", say. I want to create a new column in this data.frame with the values of y scaled to 1 by group. Perhaps the example below describes it best: > x <- seq(0, 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
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]
2011 Oct 27
2
Syntax Check: rshape2 melt()
...0 with the actual data for each param, of course. I've read the reshape.pdf, reshape2.pdf, the ?melt help page, and the ?melt.data.frame help page. I'm still unclear on the differences among measure.vars, variable.name, and value.name. After several attempts I have what may be what the melted tds.anal should look like: m.tds.anal <- melt(tds.anal, id.vars = c('site', 'sampdate', 'param'), \ measure.vars = 'quant', value.name = 'quant', na.rm = F) > head(m.tds.anal) site sampdate param variable quant 1 UDS-O 2006-12-06 TDS qua...
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 value 1 1 rs1045485 CA0092 Height.1 0.003488853 2 1 rs1045485 CA0142 Height.2 0.333274200 3 1 rs1045485 CO0007 Height.2 0.396250961 4 1 rs1045485 CA0047 Height.2 0.53568...
2011 Sep 22
7
need help on melt/cast
Hello, I need to convert dataframe 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
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
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
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 date b 3 3 date c 4 1 value <NA> 5 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
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
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
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 format: (Table2) YEAR variable
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 f...
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 =
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] <-
2013 Jan 16
4
Changing frequency values to 1 and 0
Dear list, I'm working 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",
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 r...
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