similar to: nested subset for a dataframe

Displaying 20 results from an estimated 30000 matches similar to: "nested subset for a dataframe"

2010 Apr 16
3
problem with FUN in Hmisc::summarize
Hi all, I'd like to use the Hmisc::summarize function, but it uses a function (FUN) of a single vector argument to create the statistical summaries. Consider an easy case: I'd like to compute the correlation between two variables in my dataframe, grouped according to other variables in the same dataframe. For exemple, consider the following dataframe D: V1 V2 V3 A 1 -1 A 1
2006 Apr 19
1
gsummary function (nlme library) (PR#8782)
Full_Name: Ben Saville Version: 2.1 OS: Windows XP Submission from: (NULL) (152.2.94.145) I'm using the gsummary function to calculate a sum of V1 (column one) from my data 'mytest' by group (V2,or column 2). If V1 (the variable of interest) is all the same value (in this case all 2's), I do not get back the correct summation. If there is at least one difference in V1 (all
2003 May 01
2
What' wrong?
I try to do single proportion test on my category data. Here is my R script: library("ctest") catSignifTest <- function( catFile ) { ############################################################### ## Get the data sets from text file catData <- read.table( catFile ) ncols <- length(catData) nrows <- length(catData[,1]) ncol1 <- ncols - 1 probeNbr
2010 Mar 16
3
remove substring from each string vector component
Hi all, I have a string vector like that: x=c("1\t\t", "2", "3\t\t\t") I need to remove all the occurrences of "\t", in order to obtain: x = "1" "2" "3" I'm trying to use the function substring2, and it works for each component, for example: substring2(x[1], "\t") ="" gives x = "1"
2008 Jan 13
2
{worker} after :end-time worker freaks out
Hi all, i was using bdrb a while ago and it wasn''t stable enough in version 0.2.1 for doing the job - it loss jobs or did execute only the first one invoked and so on. Now i gave the new version a try and i found a bug at playing around. When i start a worker_method over the normal Unix scheduler bdrb will start as much as possible the worker_method after the :end-time is reached.
2004 Nov 05
2
Creating .Rout.save files for package subdirectory "tests"
Hi, I added the "tests" subdirectory and a test file (say "myTest.R") to our "systemfit" package. Up to now I create the "myTest.Rout.save" file with > R CMD BATCH --vanilla myTest.R myTest.Rout.save However, "R CMD check" reports two differences between myTest.Rout.save and the output of myTest.R: a) myTest.Rout.save contains following
2010 Mar 24
1
flexible alternative to subsetting dataframe inside nested loops
I have a dataFrame variable: L1 L2 L3 ... v1 v2 ... 1 2 3 4 ... I want to process subsets of it as defined by combinations of L1-L2-L3. I do it successfully using nested loops: for (i in valuesOfL1 { for (j in valuesOfL2) { for (k in valuesOfL3) { tempData <- subset(dataFrame, (L1 == i & L2 == j & L3 == k, select=c(v1,v2) )) if
2013 Dec 13
2
how can i write the function into a file c:/mytest.R with cat function?
mytest<-function(x,f){ sum(x*f)/sum(f) } cat(mytest,file="c:/mytest.R") Error in cat(list(...), file, sep, fill, labels, append) : argument 1 (type 'closure') cannot be handled by 'cat' how can i write the mytest function into a file c:/mytest.R with cat function? [[alternative HTML version deleted]]
2010 Mar 29
3
how to update R files included as"source" ?
Hi all, I have a main file main.R in which I include some other R files. For example, in main.R I have: source("functions.R"). When I modify the file "functions.R", I'd like R to take into account the changes and to reload the file functions.R when I run main.R Is it possible? Thanks, Arnaud [[alternative HTML version deleted]]
2008 Jun 27
3
cumulative sum of within levels of a dataframe
This one should be easy but it's giving me a hard time mostly because tapply puts the results in a list. I want to calculate the cumulative sum of a variable in a dataframe, but with the accumulation only within each level of a factor. For a very simple example, take: > df <- data.frame(x=c(rep(1,5),rep(2,5),rep(3,5)),fac=gl(3,5,labels=letters[1:3])) > df x fac 1 1 a 2 1 a
2009 Jan 16
3
rspec model testing - test on user defined validation- How do I test that the create failed.
I''m new to rspec and looking for way to test a validation I added to a model. The test checks to see that if field1 has a value then field2 must be nil and vice versa. ------------------------------- When I did the rspec_scaffold it generated one test which worked before :each do @valid_attributes = { :field1 = "value for field1" :field2 = "value for
2010 Mar 26
1
regular expression
Hi, I need to select a substring from the filename of a file in a list. I can find all the filenames in a directory by list.files(fn_dir) Each filename has the format (the following is an example because field lengths are variable) XXX184_YYY_ZZZ.dat XXX: 2 or 3 alphabetic characters 184: 3 numeric characters ... I'd like to select the substring XXX which has variable length (from each
2010 Apr 23
1
ggplot2: how to specify x-axis limits to geom_abline() ?
Hi all, I'd want to plot a segment from a line specified by slope and intercept. I want to plot this line between two limits, x1 and x2, without imposing these limits to the hole plot as it is the case with scale_x_continuous(limits=c(x1,x2)) or with xlim and ylim. Any idea? Arnaud Chozo [[alternative HTML version deleted]]
2009 May 19
2
incremental directory searche in rsync 3.0.6
Hi, I was in under impression that rsync 3.0.5/3.0.6 creates all the missing directories in the path but I think I am wrong. Could any one tell me is it possible to create all missing dirs in path at destination side if not exists. Currently, I have been getting below errors. rsync -avz /tmp/mytest/rsync-test/dir-test/parent-dir/ desthost:/tmp/mytest/rsync-test/dir-test/parent-dir/ sending
2014 Jun 09
4
[LLVMdev] LTO and Optimized libraries don't mix
When using the ARM cross compiler we've run into an issue with LTO and optimized libraries. Consider you have an optimized library opt.a, which contains a version of memcpy. Compiling with LTO (something like), clang myTest.c opt.a -flto -o myTest causes myTest.c to get compiled to bitcode. Then the bitcode gets passed to the linker. The linker looks through the bitcode (via
2010 Jul 02
4
zfs - filesystem versus directory
Folks, While going through a quick tutorial on zfs, I came across a way to create zfs filesystem within a filesystem. For example: # zfs create mytest/peter where mytest is a zpool filesystem. When does this way, the new filesystem has the mount point as /mytest/peter. When does it make sense to create such a filesystem versus just creating a directory? # mkdir mytest/peter Thank you in
2010 Dec 03
2
How to get 'R' to talk BACK to other languages / scripts??
Hey everyone, I know that I can call 'R' from other scripts, and that I can make command calls from 'R' (e.g., using system() ). But how can I get 'R' to RETURN values to the script that called it. E.g., I would like to be able to do something like the following (as a simpler example) from a bash script: #!/bin/bash myTest=echo /usr/local/bin/R --no-restore
2010 Jan 01
1
Questions bout SVM
Hi everyone, Can someone please help me in these questions?: 1)if I use crossvalidation with svm, do I have to use this equation to calculate RMSE?: mymodel <- svm(myformula,data=mydata,cross=10) sqrt(mean(mymodel$MSE)) But if I don’t use crossvalidation, I have to use the following to calculate RMSE: mymodel <- svm(myformula,data=mydata) mytest
2012 Feb 07
6
Setting up infile for R CMD BATCH
Suppose I create an R program called myTest.R with only one line like the following: type <- as.integer(readline("input type (1: type1; 2: type2)? ")) Then I'd like to run myTest.R in batch mode by constructing an input file called answers.R with the following: source("myTest.R") 1 When I ran the following at the terminal: R CMD BATCH answer.R output.Rout it failed
2005 Dec 19
6
Shutdown script not being run
I've got an odd problem. My server will not shutdown normally because the AoE driver is not being shut down properly. While investigating the problem, I found that the aoe script is apparently not being called for shutdown. I have been able to duplicate this with a brand new test script. My test script is just a simple file that echos back the start or stop command: #!/bin/bash #