Displaying 20 results from an estimated 110 matches similar to: "how to melt variable to one variable"
2005 May 26
1
specifying values in correlation matrix in nlme
Could anyone help with a linear mixed model fitting problem ?
The model is :
Y= Xp + Zu + e
where X, Z are known design matrix, p is fixed effect factor, u is
random effect, u~ (0, G) , e~(0,R)
The main problem is , I want to fix the covariance matrix G to be a
constant times a known covariance matrix A, G = c*A (c is positive
constant, A is a predefined matrix with values manually set by
2013 May 11
3
boxplot with grouped variables
my dataset looked like this in the beginning:
>Daten
V1 V2 V3
1 Dosis Gewicht Geschlecht
2 0 6.62 m
3 0 6.65 m
4 0 5.78 m
5 0 5.63 m
I need box plots for V2 with all combination of V1 and V3, so I deleted the
first row, and tried this:
boxplot(Daten$V2[Daten$V3=="m"])
but it does not work and I
2012 Mar 19
0
Reshape data frame with dcast and melt
Hello,
I implemented two functions reshape_long and reshape_wide (see full working
example below) to reshape data frames.
I created several small examples and the two functions seemed to work
properly. However, using the reshape_wide function
on my real data sets (about 200.000 to 300.000 rows) failed. What happens is
set all values for X, Y and Z were set to 1.
The structure of my real data
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] <-
2007 Nov 28
1
ggplot2 melt function "value"
Hi:I recently started using the melt function and
found that it is very useful and powerful,however I
can't seem to find the way to change the default
column header "value" to my custom column name. Does
anyone know how to go about this? any suggestions are
very appreciated. Thanks
Felipe D. Carrillo
Fishery Biologist
US Fish & Wildlife Service
California, USA
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
2009 Mar 31
1
Reshape: 'melt' numerous objects
Dear R Users,
I'm trying to use the reshape package to 'melt' my gridded data into column format. I've done this before on individual files, but this time I'm trying to do it on a directory of files (with variable file names) - therefore I have to also use the 'assign' command. I have come up against a couple of problems however and am therefore seeking advice...
>
2011 Mar 12
2
how to use melt cast commands in R in window7
Hi,
I have installed R on my computer with windows 7 . I also installed reshape
software, but I am not being able to work with melt cast commands . I have
chjecked the commands.It is not working.
Thankyou,
Deepika
[[alternative HTML version deleted]]
2012 May 21
1
help with melt/cast in reshape-package
I'm sorry everyone for the inconvenience of spamming the R-help...
Here's the complete post:
Hi everyone,
>
> Since it's quite a while that I used the reshape package, I now feel kind
> of rusty.
>
> I have a data.frame like this:
>
>
>
> id Sample.Name Marker Allele.1
> Allele.2 sample_id species
2012 Mar 01
1
Need help using Melt and cast to compute correlation for a cross tabulation
I have a data frame with a number of observed and predicted values by
classification as shown below:
Count Volume FCLASS
1 55000 60000 Grade Separated
2 43000 39000 Grade Separated
3 26000 26500 Major Arterial
4 19500 20000 Major Arterial
...
There are four classes here: Grade Separated, Major Arterial, Minor
Arterial, and Collector
I am looking
2010 May 25
2
help required to melt a data frame
I have the raw data with 9 column and 197977 row:
> dummy
State Months Bedroom
1 xxx Jan 1
2 xxx Jan 2
3 xxx Jan 1
4 yyy Jan 1
5 yyy Jan 2
6 yyy Jan 1
7 zzz Jan 3
8 zzz Jan 1
9 zzz Jan 2
10 xxx Feb 3
11 xxx Feb 4
12 xxx Feb 2
13 yyy Feb 1
14
2008 Jul 26
1
Can't get the correct order from melt.data.frame of reshape library.
Simple illustration,
> df3 <- data.frame(id=c(3,2,1,4), age=c(40,50,60,50), dose1=c(1,2,1,2), dose2=c(2,1,2,1), dose4=c(3,3,3,3))> df3 id age dose1 dose2 dose41 3 40 1 2 32 2 50 2 1 33 1 60 1 2 34 4 50 2 1 3> melt.data.frame(df3, id.var=1:2, na.rm=T) id age variable value1 3 40 dose1 12 2 50 dose1 23 1
2013 Mar 18
2
melt with complications
## Can someone suggest a simpler expression than either of these, with the
goal
## of taking a long matrix into a wide one with exactly one of the factors
converted to
## columns and all the rest retained as factors. I want something that
generalizes beyond
## the three factors illustrated here.
## Rich
meltTest <- data.frame(A=rep(c("B","C"), each=12),
2011 Aug 14
2
Central limit theorem
my data looks like this:
PM10 Ref UZ JZ WT RH FT WR
1 10.973195 4.338874 nein Winter Dienstag ja nein West
2 6.381684 2.250446 nein Sommer Sonntag nein ja Süd
3 62.586512 66.304869 ja Sommer Sonntag nein nein Ost
4 5.590101 8.526152 ja Sommer Donnerstag nein nein Nord
5 30.925054 16.073091 nein Winter Sonntag nein nein Ost
6
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
2009 Jul 12
0
Specifying a more complex covariance matrix in lme or lmer
Hi all,
I've searched threads and read up on some ways of doing this but I'm having
a hard time to get it to work. Here's my basic problem. I have the
following linear mixed model
y = Xb+Zu+e
where u~N(0,s^2*K) where K is a matrix.
I read a thread that basically suggested to decompose Zu into ZPD^(1/2)
D^(-1/2)P'u so that (D^(-1/2)P'u)~N(0,s'^2I) but I'm not sure
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
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
2010 Feb 06
3
melt on OSX ignores na.rm=T
Hi list,
I run R on Linux and OSX. On both systems I use R version 2.9.2 (2009-08-24)
and reshape version: 0.8.2 (2008-11-04). When I do a melt with
na.rm=T on a data frame I get different results on these systems:
library(reshape)
x <- read.table(textConnection("char trial wn
p E10I13D0 4
r E10I13D0 4
a E10I13D0 4
c E10I13D0 4
t E10I13D0 4
i E10I13D0 4
c E10I13D0 4
e E10I13D0
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