which

Why or how is it that is my path is not being respected MacOSX? [closed]

﹥>﹥吖頭↗ 提交于 2020-02-24 12:58:06
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . How is it possible that the binary executed 'by default' -- ie. the first one found in my path, as returned by the which command, is in fact not the binary actually being executed by default? (I'm running Mac OS X 10.5 on a 2008 MacBook Pro.) I just installed the latest version of git by running brew install git

Why or how is it that is my path is not being respected MacOSX? [closed]

微笑、不失礼 提交于 2020-02-24 12:57:50
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . How is it possible that the binary executed 'by default' -- ie. the first one found in my path, as returned by the which command, is in fact not the binary actually being executed by default? (I'm running Mac OS X 10.5 on a 2008 MacBook Pro.) I just installed the latest version of git by running brew install git

R's which() and which.min() Equivalent in Python

陌路散爱 提交于 2020-01-24 02:19:48
问题 I read the similar topic here. I think the question is different or at least .index() couldnot solve my problem. This is a simple code in R and its answer: x <- c(1:4, 0:5, 11) x #[1] 1 2 3 4 0 1 2 3 4 5 11 which(x==2) # [1] 2 7 min(which(x==2)) # [1] 2 which.min(x) #[1] 5 Which simply returns the index of the item which meets the condition. If x be the input for Python, how can I get the indeces for the elements which meet criteria x==2 and the one which is the smallest in the array which

efficiently finding first nonzero element (corresponding column) of a data table

[亡魂溺海] 提交于 2020-01-04 11:11:48
问题 There are some answers on stack to the below type of question, but they are all inefficient and do not scale well. To reproduce it, suppose I have data that looks like this: tempmat=matrix(c(1,1,0,4,1,0,0,4,0,1,0,4, 0,1,1,4, 0,1,0,5),5,4,byrow=T) tempmat=rbind(rep(0,4),tempmat) tempmat=data.table(tempmat) names(tempmat)=paste0('prod1vint',1:4) This is what the data look like, although it is MUCH bigger, so the solution cannot be an "apply" or row-wise based approach. > tempmat prod1vint1

Cut Function in R program

徘徊边缘 提交于 2020-01-03 04:59:06
问题 Time Velocity 0 0 1.5 1.21 3 1.26 4.5 1.31 6 1.36 7.5 1.41 9 1.46 10.5 1.51 12 1.56 13 1.61 14 1.66 15 1.71 16 1.76 17 1.81 18 1.86 19 1.91 20 1.96 21 2.01 22.5 2.06 24 2.11 25.5 2.16 27 2.21 28.5 2.26 30 2.31 31.5 2.36 33 2.41 34.5 2.4223 36 2.4323 So I have data about Time and Velocity...I want to use the cut or the which function to separate my data into 6 min intervals...my Maximum Time usually goes up to 3000 mins So I would want the output to be similar to this... Time Velocity 0 0 1.5

'which' vs 'command -v' in Bash [duplicate]

你离开我真会死。 提交于 2019-12-31 09:45:49
问题 This question already has answers here : How to check if a program exists from a Bash script? (35 answers) Closed 3 years ago . I've read in some bash FAQ a while ago (that I don't remember), that which should be avoided and command -v preferred. Why is that so? What are the advantages, disadvantages of either one? 回答1: Well... command is likely built in to your shell, and with the -v option will tell you how your shell will invoke the command specified as its option. which is an external

'which' vs 'command -v' in Bash [duplicate]

[亡魂溺海] 提交于 2019-12-31 09:44:10
问题 This question already has answers here : How to check if a program exists from a Bash script? (35 answers) Closed 3 years ago . I've read in some bash FAQ a while ago (that I don't remember), that which should be avoided and command -v preferred. Why is that so? What are the advantages, disadvantages of either one? 回答1: Well... command is likely built in to your shell, and with the -v option will tell you how your shell will invoke the command specified as its option. which is an external

ifelse behaviour with which function in R

不想你离开。 提交于 2019-12-25 00:36:43
问题 Just been playing with some basic functions and it seems rather strange how ifelse behaves if I use which() function as one of the arguments when the ifelse condition is true, e.g.: #I want to identify the location of all values above 6.5 #only if there are more than 90 values in the vector a: set.seed(100) a <- rnorm(100, mean=5, sd=1) ifelse(length(a)>90, which(a>6.5), NA) I get this output: [1] 4 When in fact it should be the following: [1] 4 15 25 40 44 47 65 How then can I make ifelse

Vector-version / Vectorizing a for which equals loop in R

帅比萌擦擦* 提交于 2019-12-24 08:58:42
问题 I have a vector of values, call it X, and a data frame, call it dat.fram. I want to run something like "grep" or "which" to find all the indices of dat.fram[,3] which match each of the elements of X. This is the very inefficient for loop I have below. Notice that there are many observations in X and each member of "match.ind" can have zero or more matches. Also, dat.fram has over 1 million observations. Is there any way to use a vector function in R to make this process more efficient?

R: How to retrieve a column name of a data frame [duplicate]

天大地大妈咪最大 提交于 2019-12-24 08:19:09
问题 This question already has answers here : For each row return the column name of the largest value (7 answers) Closed last year . I am trying to extract the colnames of a data frame, based on the values in the cells. My data is a series of a couple hundred categories, with a simple binary 0 or 1 in the cells to indicate which column name I want in my new df. To illustrate my point: year cat1 cat2 cat3 ... catN 2000 0 0 1 0 2001 1 0 0 0 2002 0 0 0 1 .... 2018 0 1 0 0 I am trying to get a df