search for: varnum

Displaying 12 results from an estimated 12 matches for "varnum".

Did you mean: barnum
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 Twine(StringRef("status"), VarNum); // 1 Twine *x2 = new Twine(...
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), entry_inst); btw, your getVarNum() leaks. Eugene On Sun, Apr 18, 2010 at 5:55 AM, Yua...
2010 Apr 18
1
[LLVMdev] create two Twine object
...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 they are dangerously subtle. - Daniel > 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), entry_inst); > > > btw, your getVarNum() leaks. &gt...
2011 Dec 30
2
Applyiing mode() or class() to each column of a data.frame XXXX
..."Bad",NA,"Good","Bad","Bad") f4<-factor(rep(c("Blue","Red","Green"),2)) v16<-c(F,T,F,F,T,F) data6<-data.frame(v13,v14,v15,f4,v16) data6 Here is my function definition: contents<-function(x){ output<-data.frame(Varnum=1:ncol(x), Name=names(x), Mode=apply(x,2,mode), Class=apply(x,2,class)) print(output) } ==== When I call the function, I obtain the following: > contents(data6) Varnum Name Mode Class v13 1 v13 character character v14 2 v14 character character v15 3 v15...
2005 Dec 19
0
new(er) SEC driver.
...type; /* corresponding variable */ int index; /* offset from first enum */ const char *value; /* enumerated value */ }; /* a type for the supported variables */ #define SEC_QUERYLIST_LEN 17 #define SEC_MAXFIELDS 16 struct sec_querylist_t { char *command; /* sec command */ int varnum[SEC_MAXFIELDS]; /* sec variable number for each field */ } sec_querylist[SEC_QUERYLIST_LEN]; #define sqv(a,b) sec_querylist[a].varnum[b] #endif /* _SEC_H_ */ -------------- next part -------------- /* -*- Mode: C -*- * sec.c -- new style SEC UPS Protocol driver *...
2007 Mar 20
1
Re: [nut-commits] svn commit r879 - in trunk: . drivers
...em up. > > Modified: trunk/drivers/gamatronic.c > ============================================================================== > --- trunk/drivers/gamatronic.c (original) > +++ trunk/drivers/gamatronic.c Tue Mar 20 03:14:09 2007 > @@ -125,7 +125,7 @@ > void sec_setinfo(int varnum, char *value) > { > > - if (sec_varlist[varnum].setcmd != ""){ > + if (*sec_varlist[varnum].setcmd){/*Not empty*/ > > if (sec_varlist[varnum].flags == FLAG_STRING) { > dstate_setinfo(sec_varlist[varnum].setcmd,&quot...
2013 Jan 17
3
how to use "..."
...paste0(".~",paste0(names(dat)[vec_cat],collapse="+"))), data=dat, FUN=stat_fun) return(df) } Example, works fine: my_data <- structure(list(cat = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L), .Label = c("A", "B"), class = "factor"), varnum = c(-0.754816565434373, -1.94101630973709, -0.102461836059522, -0.519952759645808, -1.73772800855664, -1.13939178585609, 0.522356715260142, -0.701428514907824, 1.45197576541159, 0.0844567413828095)), .Names = c("cat", "varnum"), row.names = c(NA, -10L), class = "data.fram...
2011 Dec 26
4
Summary tables of large datasets including character and numerical variables
Hello ! I am attempting to switch from being a long time SAS user to R, and would really appreciate a bit of help ! The first thing I do in getting a large dataset (thousands of obervations and hundreds of variables) is to run a SAS command PROC CONTENTS VARNUM command - this provides me a table with the name of each variable, its type and length; then I run a PROC MEANS - for numerical variables it gives me a table with the number of non-missing values, min, max, mean and std. dev. My data usually has errors and this first step helps me to spot the err...
2004 Apr 25
2
nonparametric multiple sample comparison
...it possible to calculate these numbers in R? Thanks in advance for any help or comments to improve this function. Best regards, Antonio Olinto Sao Paulo Fisheries Institute Brazil multcomp <- function(DataSet) { dat.multcomp <- DataSet names(dat.multcomp) <- c("VarCat","VarNum") attach(dat.multcomp) dat.multcomp$Rank <- rank(VarNum) attach(dat.multcomp) RankList <- aggregate(Rank,list(Rank=Rank),FUN=length) t <- length(RankList$Rank) st <- 0 for (i in 1:t) if (RankList[i,2]>1) st<-st+(RankList[i,2]^3-RankList[i,2]) LevCat <- levels(dat.multcomp$...
2009 Apr 02
0
Sparse PCA problem
...f non zero loading is 1 *How can I know in which pc,s how many non zero loadings will be? Any code??? One answer can be cross validation but I did not find in the package. * ** *Thanks for your help* *Code:* library(elasticnet) > out2<-spca(pitprops,*K=6*,type="Gram",sparse="varnum",trace=TRUE,* para=c(7,4,4,1,1,1)) *iterations 10 iterations 20 iterations 30 iterations 40 > out2 Call: spca(x = pitprops, K = 6, para = c(7, 4, 4, 1, 1, 1), type = "Gram", sparse = "varnum", trace = TRUE) 6 sparse PCs Pct. of exp. var. : 28.2 13.9 13.1 7.4 6.8 6...
2007 Dec 27
0
SAS to R - if you have SAS 8.2+
...ef <- paste(inPath,"/t__sc__t.csv", sep="") libRef <- obSAS.DataService$AssignLibref("sasds","",inPath,"") # create the content csv file cont1 <- paste("proc contents data=sasds.",inSAS," out=_tmp1(KEEP=NAME TYPE LENGTH VARNUM FORMAT) noprint; run;",sep="") cont2 <- "proc sort data=_tmp1; by varnum; run;" cont3 <- "data _tmp2; set _tmp1; if type=2 then dummy='character'; " cont3 <- paste(cont3,"if type=1 then do; if format in ('DATE','DATETIME')...
2000 Jun 21
3
SAS dataset
Hello, Is there any way we convert SAS dataset into R dataset? Kindest Regards, Peppy Adi-Purnomo ------ Peppy Adi-Purnomo Energy Market Analyst Energy Link Ltd Dunedin - New Zealand Ph.: +64 3 479 2475 Fax: +64 3 477 8424 Email: s.adi.purnomo at energylink.co.nz www.EnergyLink.co.nz -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read