match

Match Optional Components in Any Order

佐手、 提交于 2019-12-25 02:29:41
问题 I have a URL that can contain any combination of parameters used in filtering results. The two params are type and sort. If type exists in the URL, it has to be either 'article', 'opinion', 'review', or 'media. If sort exists in the URL, it has to be one of the following: date-desc, date-asc, views-desc, views-asc, comments-desc, comments-asc. Right now, the expression I have only matches URI's with both type and sort. And it doesn't match URL's that contain neither params. I would like the

R - check elements of vector against other vector

£可爱£侵袭症+ 提交于 2019-12-25 02:25:09
问题 I would like to match the elements of a column in a dataframe against another dataframe. Consider these dataframes: A=data.frame(par=c('long A story','long C story', 'blabla D'),val=1:3) B=data.frame(par=c('Z','D','A'),val=letters[1:3]) Each element of B column 'par' should be matched against A column par. If there is a match, it should be labeled in A. [This then gives a column of common values for merging A and B]. The desired result is therefore: A=transform(A,label=c('A','NA','D')) How

VBA check value from column A exists in another workbook

心已入冬 提交于 2019-12-25 01:55:56
问题 I am trying to build a macro that loops through a range of values within colA and check if they exist with another workbook. In one of them I would like to mark it "Worked"/"Not Worked" Any guidance on where to start? 回答1: Example Here is an example of what you're looking for. Remember that both the workbooks have to be opened in the same instance of Excel. Sub check() Dim i As Integer, k As Integer, j As Integer 'Define your counting variables Dim Report1 As Worksheet, bReport As Workbook,

Find matches between unique pairs of two dataframes and bind values in R

时光怂恿深爱的人放手 提交于 2019-12-25 01:53:09
问题 I have two dataframes dat1 and dat2 and I would like to find matches between the first two columns of the two dataframes and join the values contained in each dataframe for unique pairs. dat1<-data.frame(V1 = c("home","fire","sofa","kitchen"), V2 = c("cat","water","TV","knife"), V3 = c('date1','date2','date3','date4')) V1 V2 V3 1 home cat date1 2 fire water date2 3 sofa TV date3 4 kitchen knife date4 dat2<-data.frame(V1 = c("home","water","sofa","knife"), V2 = c("cat","fire","TV","kitchen"),

一个大小写引发的灾难 --碎片的最佳实践4.5章节

ⅰ亾dé卋堺 提交于 2019-12-25 01:50:52
先分析一下项目的设计目标,目标是要实现一个兼容手机和平板的新闻应用,新闻应用包含两部分内容:新闻列表项和新闻内容。那么基本设计思路是,手机系统会根据最小宽度限定符自动确定显示为单页模式还是双页模式,在 MainActivity 代码中,通过对单页模式、双页模式的判断启用不同的显示。手机用户会在 MainActivity 中显示手机列表项,在另一个 Activity 中显示新闻内容;平板用户会在 MainActivity 左侧碎片显示新闻列表项,右侧碎片显示新闻内容。 了解了作者的设计思路,现在来读代码。准备工作是必不可少的,首先是一个新闻实体类 News,包含 title、content 两个字段和get、set方法,看到这个类,你第一时间就应该想到这是一个List列表的泛型类,用来创建适配器。接着准备好新闻列表适配器 NewsAdapter 和新闻列表子项布局 news_item.xml,这些代码比较简单,这里不解释(不理解参考《第一行代码》的3.5章节 ListView控件)。 接下来创建新闻内容布局 news_content_frag.xml,里面包含一个显示新闻标题和一个显示新闻内容的文本框。创建新闻内容碎片 NewsContentFragment 继承 Fragment,在 onCreateView()方法里加载刚刚编写的新闻内容布局,碎片还提供了更新新闻标题和内容的方法

Partial match of strings for filter method in Google Sheet GAS

混江龙づ霸主 提交于 2019-12-25 01:48:57
问题 I have the following codes: var filteredRange = rangeVals.filter(function(val){ return val[C2] == "ANTHONY"; }); This code works fine for an exact match. But if I would like to look for any values that ends with Y, this does not return anything: var filteredRange = rangeVals.filter(function(val){ return val[C2] == "*Y"; }); I have tried to us wildcard "%Y" but apparently this is not the correct way either. I have tried to look into this resource of RegExp from MDN but I can't seem to

Finding question marks in cell string

大憨熊 提交于 2019-12-25 01:35:23
问题 I would like to find out if a string within a cell in Excel 2010 contains any of the following, and then return a '1'. ?dementia ? dementia dementia? dementia ? I've tried some formulas but they don't seem able to get past the use of the wildcard and the string when combined. Would anyone have any pointers or advice? Here is a combination of the suggested answers, and my own work around: 回答1: This is the formula you need: =IF(IFERROR(FIND(A2,$C$3),0)>0,1,0) where A2 is the string that you are

index match with multiple criteria in rows

我与影子孤独终老i 提交于 2019-12-24 20:54:55
问题 I am working on a spreadsheet in which I have ticker id in column B, members corresponding to those tickers in column I and rates in column J. Rates change depending upon the no. of members, so one ticker ids can be in multiple rows. In my output, I need the rate for a particular ticker id and member. It should lookup exact ticker id but if no. of members is not there in data then it should pick the largest value that is less than or equal to lookup_value. I have attached snapshot of the data

dplyr mutate column with nearest value in external list

前提是你 提交于 2019-12-24 20:08:32
问题 I'm trying to mutate a column and populate it with exact matches from a list if those occur, and if not, the closest match possible. My data frame looks like this: index <- seq(1, 10, 1) blockID <- c(100, 120, 132, 133, 201, 207, 210, 238, 240, 256) df <- as.data.frame(cbind(index, blockID)) index blockID 1 1 100 2 2 120 3 3 132 4 4 133 5 5 201 6 6 207 7 7 210 8 8 238 9 9 240 10 10 256 I want to mutate a new column that checks whether blockID is in a list. If yes, it should just keep the

compare column names and make plots

和自甴很熟 提交于 2019-12-24 19:06:50
问题 I want to compare two columnnames from two data frames and create graphs with the matched columnnames from the original data frames. a<-data.frame(a1=c(1,2,3,4,5),a2=c(2,3,4,5,6),b1=c(3,4,5,6,7),c1=c(4,5,6,7,8)) b<-data.frame(c1=c(10,20,30,40,50),b1=c(20,30,40,50,60),d1=c(30,40,50,60,70)) Output should be like: plot (b$c1,a$c1) plot (b$b1,a$b1) I can create the plots with the above codes, but I need it to be automated because my dataframe is too large. 回答1: Here's one way: shared.names <-