similar to: Testing for empty result of which

Displaying 20 results from an estimated 20000 matches similar to: "Testing for empty result of which"

2011 Nov 07
1
tcltk window freezes when using locator( )
Hello useRs Using the following code: library(tcltk) win<-tktoplevel() ff<-function(){ plot(1:10,1:10) pol<-locator(1) print(pol) } button<-tkbutton(win,text="test",command=ff) tkpack(button) makes the win panel stop responding when the plot is closed before choosing a location. Usually, the windows task manager has to be used to
2011 Oct 25
2
Building package/DESCRIPTION file not existing?
Hello useRs I am trying to build a package for personal use and for making easier working with other people but I keep getting the same error message about the DESCRIPTION file not existing. when trying to install from a source tar.gz file: Error in .read_description(dfile) : file 'C:/Users/PropriƩtaire/AppData/Local/Temp/RtmpHFMONb/R.INSTALL647a3535/mypkg/DESCRIPTION' does not
2011 Feb 21
2
naming vectors
Hello R users I was trying to find a less annoying way of naming vectors than: x<-1:10 names(x)[1:length(x)]<-"A" So I tried: x<-1:10 names(x)<-"A" #but this gave only the first element named (as described in the help files) and x<-1:10 names(x)[]<-"A" #but this gave all elements named NA The curious thing with this last option is
2011 Mar 27
2
Coordinates of the text region
Hello R people Is there a way to get the coordinates of the text region (coordinates of the four corners for example) when using the text function? I'm looking for a way that does not make use of interactive function like locator. My goal is to determine the position of other structures in a graphic so that they don't overlap with the text. Thanks Francois Rousseu
2012 Feb 06
1
Getting the list of lines evaluated in a function call
Hello useRs I am looking for a function that can give the list of lines that were evaluated or used to generatethe last output from any function, whether an error message was generated or not. For example, let's say I have a function like this: foo <- function( x ){ if( x>10 ){ ans <- x+100
2010 Dec 15
2
Cumulative percentage by unit of time
Hi All, I've been struggling on that one for a couple of days. I've tried several things, but nothing is worth publishing. I'm working with a bird nests data frame for which I have a laying date (LD) and a fledgling date (FD) (in calendar Julian date) by nest id. For the period spanning between LD and SD, the nest is termed "active". Each nest id occur once in the data
2008 Dec 30
3
Componentwise means of a list of matrices?
Dear useRs, I have a list, each entry of which is a matrix of constant dimensions. Is there a good way (i.e., not using a for loop) to apply a mean to each matrix entry *across list entries*? Example: foo <- list(rbind(c(1,2,3),c(4,5,6)),rbind(c(7,8,9),c(10,11,12))) some.sort.of.apply(foo,FUN=mean) I'm looking for a componentwise mean across the two entries of foo, i.e., the
2009 Mar 07
4
merge data frames with same column names of different lengths and missing values
Hello, I'm switching over from SAS to R and am having trouble merging data frames. The data frames have several columns with the same name, and each has a different number of rows. Some of the values are missing from cells with the same column names in each data frame. I had hoped that when I merged the dataframes, every column with the same name would be merged, with the value in a complete
2011 Jul 14
1
calculating distance inland from coastline
Hi All, Does anybody know of any existing functions that will calculate distance inland from a coastline? It's possible to test if a lon,lat location is land or sea using map.where(), but I need to add a buffer to this of say 2km, to allow for points that are just on the coast, and below the resolution of the worldHires database. I'm working with a marine mammal satellite telemetry
2010 Jun 11
1
removing a non empty directory
I'd like to remove automatically a directory that may be non empty. I tried: > file.remove(NewDir, recursive=TRUE) [1] FALSE Warning message: In file.remove(NewDir, recursive = TRUE) : cannot remove file 'Prostate_Validated_mirWalk', reason 'Directory not empty' Is there another command to remove entire directories including their contents ? Thank you. Maura tutti i
2008 Jun 27
4
Recoding
Hi! Given a vector (or a factor within a df),i.e. v1 <- c(1,1,1,2,3,4,1,10,3) and a dictionary cbind(c(1,2,3),c(1001,1002,1003)) is there a function (on the same line than recode() in car) to get v2 as c(1001,1001,1001,1002,1003,4,1001,10,1003) ? I'm using myself a function based on match() since long ago (I think that thanks to advice by Prof. B. Ripley), but would like to know if there
2011 Mar 17
2
Why doesn't this work ?
Why doesn't this work and is there a better way ? z <-ifelse(t==1 || 2 || 3, 1,0) t <-3 z [1] 1 t <-4 z [1] 1 trying to say ...if t == 1 or if t== 2 or if t ==3 then true, otherwise false -- View this message in context: http://r.789695.n4.nabble.com/Why-doesn-t-this-work-tp3383656p3383656.html Sent from the R help mailing list archive at Nabble.com.
2010 Aug 13
6
Equality of Vectors
Hello, Is there a way to get a single TRUE or FALSE statement from comparing two vectors? For example, c(1,2,3) == c(1,2,3) produces TRUE TRUE TRUE where I would like it to produce only TRUE for use in an if statement. Likewise, when two vectors are not exactly identical (in all elements) I would like a single FALSE result, as opposed to c(1,2,3) == c(1,2,5) TRUE TRUE FALSE Any ideas?
2010 Mar 18
1
Using a function to consolidate variables
Dear List, I'm getting the error: object of type 'closure' is not subsettable And am not sure how to get around the problem. I've included two short code sets below. One that shows what I want to do and works, but without using the function much, and another that tries to use the function but causes the error. # THIS WORKS AND SHOWS WHAT I'D LIKE TO DO a <- c(1,2,3) b
2010 Jul 15
1
Repeated analysis over groups / Splitting by group variable
I am performing some analysis over a large data frame and would like to conduct repeated analysis over grouped-up subsets. How can I do that? Here some example code for clarification: require("flexmix") # for Kullback-Leibler divergence n <- 23 groups <- c(1,2,3) mydata <- data.frame( sequence=c(1:n), data1=c(rnorm(n)), data2=c(rnorm(n)), group=rep(sample(groups, n,
2010 Nov 10
1
plotting histograms/density plots in a triangular layout?
Hi! I have a set of 49 pairwise comparisons that I have done. From this I would like to plot either histograms or the density plots of the values I get. Now, I can plot one histogram per comparison, but I have problems getting the output I want. When plotting like I normally would do: histogram(~percid | orgA_orgB, data = alldata) I get the histograms next to eachother in a boxlike shape.
2011 Feb 10
2
Calculating rowMeans from different columns in each row?
Hello! I have a dataset like this: X1 X2 X3 X4 X5 X6 X7 X8 1 2 2 1 2 3 2 6 2 3 2 5 7 9 1 3 1 9 12 6 1 1 3 6 The columns X1-X6 contains ordinary numeric values. X7 contains the number of the first column that the rowMeans should be calculated from and X8 contains the last column
2009 Dec 08
3
re-ordering x-lables using barchart()
Hi R Users, I'm trying to re-order the "site names" ("Waseca", "Morris", ...). I'm using following code: libarry(lattice) barchart(yield ~ variety | site, data = barley, groups = year, layout = c(6,1), aspect=.7, ylab = "Barley Yield (bushels/acre)", scales = list(x = list(abbreviate = TRUE, rot=45,
2011 Feb 17
2
sort by column and row names
Hello, All, How can one sort on column and row names. For example: How can this X1 X3 X2 X1 1 0 0 X3 0 1 0 X2 0 0 1 become this? X1 X2 X3 X1 1 0 0 X2 0 1 0 X3 0 0 1 Thank you for your time! Jim [[alternative HTML version deleted]]
2010 Oct 01
3
Suppressing printing in the function
Hello! I wrote a function that returns a data frame. Nowhere in the function do I say print(my.data.frame), but when I run the function - the data frame is printed on the console. Is there any way to suppress it? Thank you! -- Dimitri Liakhovitski Ninah Consulting www.ninah.com