Displaying 20 results from an estimated 500 matches similar to: "Summary tables of large datasets including character and numerical variables"
2006 Jun 20
3
Create variables with common values for each group
Dear all,
sorry, this is for sure really basic, but I searched a lot in the
internet, and just couldn't find a solution.
The problem is to create new variables from a data frame which
contains both individual and group variables, such as mean age for an
household. My data frame:
df
hhid h.age
1 10010020 23
2 10010020 23
3 10010126 42
4 10010126 60
5 10010142
2010 Apr 18
4
[LLVMdev] create two Twine object
I need to generate variables like
status1, status2, status3, ......
request1, request2, request3, ......
this is my code, other unrelated detail are eliminated.
static int varNum;
static const char *getVarNum() {
++varNum;
std::stringstream ss;
ss << varNum;
std::string *varname = new std::string(ss.str());
return varname->c_str();
}
const char *VarNum = getVarNum();
Twine *x1 = new
2011 Jun 16
1
Specify ID variable in daisy{cluster}
Hi All - I am using the daisy function from the cluster library to create a
dissimilarity matrix. I'm going to use that matrix to run a cluster
analysis. My participants are identified with the variable, hhid. However,
when I try to keep hhid in the dataset that I use to create the
dissimilarity matrix, daisy uses it to create the matrix rather than
ignoring it as an ID variable. I need to
2010 Apr 18
0
[LLVMdev] create two Twine object
According to documentation Twines should be used only for temporary
values and not stored, so allocating the in heap sounds wrong.
I think all you need here is
static int varNum;
++varNum;
Instruction *sstatusInst = new AllocaInst(StatusTy, Twine("status") +
Twine(varNum), entry_inst);
Instruction *sreqInst = new AllocaInst(ReqTy, Twine("request") +
Twine(varNum),
2010 Apr 18
1
[LLVMdev] create two Twine object
On Sun, Apr 18, 2010 at 4:36 AM, Eugene Toder <eltoder at gmail.com> wrote:
> According to documentation Twines should be used only for temporary
> values and not stored, so allocating the in heap sounds wrong.
Yes, in general you should never be naming Twine directly, except in
the case where you need to make a Twine for an integer. All other uses
should be considered poor style, as
2011 Nov 20
2
Adding two or more columns of a data frame for each row when NAs are present.
I am fairly new to R and would like help with the problem below. I am
trying to sum and count several rows in the data frame yy below. All works
well as in example 1. When I try to add the columns, with an NA in Q21, I
get as NA as mySum. I would like NA to be treated as O, or igored.
I wrote a function to try to count an NA element as 0, Example 3 function.
It works with a few warnings,
2011 Dec 30
2
Applyiing mode() or class() to each column of a data.frame XXXX
Hi everyone,
I am attempting to use the apply() function to obtain the mode and class of
each column in a data frame, however, I am encountering unexpected results.
I have the following example data:
v13<-1:6
v14<-c(1,2,3,3,NA,1)
v15<-c("Good","Bad",NA,"Good","Bad","Bad")
2007 Jun 28
3
Function call within a function.
I am trying to call a funtion within another function
and I clearly am misunderstanding what I should do.
Below is a simple example.
I know lstfun works on its own but I cannot seem to
figure out how to get it to work within ukn. Basically
I need to create the variable "nts". I have probably
missed something simple in the Intro or FAQ.
Any help would be much appreciated.
EXAMPLE
2013 Jan 16
1
How to call Java main method using rJava package?
Hi,
I am trying to integrate my Java program with R using rJava package. I want
to execute the whole Java program from R. The main() method in my Java code
calls all the other defined methods. So, I guess I have to call the main()
method in .jcall.
An example Java code:
*class A {
public static int mySum(int x, int y) {
return x+y;
}
public static void
2011 Nov 10
3
optim seems to be finding a local minimum
Hello!
I am trying to create an R optimization routine for a task that's
currently being done using Excel (lots of tables, formulas, and
Solver).
However, otpim seems to be finding a local minimum.
Example data, functions, and comparison with the solution found in
Excel are below.
I am not experienced in optimizations so thanks a lot for your advice!
Dimitri
### 2 Inputs:
2013 Jan 17
3
how to use "..."
Dear users,
I'm trying to learn how to use the "...".
I have written a function (simplified here) that uses doBy::summaryBy():
# 'dat' is a data.frame from which the aggregation is computed
# 'vec_cat' is a integer vector defining which columns of the data.frame
should be use on the right side of the formula
# 'stat_fun' is the function that will be run to
2005 Apr 15
4
function corresponding to map of perl
Is there a function in R that corresponds to the
function ``map'' of perl?
It could be called like:
vector.a <- map( vector.b, FUN, args.for.FUN )
It should execute for each element ele.b of vector.b:
FUN( vector.b, args.for.FUN)
It should return a vector (or data.frame) of the results
of the calls of FUN.
It nearly works using:
apply( data.frame( vector.b ), 1, FUN,
2007 Dec 07
4
Using R function in Excel
Does anyone know a way that an function written in R can be called within a cell of an Excel spreadsheet. I would like to use the R function much as I use the native Excel functions, e.g. instead of using the excel function sum, =sum(A2,A6), I would like to use the function mysum written in R, e.g. =mysum(A2,A6).
Thanks,
John
John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
2006 Jun 01
4
A coding question
Dear List:
I have the follow code:
y <- replicate(10,replicate(8,sum(rnorm(rpois(1,5)))))
Now I need to apply the following condition to _every_ randomly generated
Normal number in the code above:
x - max(0,x-15) + max(0,x-90), where x represents the individual Normal
numbers.
In other words, the said condition needs to be applied before
replicate(...(replicate(...(sum(...))) takes place.
2011 Mar 30
3
optim and optimize are not finding the right parameter
Dear all,
I have a function that predicts DV based on one predictor pred:
pred<-c(0,3000000,7800000,15600000,23400000,131200000)
DV<-c(0,500,1000,1400,1700,1900)
## I define Function 1 that computes the predicted value based on pred
values and parameters a and b:
calc_DV_pred <- function(a,b) {
DV_pred <- rep(0,(length(pred)))
for(i in 1:length(DV_pred)){
DV_pred[i] <- a *
2008 Dec 07
5
How to force aggregate to exclude NA ?
The aggregate function does "almost" all that I need to summarize a datasets, except that I can't specify exclusion of NAs without a little bit of hassle.
> set.seed(143)
> m <- data.frame(A=sample(LETTERS[1:5], 20, T), B=sample(LETTERS[1:10], 20, T), C=sample(c(NA, 1:4), 20, T), D=sample(c(NA,1:4), 20, T))
> m
A B C D
1 E I 1 NA
2 A C NA NA
3 D I NA 3
4 C I
2004 Apr 25
2
nonparametric multiple sample comparison
Hello all,
Here goes one of my first functions.
I want to make a nonparametric multiple sample comparison with unequal sample
sizes (see Zar?s Biostatistical Analysis, 3rd. Ed., pg. 201 Example 10.11, pg.
288 Example 11.10). In the real world, I want to compare samples of fish
length captured with different fishing gears.
After using the Kruskal-Wallis test I want to check the differences
2006 Oct 30
2
[LLVMdev] "fork" and "sync" for LLVM thread support - any comments?
Dear all,
Recently I've wanted to add support for threads to LLVM (motivated by
OpenMP, more or less), but before jumping in and implementing anything,
I thought it might be a good idea to describe what I have in mind and
ask for comments. Hence this email - if anyone has any comments, I'd be
very glad to hear them.
WHAT I'M PROPOSING:
The addition of two instructions - fork
2009 Jul 14
1
Incorrect comment about ISNA(x) in Arith.h (PR#13826)
R-2.9.0/include/R_ext/Arith.h has:
int R_IsNA(double); /* True for R's NA only */
int R_IsNaN(double); /* True for special NaN, *not* for NA */
int R_finite(double); /* True if none of NA, NaN, +/-Inf */
#define ISNA(x) R_IsNA(x)
/* True for *both* NA and NaN.
The first and last lines are contradictory - if R_IsNA is true only
for NA, not NaN, then ISNA should be the same.
2010 Jun 03
1
[LLVMdev] call a extern C function
How can i interface llvm bitcode with a existent so library...
like when you use C prebuilt cos() or sin() ... suppose that i create a
sum() in c/c++ compile a .so lib with it
and call it from "the bitcode" program... how can i do this?
Thanks
Fabio Kaminski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: