sample

R: random sample of columns excluding one column

不羁的心 提交于 2019-12-24 12:03:59
问题 I may have discovered one of the problems in the code posted previously, "R: using foreach() with sample() procedures in randomForest() call" and it relates to the script I was using to draw a random subsample of columns from a dataframe. The fake data (below) has 19 columns, "A" through "S" and I want to draw a random subset of 5 columns, but I want to exclude the third column, "C", from the draw. Simply excluding the third column from the first argument of sample() call does not work (i.e.,

Resample and looping over dplyr functions in R

蓝咒 提交于 2019-12-24 07:37:48
问题 I have the following data-set (dat) with 8 unique treatment groups. I want to sample 3 points from each unique group and store their mean and variance. I want to do this 1000 times over (sample with replacement) using a loop to store all the values in output. I tried to do this loop and I keep running into unexpected '=' in:"output[i] <- summarise(group_by(new_df[i], fertilizer,crop, level),mean[i]=" Any suggestions on how to fix it, or make it more fertilizer <- c("N","N","N","N","N","N","N"

Convert shoutcast stream to playable samples in Python?

六眼飞鱼酱① 提交于 2019-12-23 17:43:46
问题 I have a shoutcat radio station and now want to build a player for it. I know how to "get" thet stream from the server, thanks a lot to bobince , but I am not sure how to convert that stream into playable samples. How is it done? 回答1: Well, from what I can read on python, try this page. If that doesn't work, try the PythonInMusic article on the python wiki. 回答2: Shoutcast streams are typically (but not always) MP3. To get playable samples, you have to decode the stream's MP3 data. Have you

Looking for Platform SDK SSPI(Schannel) sample c++

ぐ巨炮叔叔 提交于 2019-12-23 17:27:16
问题 I want to see a microsoft sample that demonstrate using of SSPI with Schannel. As I see here there is a such sample, but I cannot succeed to find it :( Can anyone please help me to find it? Thanks in advance! 回答1: There are WebServer and WebClient examples in Windows® Server 2003 SP1 Platform SDK ISO Install under Microsoft Platform SDK\Samples\Security\SSPI\SSL . 来源: https://stackoverflow.com/questions/11330471/looking-for-platform-sdk-sspischannel-sample-c

Random samples from each column of a data.frame

北城余情 提交于 2019-12-23 17:24:07
问题 I want to draw random sample from each row of a data.frame independently from other rows. Here is an example. This code selects the same column for each row but I require independent selection of columns for each row. library(plyr) set.seed(12345) df1 <- mdply(data.frame(mean=c(10, 15)), rnorm, n = 5, sd = 1) df1 mean V1 V2 V3 V4 V5 1 10 10.58553 10.70947 9.890697 9.546503 10.60589 2 15 13.18204 15.63010 14.723816 14.715840 14.08068 > df1[ , -1] V1 V2 V3 V4 V5 1 10.58553 10.70947 9.890697 9

gwt> importing a sample project

耗尽温柔 提交于 2019-12-23 12:38:50
问题 I'm just barely after 2 hours of trying to force it to work and looking for answers online. How in the world do you import a sample gwt application into your eclipse and make it run? by the way, I cannot find "projectCreator.cmd" anywhere in my files, where is it suppose to be assumming i've used eclipse plugin updater to d/l gwt 1.7.1? 回答1: Well, this is what I ended up doing though it ugly and probably not how it was meant to be: I create a new application called it "bla" or whatever then

gnuplot: filling the whole space when plotting sampled data

北城以北 提交于 2019-12-23 04:03:57
问题 I have a problem with gnuplot. I've searched and I don't find the correct solution. I'm plotting some data arranged in three columns with the command splot , and the steps in x and y are different. The plot I get with: set view map splot 'data.dat' using 1:2:3 with points palette is: and I would like the white space to be filled, making each tile size adapt, avoiding interpolation. Some ideas are given here Reduce distance between points in splot. I've tryed http://gnuplot.sourceforge.net

Randomly select groups (and all cases per group) in R?

断了今生、忘了曾经 提交于 2019-12-22 20:46:12
问题 I have an R dataframe with two levels of data: id and year . Within groups defined by id , the years increase (entire dataset has the same (number of) years per group, like so: id year var1 var2 11A 2001 ... ... 11A 2002 ... ... 11A 2003 ... ... 11A 2004 ... ... 13B 2001 ... ... 13B 2002 ... ... 13B 2003 ... ... 13B 2004 ... ... 22Z 2001 ... ... I have about 20.000 groups in my data, of couse way too many to make nice plots of growth curves. How do I randomly select about 20 of my id's? (so:

Sample size and power calculation in r as viable alternative to proc power in SAS?

痞子三分冷 提交于 2019-12-22 05:16:20
问题 So I am trying to see how close the sample size calculations (for two sample independent proportions with unequal samples sizes) are between proc power in SAS and some sample size functions in r. I am using the data found here at a UCLA website. The UCLA site gives parameters as follows: p1=.3,p2=.15,power=.8,null difference=0, and for the two-sided tests it assumes equal sample sizes; for the unequal sample size tests the parameters are the same, with group weights of 1 for group1 and 2 for

Randomly split a dataframe in n equal pieces

[亡魂溺海] 提交于 2019-12-20 07:27:49
问题 lets say I have a list of dataframes different numbers of rows: AB_df = data.frame(replicate(2,sample(0:130,201,rep=TRUE))) BC_df = data.frame(replicate(2,sample(0:130,200,rep=TRUE))) DE_df = data.frame(replicate(2,sample(0:130,197,rep=TRUE))) FG_df = data.frame(replicate(2,sample(0:130,203,rep=TRUE))) AB_pc = data.frame(replicate(2,sample(0:130,201,rep=TRUE))) BC_pc = data.frame(replicate(2,sample(0:130,200,rep=TRUE))) DE_pc = data.frame(replicate(2,sample(0:130,197,rep=TRUE))) FG_pc = data