Posts

r - incorrect grouping in plotting longitudinal data with ggplot -

Image
i trying plot longitudinal dataset ggplot. here example data illustrate problem. library(mass) library(ggplot2) library(dplyr) # create data dat.tx.a <- mvrnorm(n=250, mu=c(30, 20, 28), sigma=matrix(c(25.0, 17.5, 12.3, 17.5, 25.0, 17.5, 12.3, 17.5, 25.0), nrow=3, byrow=true)) dat.tx.b <- mvrnorm(n=250, mu=c(30, 20, 22), sigma=matrix(c(25.0, 17.5, 12.3, 17.5, 25.0, 17.5, 12.3, 17.5, 25.0), nrow=3, byrow=true)) dat <- data.frame(rbind(dat.tx.a, dat.tx.b)) names(dat) = c("measure.1", "measure.2", "measure.3") dat <- data.frame(subject.id=factor(1:500), tx=rep(c("a", "b"), each=250), dat) rm(dat.tx.a, dat.tx.b) dat <- reshape(dat, varying=c("measure.1", "measure.2...

dataframe - Choosing different amount of elements from each group in R -

i working on kaggle instacart competition, quite new r , have run can not figure out. i have dataset 4 columns. first column order id (id1). second column product id (id2). third column probability want select product id2 order id1 can consider ranking, higher probability selected on smaller probability. finally, fourth column amount of products want select given order (a feature of order). example, have here first 12 rows of dataframe df: id1 id2 prob num 1 17 13107 0.4756982 3 2 17 21463 0.3724126 3 3 17 38777 0.3534422 3 4 17 21709 0.3364623 3 5 17 47766 0.3364623 3 6 17 39275 0.3165896 3 7 34 16083 0.4093785 4 8 34 39475 0.3892882 4 9 34 47766 0.3892882 4 10 34 2596 0.3837562 4 11 34 21137 0.3762758 4 12 34 477...

Laravel Dusk: The correct localhost port for APP_URL on a remote server? -

i trying install dusk on laravel @ remote host , @ point need change .env file this app_url=http://localhost:8000 another tutorial suggested app_url=http://localhost:9515 for remote host, need put " http://localhost :????" , if need how find port number? not leave "/"? by way, have tested several options , non have worked far not sure causes trying pint point problem. set app_url same url using in browser local development environment. can http://localhost custom url: app_url=http://dusk.local for laravel homestead can manage sites within homestead.yaml file. the app_url somehow important commands terminal require information pointed out in detail in this answer . the port 9515 default port number of selenium server url provided in dusktestcase.php . there's no need change @ beginning should work out of box . by default, ports forwarded homestead environment.

c# - Sine wave clicking with Beep.BeepBeep -

originally, project make song in windows console using c# used console.beep(freq,time); , unreliability of caused desyncs. i changed using beep beep class. problem when playing baseline, there audible click @ end of every note. here's example . single note it's not bad, many consecutive notes it's unbearable. even when opened in wave editor, no matter cropped it clicked. how can rid of clicking, without installing bulky libraries c# console project? have tried ramping amplitude @ start of sound , down again @ end. so, modify inner loop of beep beep class, reads... (int t = 0; t < samples; t++) { short sample = system.convert.toint16(a * math.sin(deltaft * t)); bw.write(sample); bw.write(sample); } could modified this (int t=0; t < samples; t++) { double ampramp = 1.0d; if (t<1000) { ampramp = ((double) t) / 1000.0d; } else if (t > samples - 1000) { ampramp = ((double) (sa...

jquery - JS checkbox enable/disable groups of inputs NOT working when inputs wrapped in DIVs -

i've been looking way enable/disable groups of inputs corresponding checkbox. found 1 answer works me here . however, works when inputs not wrapped in divs. when add bootstrap-classes divs, script stops working. here script: $('input[type="checkbox"]').change(function(){ $(this).nextuntil(':not(input:text)').prop('disabled', !this.checked) }).change() not acquainted jquery, i've found out nextuntil() method include until next element not "input:text". so, tried expanding follows: $(this).nextuntil(':not(input:text, div)').prop('disabled', !this.checked) or $(this).nextuntil(':not(input:text), :not(div)').prop('disabled', !this.checked) or $(this).nextuntil(':not(input:text)', ':not(input:text)').prop('disabled', !this.checked) nothing works. did read listing multiple selectors apparently don't understand how correctly it. here html (dynamically gener...

python - Select a specific object from a queryset django -

is there way select specific object found in results of queryset selecting item in array. in arrays, can select specific item based on position: arrayname = {55, 33, 34, 23} arrayname[2] result = 34 i want accomplish same thing queryset results users in database = {steve, chris, jame, cole, casper, courtney} query filter names start c result = {chris, cole, casper, courtney} after results, want select casper results... there way array. something results[2] update so have part of view working specify specific record. my other question see if possible same thing in html tempalte file... here have in view , html file. there way same thing ht ehtml file... view.py i=0 form in formset: cd = form.cleaned_data currentamount = cd['amount'] currentdescription = cd['description'] print(currentamount) ...

c - Glut object's moving without telling -

i'm working glut , c, purpose screen 3d lego , 2 kaplas dynamic width, height , depth. there's few keyboard listeners move camera, , rotate kaplas. my problem : when press touch of keyboard or mouse (wich not dealed in code) lego x , z positions increased ! here's code , details : int main(int argc, char **argv) { // init glut , create window glutinit(&argc, argv); glutinitdisplaymode(glut_depth | glut_double | glut_rgba); glutinitwindowposition(100,100); glutinitwindowsize(800,800); glutcreatewindow("lighthouse3d- glut tutorial"); glclearcolor(0.5f, 0.5f, 0.5f, 0.5f); glutdisplayfunc(renderscene); //my display function glutreshapefunc(resize); //my reshape function glutkeyboardfunc(key); //basic keyboard listener function glutspecialfunc(specialkey); //special keyboard listener function glenable(gl_depth_test); glenable(gl_normalize); glenable(gl_color_material); glenable(gl_lighting); glenable(g...