similar to: simple question on picking out some rows of a matrix/data frame

Displaying 20 results from an estimated 9000 matches similar to: "simple question on picking out some rows of a matrix/data frame"

2007 Feb 26
1
match() function with a little enhancement
Dear R users, I was wondering if R has a built-in function doing the following : my_match(values_vector,lookup_vector) { for each value of values_vector : if value %in% lookup_vector, then value is unchanged else, value is changed the the closest element of lookup_vector, "closest" meaning "the one that would come just after if we sorted them using order()" } For example :
2007 Oct 26
2
function in R that's equivalent to SQL's "IN"
Hi all, I'm trying to find something like the "==" operator that will work on vectors or something equivalent to SQL's "IN" function. For e.g., if I have: x <- c(1,2,3,4,5) y <- c("apples", "oranges", "grapes", "bananas", "pears") z <- data.frame (x,y) w <- c(2,4,5) I want R to return the values
2015 May 15
1
Posix vs. Windows File/Directory Permissions
On Fri, May 15, 2015 at 11:24 AM, Andrey Repin <anrdaemon at yandex.ru> wrote: > Moral of the story: You've compared apples to oranges and claimed that > bananas > are better. > > When you've created a linux user called "Administrator" is had nothing to > do > with AD user "Administrator". > When you changed POSIX access bits on a file it
2008 Mar 07
9
question about WINEPREFIX
I wanted to ask to the wine experts something about WINEPREFIX or the crossover bottles... how does the concept of "bottles" compares/differs with the concept of application virtualization (http://en.wikipedia.org/wiki/Application_Virtualization) used by VMware's Thinstall (http://www.thinstall.com/products/virtualization_suite.php) (aside for the .exe container*) and
2010 Jan 08
2
How to Merge based on Rows
Let's say that I have a bunch of matrices. They look like this (pardon using fruit for examples, my actual data tables are far too enormous): Matrix1 Apples Oranges Pears A 5 6 7 B 5 3 4 C 8 9 10 D 11 13 14 E 15 3 8 F 1 4 5
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
2010 Jun 09
2
Change the name of one column ONLY
Hi all, I have a very simple problem that I cannot seem to find the answer to. Consider the following toy dataset: x <- read.table(textConnection("V1 apples bananas cherries indv.1 7 8 4 3 indv.2 7 7 4 9"), header = TRUE) How would I change the column name of ONLY the first column, not the others? Surely I should not have to re-specify the names of ALL the columns -- e.g.,
2016 Jun 25
2
strange behavior in 'inherits' check for loaded S4 object
Hi, (sorry for the wall of text; the issue here appears to be rather complicated) I'm seeing a somewhat strange case where checking whether an S4 object inherits from a parent class defined from another package with 'inherits' fails if that object is materialized through a call to 'load'. That's a mouthful, so I've put together a relatively small reproducible example
2009 Feb 19
2
counting strings in a column
Dear All, I have a query : what is the command to count number of repeated words in a column. for ex: a = oranges oranges apples apples grape oranges apple pine the result should be oranges 3 apples 3 grape 1 pine 1 is there an easy way for this. Thanks, Nataraju GM R & D Bangalore -- "No relationship is Static .. You either Step up or Step down" [[alternative HTML
2008 Mar 19
1
Radio Buttons or similars
Hello companions!!! I have a function that creates a Radio Buttons, and I need that this function return the selected value in the Radio Buttons. I would like that, if somebody know as I could return the value, you say me as do it. Next, I show the function function1<-function(){ require(tcltk) tt <- tktoplevel() rb1 <- tkradiobutton(tt) rb2 <- tkradiobutton(tt) rbValue <-
2015 May 15
5
Posix vs. Windows File/Directory Permissions
On Fri, May 15, 2015 at 4:37 AM, Klaus Hartnegg <hartnegg at uni-freiburg.de> wrote: > Not sure which email you mean. I don't think that this can happen. If the > Linux acls are modified, the Windows ACLs are destroyed and all is based on > the Linux permissions and acls (which looks strange when viewed from > Window). If the Windows ACLs are modified, Samba automatically
2004 Nov 04
3
keep dimension of a sub matrix
Hi, is there any way to keep a sub matrix dimension? exemple : i1<-1; i2<-1 j1<-2; j2<-3; ret <-matrix(1,4,4)[i1:i2,j1:j2] ; dim(ret) is NULL because the submatrix single col or single row is coerce to a vector automaticaly. How can i bypass this cast : submatrix->vector ??????? Thank you. --------------------------------- [[alternative HTML version
2016 Jul 29
2
strange behavior in 'inherits' check for loaded S4 object
I should add one more item that may be related here -- calling 'methods:::.requirePackage' returns a different result based on whether the package namespace is already loaded or not. If the package namespace is not loaded, the package is loaded and attached, and the package environment is returned: > methods:::.requirePackage("digest") Loading required package:
2012 Aug 23
1
Why was my R process killed spontaneously?
I tried to use gpuCor function in the gputools package of R to calcuate the pairwise correlations of a matrix of 40,000 columns. Becuase there would be memory issues if I use the whole matrix at a time, I splitted the matrix into submatrix of 10,000 columns and then calculate the pairwise correlation of different submatrices. There are altogether 4 submatrices, so I need to calculate the pearson
2013 Sep 13
2
xtable use plus minus
I am using a similar dataset to the following: a= c("Fruits", "Adam","errorA", "steve", "errorS", "apples", 17.1,2.22, 3.2,1.1, "oranges", 3.1,2.55, 18.1,3.2 ) a_table=data.matrix(t(matrix(a,nrow=5))) I would like to plus minus every second column starting from errorA (using xtable/ hmisc) example output (ignoring
2000 Feb 11
1
Creating efficiently a subset of a matrix
Dear R-helpers I have the following problem: given a m x n matrix A, I want to have just a m x k submatrix B, with B[i,] = A[i, offset[i] + 1:k], e.g. from > offset <- c(0, 0, 1) > a <- matrix(1:9, 3) > a [,1] [,2] [,3] [1,] 1 4 7 [2,] 2 5 8 [3,] 3 6 9 the submatrix b 1 4 2 5 6 9 I can do this with a for loop or with sapply > b <-
2010 Mar 29
4
Confusing concept of vector and matrix in R
Why does R need the concept of "Vector"? In my opinion, it is a useless and confusing concept. A vector is simply a special case of a matrix whose row or column number is equal to 1. When I take submatrix from one matrix and if row or column number is 1, R will automatically convert it into a vector. It is very straightforward that a submatrix of a matrix should be a matrix. In
2007 Oct 15
2
Get data from matrix
Hi, I have a matrix that has a variable number of columns. I do not know, a priori, the number of columns. How can I get a sub matrix, for example, from row 10 to the end of the columns? In MatLab I would use something like this: SubMatrix = Matrix[10, 1:end] Thanks a lot. -- View this message in context: http://www.nabble.com/Get-data-from-matrix-tf4629336.html#a13218653 Sent from the R
2004 Dec 17
2
Matrix and rownames problem
Hi, I'm quite new to R, so excuse me if this problem has a simple solution. I'm working with an array, lets say i <- array(c(1:3,3:1), dim=c(3,2)) Then I want to give the rows and the columns names: rownames(i)<-c("a","b","c") colnames(i)<-c("d","e") The result is given below: d e a 1 3 b 2 2 c 3 1 Here comes my problem.
2016 Jul 31
2
strange behavior in 'inherits' check for loaded S4 object
(Just returning from the "wilds" of Canada, so not able to comment on the specifics, but ...) There is a basic point about generic functions that may be related to the "private" class question and my earlier remarks that Martin alluded to. R (and S4 before it) allows packages to define methods for a generic function in another package. Say, for plot() in graphics. The