similar to: Reshape data frame with dcast and melt

Displaying 20 results from an estimated 90 matches similar to: "Reshape data frame with dcast and melt"

2011 Apr 28
3
Simple General Statistics and R question (with 3 line example) - get z value from pairwise.wilcox.test
Hi there, I am trying to do multiple pairwise Wilcoxon signed rank tests in a manner similar to: a <- c(runif(1000, min=1,max=50), rnorm(1000, 50), rnorm(1000, 49.9, 0.5), rgeom(1000, 0.5)) b <- c(rep("group_a", 1000), rep("group_b", 1000), rep("group_c", 1000), rep("group_d", 1000)) pairwise.wilcox.test(a, b, alternative="two.sided",
2008 Mar 10
2
Share permissions
Hello all, I have a SAMBA share called "share_a" and it is working fine (below is a snapshot of it): [share_a] path = /shares/share_a browseable = no valid users = @group_a @group_b @group_c write list = @group_a @group_b read list = @group_c create mode = 777 directory mode = 777 Inside this share there's a lot of sub-folders. The problem is: How can I give to one of these
2017 Jun 04
2
Warning from reshape2 when melting a data frame with uneven number of columns.
Here is a small reproducible example: data <- structure(list(V1 = structure(1:3, .Label = c("Name1", "Name2", "Name3"), class = "factor"), V2 = structure(c(1L, 3L, 2L), .Label = c("nam1", "name-1", "name_12"), class = "factor"), V3 = structure(1:3, .Label = c("nam2", "nam_34",
2017 Jun 04
0
Warning from reshape2 when melting a data frame with uneven number of columns.
I am not really sure what the warning means but I think your underlying problem is that all your variables are factors. Did you intend the values in each variable to be character? data.frame':??? 3 obs. of? 5 variables: ?$ V1: Factor w/ 3 levels "Name1","Name2",..: 1 2 3 ?$ V2: Factor w/ 3 levels "nam1","name-1",..: 1 3 2 ?$ V3: Factor w/ 3 levels
2017 Jun 04
0
Warning from reshape2 when melting a data frame with uneven number of columns.
Is this the solution? > d1<- as.data.frame(lapply(data,as.character),stringsAsFactors=FALSE) > str(d1) 'data.frame': 3 obs. of 5 variables: $ V1: chr "Name1" "Name2" "Name3" $ V2: chr "nam1" "name_12" "name-1" $ V3: chr "nam2" "nam_34" "name-2" $ V4: chr "nam3"
2013 Jun 26
1
Error when using median as aggregation function in dcast
Hi, I am trying to calculated various summary statistics using the dcast function of reshape2. This works perfectly for getting the mean, sum, length, sd. But when I want to calculate the median I get an error. I tried it with and without removing NAs: my_median <- function(x) median(x, na.rm = FALSE) median_df <- dcast(patch_stats_dfm,formula=species~input+barriers,my_median) Error in
2013 Jun 26
1
Margins in dcast (reshape2)
Hi, I'd like to get mean values for the margins of my casted data.frame. For the casting I am using dcast() from reshape2. However, when I set the margins parameter (margins=c("grand\_row")) I get following error concerning an unrecognized escape character '\_'. So what is the correct command to get the outermost margins only in reshape2? /johannes [[alternative HTML
2011 Dec 12
0
using dcast to reshape a DF from long to wide with multiple measured variables per obs
I have data in the following format:   person<- c(1,1,1,1,2,2,2,2,2,3,3,3,3,3,3) v2<- c("2011-01-01", "2011-02-01", "2011-03-01", "2011-04-01", "2011-01-01", "2011-02-01", "2011-03-01", "2011-04-01", "2011-05-01", "2011-01-01", "2011-02-01", "2011-03-01",
2012 Apr 12
1
Using dcast with multiple functions to aggregate
Dear R communitiy, I am trying to use multiple functions for aggregation within a function call for dcast. However this seems to result in an error. Also I have not managed to make dcast() work with fun.aggregate=sd. Please find attached some example code using the ChickWeight data. Many thanks for your help! Jokel #Chick weight example names(ChickWeight) <- tolower(names(ChickWeight))
2012 Dec 03
2
Excluding all missing values with dcast ("reshape2" package)
Hello--I'm doing a simple crosstab using dcast: rawfreq <- dcast(nh11brfs, race3~CHCCOPD, length) with the results race3 Yes No NA 1 White non-Hispanic 446 5473 21 2 Other non-Hispanic 29 211 0 3 Hispanic 6 81 1 4 <NA> 10 83 1 How would I modify this call to exclude all missing values; that is, to obtain race3
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 =
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
2016 Feb 11
2
Invertir dcast
Hola a todos, Queria preguntaros si conoceis alguna manera para invertir la funcion dcast. Quiero transformar una matriz en un data frame de tres columnas que indiquen solo los casos donde la combinacion fila-columna sea diferente de NA. Se me habia ocurrido hacer un bucle que fuera seleccionando todos los valores para cada combinacion de fila y columna, pero el problema es que con una matriz de
2012 Aug 07
3
reshape2's dcast() Adds NAs to Data Frame
I need to understand how and why dcast() adds NAs to a data frame that contained no missing values. The database table of chemical concentrations has all missing values removed because they cannot contribute to data analyses. The structure of the R data frame of these data have no NA values, and neither does the data frame resulting from applying the reshape2 melt() function to it. However,
2013 Jan 22
4
Simple use of dcast (reshape2 package)
Suppose I have a small dataframe > aa Target Eaten ID 50 TPP 0 1 51 TPP 1 2 52 TPP 3 3 53 TPP 1 4 54 TPP 2 5 50.1 GPA 9 1 51.1 GPA 11 2 52.1 GPA 8 3 53.1 GPA 8 4 54.1 GPA 10 5 And I want to reshape it into ID TPP GPA 1 1 0 9 2 2 1 11 3 3 3 8 4 4 1 8 5 5 2 10 I realise that
2008 Apr 30
3
missing values in document
No matter how I´ve tried o find a solution for this simple question, I can´t. Sorry for bothering with such a matter. I have an excel-files with some empty cells=missing values. How do I tell R that these should be NA´s? > TRFLP1 <-(read.table(file="S://SEDIM//Kokeilu//TRFLP1.txt",col.names= c("Dye_Sample Peak", "Sample_File_Name", "Size",
2008 May 07
1
i-best, grep function
Hi, I'm trying to use the i-best software. Does anyone have experience from this, I can't get it to work with my data. Here is the code: T1 <- read.delim(file="S://SEDIM//Yvonne//2_5//T1.txt",col.names= c("Dye/Sample_Peak", "Sample_File_Name", "Size", "Height", "Area_in_Point", "Area_in_BP",
2016 Feb 11
4
Invertir dcast
Con data.table todo puede ir muy rapido. > require(data.table) > M=matrix(c(5,NA,NA,NA,6,NA,7,NA,8),3,3) > M [,1] [,2] [,3] [1,] 5 NA 7 [2,] NA 6 NA [3,] NA NA 8 > M2=data.table(M) > M2 V1 V2 V3 1: 5 NA 7 2: NA 6 NA 3: NA NA 8 > M3=melt(M2,variable.name = "columna") > M3 columna value 1: V1 5 2: V1 NA 3: V1
2003 Aug 19
2
Samba 3beta3 - Winbind and groups in groups - question
Hi everybody, im new here, and I have problem. Im running samba 3beta3 at gentoo linux. Do anybody know how to resolve something like this: There are three groups in AD group_a, and group_b and group_c Members of group_a are user_0, user_1, user_2 Members of group_b are user_3, user_4, user_5 Members of group_c are user_6 and group_b If i try to do getent group At my linux box i got
2000 May 22
1
Inherit Permissions addition
Gentlemen, I was delighted to read about and test the "inherit permissions" feature of version 2.0.7 for myself. This is a wonderful addition to Samba; thank you, David Lee, for your fine work. After initial testing, it became apparent to me that inheriting the 'group' permissions on a subfolder within a share without also 'forcing' the group ownership on the new files