Displaying 20 results from an estimated 300 matches similar to: "Calculate weighted proportions for several factors at once"
2010 Nov 29
2
FW: how to use by() ?
Thank you for the suggestion, Bill. The result is not quite what I would like. Here's sample code for you or anyone else who may be interested:
Al1 = c('A','C','C','C')
Al2 = c('G','G','G','T')
Freq1 = c(0.0078,0.0567,0.9434,0.9908)
MAF = c(0.0078,0.0567,0.0566,0.0092)
m1 = data.frame(Al1=Al1,
2009 Sep 08
1
makefile for sweave
Hello, I have the following makefile. The problem is that the bibliography
doesn t work. Any help would be appreciated! I really don t don t what to
do..:-(
# The sources of the report (tex, Rnw and other files (e.g. bib, idx))
TEX_CMPS = Report problem
RNW_CMPS = prop1 prop2 ExeExps
OTHER = Report.bib
# The name of the report to produce
all: Report.pdf
code: $(RNW_CMPS:=.R)
clean:
rm
2023 May 13
1
aggregate wind direction data with wind speed required
?s 15:51 de 13/05/2023, Stefano Sofia escreveu:
> Dear list users,
>
> I have to aggregate wind direction data (wd) using a function that requires also a second input variable, wind speed (ws).
>
> This is the function that I need to use:
>
>
> my_fun <- function(wd1, ws1){
>
> u_component <- -ws1*sin(2*pi*wd1/360)
> v_component <-
2009 Apr 17
1
cast function in package reshape
Hello R useRs,
I have a function which returns a list of functions :
freq1 <- function(x) {
lev <- unique(x[!is.na(x)])
nlev <- length(lev)
args <- alist(x=)
if (nlev == 1) {
body <- c("{", "sum(!is.na(x))", "}")
f <- function() {}
formals(f) <- as.pairlist(args)
body(f) <- parse(text = body)
namef <-
2009 Feb 26
1
logistic regression - unequal groups in R
I am getting a repeated error when I try to run a logistic regression in R
2.8.1
>(glm(prop1~x1,data=glm1,family=binomial("logit"),weights=nt1))
Error in model.frame.default(formula = prop1 ~ x1, data = glm1, weights =
nt1, :
invalid type (list) for variable 'x1'
x1 is multistate categorical (3 categories). 2 of the categories have 12
observation, one has 9. Is this what
2006 Nov 15
3
using expects with (for Hash and Array)
First off, thanks for the great library.
Is there a way setup expects with this:
runtime_options[:property] = properties_option_string
or do i have to use:
runtime_options.store(:property, properties_option_string)
which results in this:
runtime_options.expects(:store).with(:property, ''prop1=1'')
Thanks for your help.
jeremy
2008 Apr 23
3
select rows from data based on a vector of char strings
Hi,
I have loaded a dataset in R :
data =
label freq1 freq2
news 54 35
fun 37 21
milk 19 7
food 3 3
.... etc
And I have a vector
flist<-c("fun","food")
Now I want to use the vector 'flist' for selecting these values from 'data'
so that I get the following dataset :
label freq1 freq2
fun 37 21
food
2010 Mar 19
1
How to plot two cumulative frequency graph together
Dear masters,
I have data that looks like this:
#val Freq1 Freq2
0.000 178 202
0.001 4611 5300
0.002 99 112
0.003 26 30
0.004 17 20
0.005 15 20
0.006 11 14
0.007 11 13
0.008 13 13
...many more lines..
Full data can be found here:
http://dpaste.com/173536/plain/
What I intend to do is to have a cumulative graph
with "val" as x-axis with "Freq1" & "Freq2" as
2010 Nov 29
3
how to use by() ?
Hello, All!
How might one accomplish this using the by() function?
m1 is a data frame.
# populate column "m1$major_allele"
for ( i in 1:length(m1$major_allele)) {
if ( m1$Freq1[i] == m1$MAF[i]){
m1$major_allele[i] = m1$Al1[i]
}
else{
m1$major_allele[i] = m1$Al2[i]
}
}
Jim
[[alternative HTML version deleted]]
2011 Jan 14
2
read in data, maintain decimal places
Good day, All,
Is there any way to maintain the number of decimal places in the type of situation below?
I would like to maintain the number of decimal places in 0.667, despite the fact that its column-mates have a fourth decimal place.
Thank you for your time.
Jim
dat.txt contents:
MARKER ALLELES FREQ1 RSQR EFFECT2 STDERR CHISQ PVALUE
rs6599753 C,T
2011 Jul 17
1
function design: multiple imput names
dear all,
a simple question, I need to write a function in which I retrive an
undetermined number of vector in the function.
I solved the problem thanks to this link
http://stackoverflow.com/questions/2540232/how-to-allow-multiple-inputs-from-user-using-r
so my function will look alike this
my_fun <- function(...){
my_list <- lapply(..., function(x){x})
}
I need just one more
2023 May 13
2
aggregate wind direction data with wind speed required
Dear list users,
I have to aggregate wind direction data (wd) using a function that requires also a second input variable, wind speed (ws).
This is the function that I need to use:
my_fun <- function(wd1, ws1){
u_component <- -ws1*sin(2*pi*wd1/360)
v_component <- -ws1*cos(2*pi*wd1/360)
mean_u <- mean(u_component, na.rm=T)
mean_v <- mean(v_component, na.rm=T)
mean_wd
2011 Feb 10
0
Chi square test of proprotions in 2 groups of different sizes
Hello!
Very sorry for a probably very simple question - I looked but did not
find an answer in the archives.
I have a table "counts" (below) that shows counts by Option within
each of my 2 groups. However, my groups have different sizes (N1=255
and N2=68). Table "prop" shows the resulting proportions within each
group.
I would like to compare the proportions in 2 groups using
2010 Jun 23
1
Generation of binomial numbers using a loop
Dea'R' helpers
I have following data -
prob = c(0.1, 0.2, 0.3, 0.4, 0.5)
frequency = c(100, 75, 45, 30, 25)
no_trials = c(10, 8, 6, 4, 2)
freq1 = rbinom(frequency[1], no_trials[1], prob[1])
freq2 = rbinom(frequency[2], no_trials[2], prob[2])
freq3 = rbinom(frequency[3], no_trials[3], prob[3])
freq4 = rbinom(frequency[4], no_trials[4], prob[4])
freq5 = rbinom(frequency[5],
2007 Apr 17
8
Verifying that a block calls a method
I have something like the following:
def my_fun
my_fun2 do
raise Error
end
end
I know that I can verify that the method receives my_fun2. How can I
mock/stub out the example to verify that it calls raise Error?
Scott
2009 Feb 11
1
Looping over a matrix passed to .C
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've written a function in R which takes a symmetrical matrix as input and
processes all triplicate combinations of values from the matrix. The function
looks something like:
my_fun <- function(m) {
if( nrow(mat) != ncol(mat) ) {
stop("'m' must be a square matrix")
}
size <- nrow(m)
for(x in 1:(size -2)) {
2011 Nov 19
3
Data analysis: normal approximation for binomial
Dear R experts,
I am trying to analyze data from an article, the data looks like this
Patient Age Sex Aura preCSM preFreq preIntensity postFreq postIntensity
postOutcome
1 47 F A 4 6 9 2 8 SD
2 40 F A/N 5 8 9 0 0 E
3 49 M N 5 8 9 2 6 SD
4 40 F A 5 3 10 0 0 E
5 42 F N 5 4 9 0 0 E
6 35 F N 5 8 9 12 7 NR
7 38 F A 5 NA 10 2 9 SD
8 44 M A 4 4 10 0 0 E
9 47 M A 4 5 8 2 7 SD
10 53 F A 5 3 10 0 0 E
11
2008 Oct 06
2
ignore error in for-loop
Hi all,
Can anybody tell me what to do in case an error occurs inside a
for-loop and I don't want the program to exit the loop? Rather
instead I would like it to just go to the next number in the loop and
try again with the new number. Is there any function like "on error
go back to" or "skip error" ... ?
Thanks in advance,
Erich
Erich STRIESSNIG
IIASA
2007 Jan 18
4
How to optimize this loop ?
Dear R Users,
I request your help to optimize a loop.
Given a series of observations, I want to know how many consecutive past
observations are below the last one.
e.g :
my_series <- c(3, 4, 10,14,8,3,4,6,9)
As the last number (9) is higher than the four preceding numbers (6, 4, 3, 8),
this function should return 4.
my_series <- c(3, 4, 10,14,8,3,4,11,9)
Here, it should return 0, as 9
2003 Jun 25
1
indication tones and callwaiting chirp too loud
I am wondering if anyone could help me figure out how to turn down the volume on all the dial tones, indications, etc.. and especially the call-waiting CHIRP!
I don't want to change the txgain and rxgain because they are working at levels that I would like. However, when voice conversations and voicemail recordings are at good levels then the dial tones, busy tones, etc are way too loud.