Posts

r - Accessing variables initialized inside eval -

can explain how access variables created within eval statement? know there many other solutions problem, trying understand why running scope issue here. error error in paste0("fit<-summary(lm(npisplit~", x, ",data=df));rs<-round(fit$r.squared,3);pv<-round(fit$coefficients[,4],3);if(pv<0.05){paste(", : object 'rs' not found code df<-data.frame(npisplit=c(0,0,0,1,1,1),happiness=c(2,5,6,8,7,4)) moods<-c('happiness') lapply(moods,function(x){ eval(parse(text=paste0( "fit<-summary(lm(npisplit~",x,",data=df));rs<-round(fit$r.squared,3);pv<-round(fit$coefficients[,4],3);if(pv<0.05){paste(",x,"=",rs,"&",pv,")}"))) }) you need escape quotes inside of quotes. x <- 1 lapply(1:2, function(.) eval(parse(text="y<-x+1;paste(\"y=\", y)")))

Pandas & AWS Lambda -

does have compiled version of pandas compatible aws lambda? after searching around few hours, cannot seem find i'm looking , documentation on subject non-existent. i need access package in lambda function have been unsuccessful @ getting package compile usage in lambda function. in lieu of compilation can provide reproducible steps create binaries? unfortunately have not been able reproduce of guides on subjects combine pandas scipy don't need , adds layer of burden. i believe should able use recent pandas version (or likely, 1 on machine). can create lambda package pandas this, first find pandas package installed on machine i.e. open python terminal , type import pandas pandas.__file__ that should print '/usr/local/lib/python3.4/site-packages/pandas/__init__.py' now copy pandas folder location (in case '/usr/local/lib/python3.4/site-packages/pandas ) , place in repository. package lambda code pandas this: zip -r9 my_lambda.zip pandas...

python - Extract indices of array outside of a slice -

i want perform statistics on annulus around central portion of 2d array (performing statistics on background around star in image,for instance). know how obtain 2d slice of region inside of array , return indices of slice, there way of obtaining indices of values outside of slice? i have 2d array called 'z' , box size (psf_box) around want perform statistics. i've got far: center = np.ceil(np.shape(z)[0]/2.0) # center of array # make 2d slice of star, , convert pixels nan annulus[center-ceil(psf_size/2.0):center+ceil(psf_size/2.0)-1,\ center-ceil(psf_size/2.0):center+ceil(psf_size/2.0)-1] = np.nan np.savetxt('annulus.dat',annulus,fmt='%s') i convert pixels inside of box slice nan, don't know how output indices of pixels outside of box not 'nan'. or better yet, there way perform operations on area around slice directly? (as opposed outputting pixel values aren't nan) i hope represents want do, ie. elements of annulus in 2...

groovy - Object.getText() Expression in Ireport -

in ireport designer, created field named address of type of java.lang.object , created text expression of $f{address}.text . data of address java.util.map , looks this: ["bldgname":null, "barangay":["name":"minaulon", "objid":"057-01-0013"], "province":"lanao del norte", "text":"minaulon, bacolod, \nlanao del norte", "unitno":null, "type":"local", "bldgno":null, "pin":null, "city":null, "subdivision":null, "municipality":"bacolod", "street":null] after previewing report, error thrown saying: net.sf.jasperreports.engine.fill.jrexpressionevalexception: error evaluating expression : source text : $f{address}.text @ net.sf.jasperreports.engine.fill.jrevaluator.evaluate(jrevaluator.java:197) @ net.sf.jasperreports.engine.fill.jrcalculator.evaluate(jrcalculator.java:53...

requirejs - Backbone.js / require.js - Override model function to work with backend as a service -

good morning guys. have little understanding problem backbone.js. have javascript sdk backend service getter , setter methods datas platform. i have load javascript sdk require.js it´s work fine. need create models work getter , setter methods data collection view. not have clue...maybe have right idea me. this current model: define(['jquery','underscore','backbone'], function($,_,backbone) { var holidayperson = backbone.model.extend({ initialize: function() { console.log("init model holidayperson"); this.on("change", function(data) { console.log("change model holidayperson"+json.stringify(data)); }); } }); return holidayperson; }); actually create instance of model in view: define(['jquery','underscore','backbone','text!tpl/dashboard.html','holidayperson','apio'], function($,_,backbone,tp...

logic - C++ logical operator Q -

this question might seem noobish question this: these 2 statements logically same? int a; int b; int c; if (!a && !b && !c) //do if (!(a || b || c)) //do a truth table useful understanding logics. #include <iostream> using std::cout; using std::endl; int main(void) { int a; int b; int c; bool differ = false; cout << "a b c x y\n"; (a = 0; <= 1; a++) { (b = 0; b <= 1; b++) { (c = 0; c <= 1; c++) { bool x = (!a && !b && !c); bool y = (!(a || b || c)); differ = differ || (x != y); cout << << " " << b << " " << c << " " << x << " " << y << "\n"; } } } if (differ) { cout << "they differ" << endl; } else { cout << ...

javascript - How to use Bootstrap Popover with Angular2 -

Image
i trying bootstrap 3 popover display angular 2 interpolated template. possible? here have far: $('.ba-header--user-menu').popover({ placement: 'bottom', toggle: 'popover', trigger: 'focus', html: true, content: '{{user.email}}' }); which gives me this: jquery , angular don't play together. install ng2-popover : npm ng2-popover and use this: <span popover="content shown in popover"> element on popover applied. </span>