similar to: remove rows of a matrix by part of its row name

Displaying 20 results from an estimated 1000 matches similar to: "remove rows of a matrix by part of its row name"

2018 May 22
0
remove rows of a matrix by part of its row name
Hello, Please always cc the list. As for the question, yes, it does. If you want to remove just the ones with exactly 73.1 use the pattern grep("^73\\.1$", etc) Explanation: Beginning of string: ^ End of string: $ Escape special characters: \\ (needed because the period is a special character.) Hope this helps, Rui Barradas On 5/22/2018 12:50 PM, Ahmed Serag wrote: > Thank
2018 May 22
0
remove rows of a matrix by part of its row name
Hello, Use grep to get the row indices and then subset with a *negative* index to remove those rows. rn <- scan(what = character(), text = " 70/556 71.1/280 72.1/556 72.1/343 73.1/390 73.1/556 ") mat <- matrix(rnorm(6*6), nrow = 6) row.names(mat) <- rn inx <- grep("73\\.", row.names(mat)) new_mat <- mat[-inx, ] new_mat Hope this helps, Rui Barradas On
2009 Feb 10
2
Problem with retrieving updated variables after attach()
Hello, suppose I have a data frame: > mat id age 1 NA NA 2 NA NA 3 NA NA 4 NA NA 5 NA NA Then I attach the data frame: > attach(mat) I assign some new values... > id <<- sample(100,5) > age <<- rnorm(5,mean=30) Then I want to create a new data frame from the variables id and age which still are attached to position 2 of the R environment... > new_mat <-
2005 Feb 28
2
Two offices connection
I would like connect two offices where one office have 4 PSTN Analog lines and another office without any PSTN. Both the offices will have two separate Asterisk server with TDM400P cards (4 ports FXS & FXO). My questions is that how to configure Asterisk to forward the PSTN calls directly to another Asterisk which has the TDM400P card without pressing the extension number. Diagram like
2013 Jul 18
1
Bland Altman summary stats for all column combinations
Hello, I have the following data.frame structure(list(Study = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L,
2012 Apr 06
4
Order sapply
Good Afternoon, I have the following code, but it seems that something must be doing wrong, because it is giving the results I want. The idea is to create segments while the value of Commutation is less than 1000. for example, from the small set of data below text=" val_user pos v v_star v_end commutation v_source v_destine 1 1 96-96 1173438391 1173438391 0
2018 May 19
0
Split a data.frame
Hello, Maybe something like the following. splitDF <- function(data, col, s){ n <- nrow(data) inx <- which(data[[col]] %in% s) lapply(seq_along(inx), function(i){ k <- if(inx[i] < n) (inx[i] + 1):(inx[i + 1]) data[k, ] }) } splitDF(DF, "name", split_str) Hope this helps, Rui Barradas On 5/19/2018 12:07 PM, Christofer Bogaso
2007 Feb 27
2
quota - dict permission denied
when I enabled quota plugin the following error occured : net_connect_unix(/usr/local/var/run/dovecot/dict-server) failed: Permission denied Any ideas? My config are as follows : .. dict { #quota = mysql:/etc/dovecot-dict-quota.conf quotadict = mysql:/usr/local/etc/dovecot-dict-quota.conf } .. quota = dict:storage=81920:messages=5000 proxy::quotadict /usr/local/etc/dovecot-dict-quota.conf:
2018 May 19
5
Split a data.frame
Hi, I am struggling to split a data.frame as will below scheme : DF = data.frame(name = c('a', 'v', 'c'), val = 0); DF split_str = c('a', 'c') Now, for each element in split_str, R should find which row of DF contains that element, and return DF with all rows starting from next row of the corresponding element and ending with the preceding value of the
2012 Mar 27
2
R extract parts
Good Afternoon, I believe that my to the problem, the R has a more effective solution. in place the use the loop I have the following set of data, and needs to extract some sections. user pos communications source v_destine 7 1 109 22 22 7 2 100 22 22 7 3 214 22 22 7 4 322 22 22 7 5 69920 22 161 7 6
2012 Jul 24
3
Collapsing a vector/data-frame based on the previous values
Hello I have a data frame like this: dput(states) structure(list(Date = c("24/07/2012", "25/07/2012", "26/07/2012", "27/07/2012", "28/07/2012", "24/07/2012", "25/07/2012", "26/07/2012", "27/07/2012", "28/07/2012"), State = c(1L, 1L, 1L, 1L, 1L, -1L, -1L, -1L, 1L, -1L)), .Names = c("Date",
2019 Nov 20
4
LNT debuginfo-statistics not running?
The debug info statistics bot is triggered by this job: http://green.lab.llvm.org/green/job/clang-stage2-Rthinlto/ which unfortunately hasn't been green in a very long time (>1mo). Alex/Azhar, do you know what's blocking that job? -- adrian > On Nov 20, 2019, at 9:46 AM, David Blaikie <dblaikie at gmail.com> wrote: > > +usual debug info folks (but I think in this case
2012 Oct 24
2
Recode function car package erases previous values
Hi all, I am attempting to create a new variable based on values of other variables. The variable is called pharm. It basically takes the numeric code of 1 as yes and 0 to be No from the variable B20_C1 (a question on a survey). However, I would also like to have a level for non-respondents and these are captured in the variable nr.B20C, which is a 1 when there is a non-response on the whole group
2010 Jul 07
2
What does `_data` mean in transform()?
Hi All, I meant to take the min row by row. But the result is apparently not what I want. Changing min to pmin solve the problem. > df=data.frame(X=1:10, Y=1:10) > transform(df, Z=min(X,10-Y)) X Y Z 1 1 1 0 2 2 2 0 3 3 3 0 4 4 4 0 5 5 5 0 6 6 6 0 7 7 7 0 8 8 8 0 9 9 9 0 10 10 10 0 I try to look at the source code to understand what transform() does. I know
2023 Mar 02
1
transform.data.frame() ignores unnamed arguments when no named argument is provided
Dear r-devel, See below: transform(data.frame(a = 1), 2, 3) #> a #> 1 1 transform(data.frame(a = 1), b=2, 3) #> a b X3 #> 1 1 2 3 We need a small modification to make it work consistently, see below: transform.data.frame <- function (`_data`, ...) { e <- eval(substitute(list(...)), `_data`, parent.frame()) tags <- names(e) ## NEW LINE
2006 Dec 13
1
Questions about saving output files and popup
Hi all: After calculating in R I want to show the answer and some explanations not graphic plots in another new device and then save it as txt.file. However, I couldn't find any package or command to do it yet. I know some commands about generating graphics on different types of display or printing device. ex : windows(), postscript(), pdf() and etc. But these all works for graphic plots,
2012 Aug 21
2
Sequence detection longer than a certain value
Hello, I have 2 variable: one is an "id" sequence from 1:1000 and the other is variable with real values "VI" from -15.0 to 20.0 and I want to detect id values that have indicator values less than a certain threshold, for example (x=1) BUT that are in sequence equal or longer than 5. For instance, in the following column I want to recognize the sequence from "id" 4
2015 Apr 13
9
I'm not able to install asterisk in AWS cloud
Hi folks, I'm not able to install asterisk whenever I hit make command I get below error: make[1]: *** No rule to make target `../main/modules.link', needed by `asterisk'. Stop. make: *** [main] Error 2 Regards Akhilesh -------------- next part -------------- An HTML attachment was scrubbed... URL:
2010 Aug 10
3
grep problem decimal points looping
Hi R Users, I have been trying to work out how to rename column names using grep, basically I have generated these column names using tapply: [1] "NAME" "X1.1" "X2.1" "X3.1" "X4.1" "X5.1" "X6.1" "X7.1" "X8.1" [10] "X1.2" "X2.2" "X3.2" "X4.2"
2012 Aug 10
2
Regular Expressions + Matrices
Hi all, My code looks like the following: inname = read.csv("ID_error_checker.csv", as.is=TRUE) outname = read.csv("output.csv", as.is=TRUE) #My algorithm is the following: #for line in inname #if first string up to whitespace in row in inname$name = first string up to whitespace in row + 1 in inname$name #AND ID in inname$ID for the top row NOT EQUAL ID in inname$ID for the