similar to: Margins in dcast (reshape2)

Displaying 20 results from an estimated 2000 matches similar to: "Margins in dcast (reshape2)"

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
2010 Sep 10
0
reshape2: a reboot of the reshape package
Reshape2 is a reboot of the reshape package. It's been over five years since the first release of the package, and in that time I've learned a tremendous amount about R programming, and how to work with data in R. Reshape2 uses that knowledge to make a new package for reshaping data that is much more focussed and much much faster. This version improves speed at the cost of functionality,
2010 Sep 10
0
reshape2: a reboot of the reshape package
Reshape2 is a reboot of the reshape package. It's been over five years since the first release of the package, and in that time I've learned a tremendous amount about R programming, and how to work with data in R. Reshape2 uses that knowledge to make a new package for reshaping data that is much more focussed and much much faster. This version improves speed at the cost of functionality,
2011 Jan 04
0
reshape2 1.1
Reshape2 is a reboot of the reshape package. It's been over five years since the first release of the package, and in that time I've learned a tremendous amount about R programming, and how to work with data in R. Reshape2 uses that knowledge to make a new package for reshaping data that is much more focussed and much much faster. This version improves speed at the cost of functionality,
2011 Jan 04
0
reshape2 1.1
Reshape2 is a reboot of the reshape package. It's been over five years since the first release of the package, and in that time I've learned a tremendous amount about R programming, and how to work with data in R. Reshape2 uses that knowledge to make a new package for reshaping data that is much more focussed and much much faster. This version improves speed at the cost of functionality,
2012 Sep 27
4
Colsplit, removing parts of a string
Hi, I am using colsplit (package = reshape) to split all strings in a column according to the same patterns. Here an example: library(reshape2) df1 <- data.frame(x=c("str1_name2", "str3_name5")) df2 <- data.frame(df1, colsplit(df1$x, pattern = "_", names=c("str","name"))) This is nearly what I want but I want to remove the words
2013 Jan 11
3
split & rbind (cast) dataframe
Hi, I would like to split dataframe based on one colum and want to connect the two dataframes by rows (like rbind). Here a small example: # The orgininal dataframe df1 <- data.frame(col1 = c("A","A","B","B"),col2 = c(1:4), col3 = c(1:4)) # The datafame how it could look like df2 <- data.frame(A.col2 = c(1,2), A.col3 = c(1,2), B.col2 = c(3,4), B.col3
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
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 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 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,
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
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 =
2012 Jul 05
1
reshape2 errors on data frame
I've successfully reformatted data frames from long to wide with reshape2, but this time I'm getting errors that I want to understand and resolve. Here's the data frame structure and the results of the melt() and dcast() functions: str(waterchem) 'data.frame': 128412 obs. of 8 variables: $ site : Factor w/ 64 levels "D-1","D-2","D-3",..: 1 1
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
2010 Sep 13
1
Problems with reshape2 on Mac
Hi! I updated to reshape2 yesterday and tried to make it work. Unfortunately, it mainly throws error messages at me (good thing it's reshape2 1.0 and not reshape 2.0). The most recent is: Error in match.fun(FUN) : object 'id' not found When I manually create an object 'id', it says: Error in get(as.character(FUN), mode = "function", envir = envir) : object
2013 Mar 13
5
string split at xth position
Hi, I have a vector of strings like: c("a1b1","a2b2","a1b2") which I want to spilt into two parts like: c("a1","a2","a2") and c("b1","b2,"b2"). So there is always a first part with a+number and a second part with b+number. Unfortunately there is no separator I could use to directly split the vectors.. Any idea
2013 Jun 05
1
reshape2 issue solved Tnx!
Hi again all, As the original code lines I had dated back to 2007 that may have predated reshape2? In any case the use of *dcast *rather than /*cast*/ solved the issue. Then with 3 steps: Stop read Think I saw I just needed to change the line input.cast <- cast(input.melt, Species ~ *Date*, fun.aggregate = sum) to input.cast <- cast(input.melt, Species ~ *Time*, fun.aggregate = sum)
2012 Dec 11
5
Renaming column names according to another dataframe
Hi, I've got a dataframe having a code as column name. Addtionally I have another dataframe with a two columns (and lots of rows), the first containing the code and the second some Text (real name). Now I'd like to use the information (pairs of code and name) of the second dataframe to rename all the columnnames in the first dataframe. How is it possible to achieve that? Here a small
2017 Jul 05
0
Help with reshape/reshape2 needed
The reason it doesn't work easily with reshape/reshape2 is that the order of the rows is not determined. Your answer could be 1957 1958 ... 1985 1986 0.8625000 0.7500000 ... 0.7307692 0.23750000 0.0733945 0.6435644 ... NA 0.05769231 0.5096154 NA ... NA 0.65137615 or 1957 1958 ... 1985 1986 0.0733945 0.6435644 ... NA