top of page
Search
veldagal8gia

Nokia E5 Firmware 101.003 632 Panwha







I want to create a new column in the Dataframe 'body' for the text from the cell to the next one that has the text 'Nokia E5 Firmware 101.003 632' How can I do that using R? A: First, find where there is a "Nokia E5" phrase and paste that line's position to the left of it. df$foo = sub(".*(Nokia E5|Nokia.*).*", "\1", df$body) You could find the first instance of it by: df$foo = sub(".*(Nokia E5|Nokia.*).*", "\1", df$body) df$foo To add the second: df$foo = paste(df$foo[c(1, (length(df$foo)+1):length(df$foo))], df$body, sep=" ", collapse = " ") This creates a new column that keeps the second instance of the "Nokia E5" phrase in the first column and the original "Nokia E5" phrase in the third column. You could also use rbind to create a column with the two instances in the same cell. Q: How to speed up the program? I have an assignment to write a program to read a list of words from stdin, find the lexical number of words (for example 1, 2, 1, 2, 2), store the lexical number and then print the lexical number (The result should be 1 2 2 2 1 1 1 1...). I have wrote the following code, but it runs very slow in some cases. Any suggestions to optimize my code? I think the time complexity is O(n^2) #include using namespace std; const int MAX_LEN = 100; int main() { long long n; cin >> n; vector s; for(int i=0;i> s[i]; } vector::iterator it = lower_bound(s.begin(), s.end(), 1); ac619d1d87


Related links:

3 views0 comments

Comments


bottom of page