search for: testvar2

Displaying 3 results from an estimated 3 matches for "testvar2".

Did you mean: testvar
2011 Oct 05
2
aggregate function with a dataframe for both "x" and "by"
...quot; each row of the data is in. I wish to aggregate each column in mydata using the corresponding column in mybys. Please see the example below. What is a more elegant or "better" way to accomplish this task? Thanks! mydata = data.frame(testvar1=c(1,3,5,7,8,3,5,NA,4,5,7,9), testvar2=c(11,33,55,77,88,33,55,NA,44,55,77,99) ) mybys=data.frame(mbn1=c('red','blue',1,2,NA,'big',1,2,'red',1,NA,12),mbn2=c('wet','dry',99,95,NA,'damp',95,99,'red',99,NA,NA) , stringsAsFactors =F) myaggs <- data.frame(matrix(data=NA,...
2020 May 13
0
Tip/Question about encoding temporary data for storage in Asterisk variable to use in AGI
...your base64 encoded object is small! The following is a simple example which just encodes and decodes the agi variables themselves as they're an object in ts-agi (I'm using the ts-agi node package here as an example - https://github.com/sergey12313/ts-agi/ ) await ctx.setVariable('testvar2', Buffer.from(JSON.stringify(ctx.variables), 'utf8').toString('base64')) const testvar2 = (await ctx.getVariable('testvar2')).value const decoded = JSON.parse(Buffer.from(testvar2, 'base64').toString('utf8')) console.log('decoded is',...
2007 Jul 31
1
aggregate.data.frame - prevent conversion to factors? show statistics for NA values of "by" variable?
...there a way to prevent this, and to instead have them retain the format in the original "mybys" data.frame (i.e to have them come back formatted as "character"? Or do I just need to re-format them once I have my results? mydf=data.frame(testvar1=c(1,3,5,7,8,3,5,NA,4,5,7,9), testvar2=c(11,33,55,77,88,33,55,NA,44,55,77,99) ) str(mydf) # myby1=c('red','blue',1,2,NA,'big',1,2,'red',1,NA,12) myby2=c('wet','dry',99,95,NA,'damp',95,99,'red',99,NA,NA) myby1.new = ifelse(is.na(myby1)==T,"is_na",myby1) myby2.n...