Displaying 20 results from an estimated 21 matches for "subtotal".
2006 May 12
3
optimal way to compute matrix subtotals?
Hi!
I have large matrices, one column per variable and I have a vector of factors / grouping symbols. Then I am computing subtotals for the groups but it takes pretty long and thus I wanted to ask if there is a better way to do it or if this is already the best way:
subTotals <- function(x, groupvec) do.call("rbind",lapply(split(x,groupvec),colSums,na.rm=T))
Thanks reading my question and any hints!
Werner...
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 o...
2013 Apr 19
5
how to subtotal by rows
Dear R-users,
I have a dataset as like below, and I want to subtotal the values of rice,wheat and maize by year for each fid.
fid year rice wheat maize
------------------------------------------------
1 1995 5 NA NA
1 1995 NA 3 NA
1 1995 NA NA 2
1 1996 ...
2015 Oct 05
2
Swift to IR, generates wrong IR
...is not part of the LLVM oss project, but is this problem coming from swift generating wrong IR code or is this a LLVM bug (or maybe I’m just doing something wrong)?
Cheers,
ps: this is the swift code I try running:
class TipCalculator {
// 2
let total: Double
let taxPct: Double
let subtotal: Double
// 3
init(total: Double, taxPct: Double) {a
self.total = total
self.taxPct = taxPct
subtotal = total / (taxPct + 1)
}
// 4
func calcTipWithTipPct(tipPct: Double) -> Double {a
return subtotal * tipPct
}
// 5
func printPossibleTips() {...
2008 Oct 02
2
aggregate empty row for pretty appearance also subtotal if possible
...N 3
2 A Y 2
3
4 B N 420164905
I need to format a series of aggregates by multi dimensions and I wanted
to break the data by empty row between group 1 that people can see some
space.
Also is there a way to add subtotals by group 1 into the mix :
Group.1 Group.2 x
1 A N 3
2 A Y 2
3 5
4 B N 420164905
5 420164905
original data...
2015 Oct 05
2
Swift to IR, generates wrong IR
...g IR code or is this a LLVM bug (or maybe I’m just doing something wrong)?
>>
>> Cheers,
>>
>> ps: this is the swift code I try running:
>>
>> class TipCalculator {
>>
>> // 2
>> let total: Double
>> let taxPct: Double
>> let subtotal: Double
>>
>> // 3
>> init(total: Double, taxPct: Double) {a
>> self.total = total
>> self.taxPct = taxPct
>> subtotal = total / (taxPct + 1)
>> }
>>
>> // 4
>> func calcTipWithTipPct(tipPct: Double) -> Dou...
2006 Feb 26
2
subtotal, submean, aggregate
Dear All,
I would like to make partial sums (or means or any other function) of
the values in intervals along a sequence (spatial transect) where groups
are defined.
For instance:
habitats<-rep(c("meadow","forest","meadow","pasture"),c(10,5,12,6))
observations<-rpois(length(habitats),2)
2017 Oct 25
11
[OT] Bash help
I know this is for CentOS stuff, but I'm at a loss on how to build a
script that does what I need it to do.? It's probably really logically
simple, I'm just not seeing it.? Hopefully someone will take pity on me
and at least give me a big hint.
I have a file with two columns 'email' and 'total' like this:
me at example.com 20
me at example.com 40
you at domain.com
2008 Jan 23
3
How to do more advanced cross tabulation in R?
...(year,quarter,sales,company) #this is the database
I would like to construct a cross tabulation table like this:
2003 #a row of year(s)
1 2 3 4 #a row of quarters of each year
a 1 2 3 4
b 5 6 7 8
c 9 10 11 12
c 13 14 15 16
#maybe add a row of subtotal for each quarter at the
end.
I tried xtabs, but all I could produce is this, unfortunately:
xtabs(sales~year+quarter, data=df)
quarter
year 1 2 3 4
2003 10 26 42 58
or this:
xtabs(sales~year+quarter+company, data=df)
, , company = a
quarter
year 1 2 3 4
2003 1 5...
2008 Jan 26
3
Comparison of aggregate in R and group by in mysql
...l the prompt replies to my earlier question about "merging" data frames in R.
Actually that's an equivalence to the "join" clause in mysql.
Now I have another question. Suppose I have a data frame X with lots of columns/variables:
Name, Age,Group, Type, Salary.
I wanna do a subtotal of salaries:
aggregate(X$Salary, by=list(X$Group,X$Age,X$Type),Fun=mean)
When the levels of Group and Type are huge, it took R forever to finish the aggregation.
And I used gc to find that the memory usage was big too.
However, in mysql, it took seconds to finish a similar job:
select Group,Age,T...
2005 Dec 14
9
Passing quantity in a shopping cart
I am using this line on my index.rhtml page to capture the quantity
required of a particular item for a basic shopping cart app:
<%= text_field ''line_item'', ''quantity'', {:size=>3} %> </td>
but my next screen (a cart screen) doesn''t reflect what was entered in
that text field when the item is added to the cart. That is,
2017 Oct 25
0
[OT] Bash help
...maps, etc.)
That does limit you to CentOS 7+, or maybe 6+, as I recall. CentOS 5 is definitely out, as that ships Bash 3, which lacks this feature.
#!/bin/bash
declare -A totals
while read line
do
IFS="\t " read -r -a elems <<< "$line"
email=${elems[0]}
subtotal=${elems[1]}
declare -i n=${totals[$email]}
n=n+$subtotal
totals[$email]=$n
done < stats
for k in "${!totals[@]}"
do
printf "%6d %s\n" ${totals[$k]} $k
done
You?re making things hard on yourself by insisting on Bash, by the way. This solution is better ex...
2003 Aug 02
0
Webalizer for CDR logs....
...dump calls into asterisk via h323
if($src eq "") {
if($dest = 9999) {
$src = "INCOMING";
}
}
print "$src - - [$day\/$MONTHS{$month}\/$year:$time -0500] \"GET /$dest HTTP/1.0\" 200 $billable \"$destcontext\" \"$disposition\"\n";
$subtotal = $subtotal + $billable;
}
2006 Jul 30
1
manova and table of means by factor levels
...from SAS, I am specifically looking for the R equivalent
of the "by" command in PROC GLM.
2) Create a table of means that, for each level of factor B, shows the
interaction of factors A and C. Thus, I need to manipulate summary.formula
or another table-generating program to produce subtotals. If that is not
possible, is there another way to avoid generating and binding multiple
subsets into one table?
I have searched the R-help archives and the internet, but to no avail. The
closest posting that I have found is:
http://tolstoy.newcastle.edu.au/R/help/05/04/3239.html. Would someon...
2017 Oct 25
2
[OT] Bash help
...maps, etc.)
That does limit you to CentOS 7+, or maybe 6+, as I recall. CentOS 5 is definitely out, as that ships Bash 3, which lacks this feature.
#!/bin/bash
declare -A totals
while read line
do
IFS="\t " read -r -a elems <<< "$line"
email=${elems[0]}
subtotal=${elems[1]}
declare -i n=${totals[$email]}
n=n+$subtotal
totals[$email]=$n
done < stats
for k in "${!totals[@]}"
do
printf "%6d %s\n" ${totals[$k]} $k
done
You?re making things hard on yourself by insisting on Bash, by the way. This solution is better ex...
2006 Jun 02
1
prototype patch submissions
...getElementsByAttribute has changed how we approach our client
side scripting. We''ve taken to using custom attributes to group input
elements together to support domain specific functionality. For example, if
we have a column of text elements that are intended to be totalled, I will
set subtotal="true" inside those input elements. I can then assign an event
handler to all of these elements with one statement:
document.getElementsByAttribute(''subtotal'').each(function(obj) {
obj.onchange = handle_calc;
});
Seeing as any node can have...
2004 Oct 01
4
CDR_Oracle anybody?
...plans for my clients individually. I want a billing run to
either calculate this - with appropriate lookups, or I want this to be
done on the database side, populating a secondary cdr table of some
sort- so the report writer run just pulls stuff out of one table and
does nothing more complex than subtotals - simple and easy.
The reasons I'm frustrated are as follows:
1) MySQl cannot do stored procedures or triggers, or even views. For
this reason I can't just add a cdr_billing table and pull in City &
State from the NDA/NXX table, et al, on the fly as a call is hung up.
(or various ot...
2024 Dec 15
0
ANNOUNCE: GnuCash 5.10 Released
...account jump then open, open the last highlighted account not the jumped to account
Bug 799444 - Silent crash on CSV import
Bug 799451 - Cannot translate different meanings of string "_Balance" to Chinese.
Add context to the msgids.
Bug 799452 - Transaction Report: Cannot subtotal based on Number field
enable grouping and subtotals for Num field
Bug 799454 - Numeric value in exported CSV transactions
Bug 799456 - Tabbing through fields autoselects all but Num field
By which the reporter means that the value in every cell except Num is selected on cell entry...
2009 Feb 10
0
Dataframes: conditional calculations per row [SOLVED].
...eeded. 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)
> # Subtotal para redondeo
> sumaformula <- sum(alitemp)
> # Fragmentacion de la matriz segun clases...
> llmcc2 <- llmcc
> llmcc2$Alitmp <- alitemp
> llmcc2$newExpression <- with(llmcc2,ifelse(Clase<10,
> Alitmp*100/sumaformula, Alitmp*100/su...
2008 Oct 22
0
newbie Syntax questions: Re-Calculating expansion factors
...es should I
be using? What is the syntax for the type of calculation I'm trying to
do? How should I specify my new X1 target data file so I can use it
efficiently?
Does this make any sense?
Thanks in advance,
********************************
PS My preliminary dataframe subtotals look something like this:
> InitX1Sums <- xtabs(~tripid_nu+lineon data=SurveyData)
> InitX1Sums
lineon
tripid_nu Warner Center De Soto Pierce College Tampa Reseda Balboa
Woodley Sepulveda Van Nuys Woodman Valley College Laurel Canyon North
Hollywood
9011880...