similar to: conditional sum two dataframes

Displaying 20 results from an estimated 600 matches similar to: "conditional sum two dataframes"

2012 Oct 17
3
subtotals based on price bands?
I would like to create a subtotal table with custom bands. seq1 = seq(0, 100, by = 5) seq2 = seq(100, 1000, by = 100) Bands = c(seq1, seq2) #Prices Prices = sample(1:1000, 200, replace=F) #corresponding size for the given price above. size = sample(1:1000, 200, replace=F) How would I find the subtotal of the size based on a given price falls within a band? -- View this message in
2012 Jul 17
2
Table/Frame - output
I would like to output a nicely formatted data frame to a bitmap. Is this possible in R? -- View this message in context: http://r.789695.n4.nabble.com/Table-Frame-output-tp4636790.html Sent from the R help mailing list archive at Nabble.com.
2012 Jun 07
2
flagging values without a loop
For a given hour I want to be able to add a new column called flag. The flag column will flag the highest price in a given hour. Is there a way to do this without a loop? matrix: Unit, Day, Hour, Price, Flag afd1 1/2/2003 1 1 N afd1 1/2/2003 1 2 N afd1 1/2/2003 1 3 N afd1 1/2/2003 1 4 Y dcf1 1/2/2003 2 2 N dcf1 1/2/2003 2 3 Y dcf1 1/2/2003 2 1 N dcf1 1/2/2003 2 2 N dcf1 1/2/2003 2 3 Y ghg2
2012 Oct 17
3
aggregate function not working?
The aggregate function for some reason will now work for me. The error I'm getting is: "Error in sort.list(y) : 'x' must be atomic for 'sort.list' Have you called 'sort' on a list?" agPriceList=aggregate(PriceList$Size, list(PriceList$bandNum),sum) *Price list dataframe:* dput(PriceList) structure(list(Price = c(0, 8.18, 8.27, 10.42, 10.5, 10.6, 11.13,
2012 Jun 01
1
plot background - excel gradient style background ?
Is there away of putting an excel style gradient background? I want to have dark blue in the middle and shad to white on the top and bottom. -- View this message in context: http://r.789695.n4.nabble.com/plot-background-excel-gradient-style-background-tp4632138.html Sent from the R help mailing list archive at Nabble.com.
2012 Jul 03
1
remove loop which compares row i to row i-1
I would like to remove a loop to speed up my code. I want to remove a loop which references the last row. In general I want to a remove a loop which looks something like this: for 2 to number of rows in a matrix do{ if indextrow-1 is < currentIndexRow then do something. } My R code: for (i in 2:length(tUnitsort$Hour)){ ifelse(tUnitsort[i,4]>=tUnitsort[i-1,4],(tempMC
2012 Nov 05
1
custom function & missing value where TRUE/FALSE needed
I can't figure out why this function wont work. #Custom Function used fallInBand <- function(x){ #Assume the bands fall go up form 0 to 100 in intervals of 5 then from 100 to 1000 in intervals of 100. #returns the location (band number) if (is.na(x) == FALSE) { if(x < 100) {#bands of 5 if((x %% 5) >=0){#falls within the band Result = as.integer(x/5)+1
2012 Jun 06
5
ggplot incorrect legend
How do I create a legend with ggplot? I think should be getting the FuelTypeNum in the legend. Plot: http://r.789695.n4.nabble.com/file/n4632471/Rplot.jpeg My code is: ggplot(data=tempTable, aes(x=Bands8, y=SubPercent, fill=FuelTypeNum)) + geom_bar(position="stack", stat="identity") + scale_colour_hue('my legend', breaks = levels(tempTable$FuelTypeNum),
2012 Jun 08
2
Percent of a given subset
How would I find the Percent of FuelTypeNum within the Band given AvailableMW? example: type 1 is 1% of PB0 type 2 is 54% of PB0 type 4 is 4% of PB0 type 5 is 42% of PB0 Note: the Bands and fuel types are not always constant. Data: FuelTypeNum Bands AvailableMW AvailableMWNewFormat 1 PB0 185319 185.319 2 PB0 18352000 18352 4 PB0 1338785 1338.785 5 PB0 14189756 14189.756 2 PB1
2013 Jun 15
1
Downloading CSV file - RCurl help
There are some CSV file from the link below. I'm having trouble installing the package. Is this the package I have to use or is there another one I need to use? If so how do I get this one loaded. https://www.enmax.com/Power/Energy+Retailers/Settlement+Reports/Profile+settlement+report.htm install.packages("RCurl", repos =
2007 May 14
2
creating a "list of 3 dataframes" from a "list of 2 dataframes" and a dataframe?
#I wish to create a "list of three dataframes" ("results2") from a "list of two dataframes" (temp) and a dataframe ("c")? #Please advise. a <- data.frame(x=c(1,2,3),y=c(5,7,9)) b <- data.frame(x=c(2,4,7,9),y=c(2,3,5,4)) c <- data.frame(x=c(22,34,7,9),y=c(52,63,5,4)) results1 <- list(a,b,c) #what I want #but this is how I need to get there
2010 Jun 25
1
Confused: Looping in dataframes
Hey, I have a data frame x which consists of say 10 vectors. I essentially want to find out the best fit exponential smoothing for each of the vectors. The problem while I'm getting results when i say > lapply(x,ets) I am getting an error when I say >> myprint function(x) { for(i in 1:length(x)) { ets(x[i],model="AZZ",opt.crit=c("amse")) } } The error message is
2006 Feb 22
0
Merge dataframes with no shared rows, some shared and som e unshared columns
> first <- data.frame(a=1:3, b=4:6) > second <- data.frame(b=7:9, c=10:12) > third <- merge(first, second, by="b", all=TRUE) > third b a c 1 4 1 NA 2 5 2 NA 3 6 3 NA 4 7 NA 10 5 8 NA 11 6 9 NA 12 It's easy to replace the Nas with whatever value you want. No, merge() does not work with more than two data sets at a time. Andy From: mtb954 at gmail.com
2002 May 19
1
Dynamic resizing of lists, dataframes (newbie question)
Hi All, I would be very grateful for some help with finding my way around R. (I'm sure some of this is in the manual - but I just need to try some ideas out and I don't want to spend hours going through reams of text - BTW, I have checked the manual, and the stuff I want to do here is not covered explicitly ...) This is a snippet of pseudo code showing what I want to do in R 1).
2009 Feb 10
0
Dataframes: conditional calculations per row [SOLVED].
> Thank you very much Jorge, Phil and David: I was finally able to > perform the operations I needed. I changed the function in order to > adapt it to the simplest form like the following: > ali <- function(Abase) { > alitemp <- ((Abase/llmcc$Clase)*PClase)+(((1/llmcc > $Categoria)*Abase)*PCategoria)+((Abase*llmcc$Phi)*PPhi)+((Abase*llmcc > $Rf)*PRf) >
2006 Dec 13
0
Problem in Converting Zoo Objects to Dataframes
Hi R experts, The below is an RBloomerg command. The object "intra" here is a zoo object. I need to convert this zoo object into a data frame, called bb. " library(zoo) library(chron) library(RDCOMClient) library(RBloomberg) conn<-blpConnect(show.days="trading",na.action="previous.days",periodici ty="daily") intra<-blpGetData(conn,
2012 Sep 24
2
Rows not common in dataframes
Hi, I have two dataframes (Dataframe_A, Dataframe_B) with the same no. of columns. The first column of both the dataframes contains unique names. I wish to have Dataframe_A with the rows that are NOT common to Dataframe_B. With merge (), it is possible to get the common rows or to merge rows, but I am not quite sure how to do it in a simpler way. Any help would be much appreciated. Thank you.
1998 Feb 18
1
R-beta: dataframes and functions
A non-text attachment was scrubbed... Name: not available Type: text Size: 1230 bytes Desc: not available Url : https://stat.ethz.ch/pipermail/r-help/attachments/19980218/095e19b6/attachment.pl
2002 May 20
0
is.na<- coerces character vectors to be factors within dataframes (PR#1577)
I am not sure if this is a bug within is.na<- or if it lies deeper in the dataframe construction process. Indeed, perhaps it is not a bug at all (in which case I would suggest that the help page for NA be provided with a warning for unsuspecting users (like me)). When used on a character vector within a dataframe, is.na<- coerces the vector to factor. > x <- data.frame(var =
2008 Jan 23
0
pseudo dataframes with RODBC
Dear R-devel list members, For several years, I've maintained for my private use and for demonstrations a set of functions [e.g., for indexing, with(), summary(), etc.] that employ the RODBC package and a database to provide a "pseudo" data frame. Row "indexes" can be specified as SQL queries. I know that the idea isn't original, and I haven't done anything with