similar to: value of a loop broken by break

Displaying 20 results from an estimated 30000 matches similar to: "value of a loop broken by break"

2004 Aug 18
5
labeled break statements in R?
Hi, Are there labeled break statements in R? i.e., something along the lines of TOPLOOP: for(i in 1:m) { for(j in 1:n) { ... if(condition) { break TOPLOOP } } } Thanks, Roger
2004 Jun 14
5
terminology for frames and environments
In ?exists it says: inherits: should the enclosing frames of the environment be searched? I believe what it is saying is that if inherits is TRUE and it fails to find the variable it will look in the parent environment and the parent of the parent, etc. (as opposed to looking in the calling frame next and the caller of the caller, etc.) Now I thought that standard terminology in R was: 1.
2004 Mar 18
12
substitute question
Consider the following example: # substitute a with b in the indicated function. Seems to work. > z <- substitute( function()a+1, list(a=quote(b)) ) > z function() b + 1 # z is an object of class call so use eval # to turn it into an object of class expression; however, # when z is evaluated, the variable a returns. > eval(z) function()a+1 Why did a suddenly reappear again
2003 Dec 19
5
for loop over dataframe without indices
One can perform a for loop without indices over the columns of a dataframe like this: for( v in df ) ... some statements involving v ... Is there some way to do this for rows other than using indices: for( i in 1:nrow(df) ) ... some statements involving df[i,] ... If the dataframe had only numeric entries I could transpose it and then do it over columns but what about the general case?
2004 Feb 17
5
pass by reference -- how to do it
Hello, Pass by reference appears to be a topic which comes up from time to time, but I wasn't able to find something in the R-help archives which tells how to accomplish it. I have a problem that you may have seen before -- R runs out of memory when processing large matrices. Part of the problem for me is that I am using some large matrices as function arguments, and these are modified,
2003 Nov 05
1
save(iris,file=
I tried it using file and it seems to work for saving: > data(iris) > con <- file("clipboard","w") > save(iris,ascii=T,file=con) > close(con) > readLines("clipboard") ... lengthy output follows which seems correct ... but not for loading: > con <- file("clipboard","r") > load(con) Error in load(con) : loading from
2004 Dec 24
6
Sorting problem
Hi I'm using R 2.0 in SuSE 9.2. When I plot data as a boxplot, the boxes appear on the plot in alphabetical order (of group) rather than the order in which they appear in the data. So far, the only thing I can do to fix this is to prefix the group labels with a,b,c...etc to trick R into plotting them in the right order. Can sorting be turned off? How should I address this sensibly? Thanks
2004 Aug 28
6
model.matrix.default chokes on backquote (PR#7202)
Full_Name: Gabor Grothendieck Version: R version 1.9.1, 2004-08-03 OS: Windows XP Submission from: (NULL) (207.35.143.52) The following gives an error: > `a(b)` <- 1:4 > `c(d)` <- (1:4)^2 > lm(`a(b)` ~ `c(d)`) Error in model.matrix.default(mt, mf, contrasts) : model frame and formula mismatch in model.matrix() To fix it replace this line in model.matrix.default:
2004 Dec 02
2
regex to match word boundaries
Can someone verify whether or not this is a bug. When I substitute all occurrence of "\\B" with "X" R seems to correctly place an X at all non-word boundaries (whether or not I specify perl) but "\\b" does not seem to act on all complement positions: > gsub("\\b", "X", "abc def") # nothing done [1] "abc def" >
2003 Dec 17
6
Factor names & levels
When I alter the levels of a factor, why does it alter the names too? f <- factor(c(A="one",B="two",C="one",D="one",E="three"), levels=c("one","two","three")) names(f) -- gives [1] "A" "B" "C" "D" "E" levels(f) <-
2003 Dec 02
8
Vector Assignments
Hi, I have simple R question. I have a vector x that contains real numbers. I would like to create another vector col that is the same length of x such that: if x[i] < 250 then col[i] = "red" else if x[i] < 500 then col[i] = "blue" else if x[i] < 750 then col[i] = "green" else col[i] = "black" for all i I am convinced that there is probably a
2004 Nov 18
5
Building Packages on Windows using .Rbuildignore (PR#7379)
On Thu, 18 Nov 2004 00:38:47 +0000 (UTC), Gabor Grothendieck <ggrothendieck@myway.com> wrote : >DIFFERENCE BETWEEN USING .RBUILDIGNORE AND NOT > >The reason that the processing is different according to whether one >uses .Rbuildignore or not is that > R CMD build >takes the .Rbuildignore file into account but > R CMD install > R CMD check > R CMD build
2004 Aug 09
5
How to import specific column(s) using "read.table"?
Dear R people, I have a very big tab-delim txt file with header and I only want to import several columns into R. I checked the options for "read.table" and only found "nrows" which lets you specify the maximum number of rows to read in. Although I can use some text editors (e.g., wordpad) to edit the txt file first before running R, I feel it?s not very convenient. The
2004 May 25
3
accessing function arguments as text, macro style
Hi. In a case like this, I can get strip headings that have the name "c" and the value for c. d <- data.frame(a=1:5,b=6:10,c=11:15) > xyplot(a ~ b | paste("c", c), data=d) > For more complicated examples, instead of using paste repeatedly I would like to use a function. It seems like what I really want is a macro, though. I'm not quite familiar enough
2003 Oct 21
5
do.call() and aperm()
Hi everyone I've been playing with do.call() but I'm having problems understanding it. I have a list of "n" elements, each one of which is "d" dimensional [actually an n-by-n-by ... by-n array]. Neither n nor d is known in advance. I want to bind the elements together in a higher-dimensional array. Toy example follows with d=n=3. f <-
2004 Jun 20
9
A way to list only variables or functions?
I am curious if there is any way to list only variables or functions in current environment, rather than listing all objects? Thanks. -- Daehyok Shin (Peter) Geography Department Univ. of North Carolina-Chapel Hill
2004 Jun 20
9
A way to list only variables or functions?
I am curious if there is any way to list only variables or functions in current environment, rather than listing all objects? Thanks. -- Daehyok Shin (Peter) Geography Department Univ. of North Carolina-Chapel Hill
2003 Nov 26
4
strptime Usage
Hi, I have a column in a dataframe in the form of: > as.vector(SLDATX[1:20]) [1] "1/6/1986" "1/17/1986" "2/2/1986" "2/4/1986" "2/4/1986" [6] "2/21/1986" "3/6/1986" "3/25/1986" "4/6/1986" "4/10/1986" [11] "4/23/1986" "4/30/1986" "5/8/1986"
2004 May 01
5
skip lines on a connection
Hi, I am looking for an efficient way of skipping big chunks of lines on a connection (not necessarily at the beginning of the file). One way is to use read lines, e.g. readLines(1e6), but a) this incurs the overhead of construction of the return char vector and b) has a (fairly remote) potential to blow up the memory. Another way would be to use scan(), e.g. scan(con, skip=1e6, nmax=0)
2004 Dec 28
1
win variable in tcltk
The following gives an error message: library(tcltk) win <- list(env="A") tt <- tktoplevel() but <- tkbutton(tt, text="X", command=expression(tkdestroy(tt))) tkgrid(but) however, if one comments out the win line (and removes the win variable) then it works. It seems that tcltk is making use of a variable called win with a component name of env and I just happened