extract

pasting two dataframes of different sizes

こ雲淡風輕ζ 提交于 2019-12-12 02:14:48
问题 I would like to paste strings from 2 dfs n and p - dput at the end. They have different sizes nrow(n) = 25 and nrow(p) = 20 with two factors : factor1 (binary) and factor2 (integers) head(n,3) head(p,3) string factor1 factor2 string factor1 factor2 -- -- -- -- -- -- h f1 5 i f1 1 h f1 6 c f1 2 h f1 7 c f1 3 tail(n,3) tail(p,3) string factor1 factor2 string factor1 factor2 -- -- -- -- -- -- a f2 27 h f2 18 g f2 28 i f2 19 b f2 29 i f2 20 Here, I would like to create a dataframe which does not

Extracting a word and its prior 10 word context to a dataframe in Python

▼魔方 西西 提交于 2019-12-12 01:56:56
问题 I'm fairly new to Python (2.7), so forgive me if this is a ridiculously straightforward question. I wish (i) to extract all the words ending in -ing from a text that has been tokenized with the NLTK library and (ii) to extract the 10 words preceding each word thus extracted. I then wish (iii) to save these to file as a dataframe of two columns that might look something like: Word PreviousContext starting stood a moment, as if in a troubled reverie; then seeming of it retraced our steps. But

What's the best method to EXTRACT product names given a list of SKU numbers from a website?

大城市里の小女人 提交于 2019-12-12 01:47:55
问题 I have a problem. I have a list of SKU numbers (hundreds) that I'm trying to match with the title of the product that it belongs to. I have thought of a few ways to accomplish this, but I feel like I'm missing something... I'm hoping someone here has a quick and efficient idea to help me get this done. The products come from Aidan Gray. Attempt #1 (Batch Program Method) - FAIL: After searching for a SKU in Aidan Gray, the website returns a URL that looks like below: http://www.aidangrayhome

Extract CString between tags

家住魔仙堡 提交于 2019-12-12 01:45:17
问题 How can I extract a CString between two tags ? <tag1>My Text</tag1> I don't want to calculate the start and end position then use Mid, maybe there is another easier method using STL ? 回答1: Disclaimer: the following idea is bad and should not be used in production code. I'm assuming you just want a quick hack for testing. Use a regular expression to match the tags. Microsoft provides this in CAtlRegExp. If you're using Visual Studio 2008 or newer, download ATL here. Then, just provide myString

Split a line on every 16th comma

99封情书 提交于 2019-12-12 01:36:23
问题 I am using perl to extract "Yes," or "No," from a large CSV, and output to a file using this code open my $fin, "leads.csv"; my $str; for (<$fin>) { if (/^\s*\d+\.\s*(\w+)/) { $str .= $1 . ","; } } open (MYFILE, '>>data.txt'); print MYFILE $str; close (MYFILE); This is working correctly, and outputting data like this http://pastebin.com/r7Lwwz8p, however I need to break to a new line after the 16th element so it looks like this on output: http://pastebin.com/xC8Lyk5R Any tips/tricks greatly

How to extract values from a 3D kernel density plot built in R using 'ks' and 'rgl'

倖福魔咒の 提交于 2019-12-11 22:53:50
问题 I've been using the 'ks' package along with the 'rgl' package to produce 3D kernel density estimates and 3D plots of these. This first part has worked out fine (brief example below). What I can't figure out is if it's possible to extract the values of the kernels for the given xyz locations used to build the kernels in the first place. In other words, extract the values for points in a 3D plot, akin to the extract command used for 2D surfaces in the 'raster' package. Does anyone have

Extract part of filename

China☆狼群 提交于 2019-12-11 19:58:13
问题 I have multiple filenames that look something like; com.test. app1 .deb com.heavy.test. app2 .deb com.maybe-test. app3 .deb com.crazy. app-4 .deb I would like to get the bolded strings only. so far, I've got this, name=$(echo $file | sed 's!\(*.\)\(.*\).deb!\2!') EDIT: I have other files in the same dir that would name something like; com.company. name _1.0.2_arm.deb Currently, my code looks like; for file in *.deb; do name=$(echo "$file" | sed 's/^.*\.\([^.][^.]*\)\.deb$/\1/') echo $name

How to extract a parameter from a list of functions in a loop

自闭症网瘾萝莉.ら 提交于 2019-12-11 19:25:16
问题 I have a large data set and I want to perform several functions at once and extract for each a parameter. The test dataset: testdf <- data.frame(vy = rnorm(60), vx = rnorm(60) , gvar = rep(c("a","b"), each=30)) I first definded a list of functions: require(fBasics) normfuns <- list(jarqueberaTest=jarqueberaTest, shapiroTest=shapiroTest, lillieTest=lillieTest) Then a function to perform the tests by the grouping variable mynormtest <- function(d) { norm_test <- res_reg <- list() for (i in c("a

Extract data with an OLE DB faster

旧时模样 提交于 2019-12-11 19:17:16
问题 Hi everyone I'm trying to extract a lot of records from a lot of joined tables and views using SSIS (OLE DB SOURCE) but it takes a huge time! the problem is due to the query because when I parsed it on sql server it takes more than hour ! Her's my ssis package design I thought of paralleled extraction using two OLE DB source and merge join but it isn't recommended using it! besides it takes more time! Is there any way to help me please? 回答1: Writing the T-sql query with all the joins in the

Extract date from string in shell script

筅森魡賤 提交于 2019-12-11 19:17:15
问题 I want to get a date which is in a string with shell script for an example: dddddddddddddddansdpaojhndpaosdjnad dddddddddddddddansdpaojhndpaosdjnad dddddddddddddddansdpaojhndpaosdjnad dddddddddddddddansdpaSun Apr 07 10:38:34 EEST 2013jnad dddddddddddddddansdpaojhndpaosdjnad How I can extract a date wich is in a string with shell script? 回答1: I don't know if your example text is really reflecting your real data. And I think the EEST is a typo? If work on the example you gave: