similar to: Regexp question

Displaying 20 results from an estimated 1000 matches similar to: "Regexp question"

2011 May 04
3
Regexp question
I have a string like this st <- "SELECT COUNT(empid), COUNT(mgrid), COUNT(empname), COUNT(salary), FROM Employees" How can I remove the last comma before the FROM statement? -J
2012 Aug 20
7
What makes R different from other programming languages?
My intention is to give a presentation about R programming language for software developers. I would like to ask, what are the things that make R different from other programming languages? What are the specific cases where Java/C#/Python developer might say "Wow, that was neat!"? What are the things that are easy in R, but very difficult in other programming languages (like Java)?
2009 Sep 30
3
AsciiDoc and R
I would like to learn AsciiDoc. Is there any good examples how to use AsciiDoc with R? I know that there is packages called ascii to do this, but it would be nice to see some examples how AsciiDoc works with R. Is there an AsciiDoc distribution for Max OS X? -Johannes
2010 Nov 08
7
How to rbind list of vectors with unequal vector lengths?
Hi, How to rbind these vectors from a list?: > l <- list(a = c(1, 2), b = c(1, 2, 3)) > l $a [1] 1 2 $b [1] 1 2 3 > do.call(rbind, l) [,1] [,2] [,3] a 1 2 1 b 1 2 3 Warning message: In function (..., deparse.level = 1) : number of columns of result is not a multiple of vector length (arg 1) > -J
2010 Mar 30
2
How to recode variables using base R
Hi, Is there an efficient way recoding variables in a data.frame using base R? My purpose is to create new variables and attach them into old data.frame. The basic idea is shown below, but how to create recoding for A, B and C and assing them into new variables? df <- data.frame(A = c(1:5), B = c(3,6,2,8,10), C = c(0,15,5,9,12)) df$A[df$A <= 3] <- "x" df$A[df$A > 3 &
2010 Jan 27
1
How to attach chart to excel file?
Hi, How can I attach chart/plot to a excel file? I would like to create a plot in R eg. plot(1) and save it into a Excel file, eg. test.xls in a same working directory. Regrads, -J
2010 Jan 29
1
How to convert timestamps?
I have timestamps from mysql database: > dput(tstamp) c(1225221868L, 1225221906L, 1225221906L, 1225230997L, 1225231000L, 1225231003L, 1225231152L, 1225231348L, 1225231351L, 1225231400L ) How to convert these into normal dates? Thanks, jrara
2010 Mar 12
3
How to format dates (with no century)?
Hi, I have dates in this kind of format (day, month, year): > dput(head(dates, 10)) c("6.4.7", "29.12.98", "19.10.91", "20.6.92", "2.9.3", "23.6.3", "13.7.93", "23.3.7", "26.6.95", "15.2.10") So, as you can see, there is no century. How can I change this character data into dates? Any help
2010 Oct 03
1
Package for converting R datasets into SQL Server (create table and insert statements)?
Hi, R contains many good datasets which would be valuable in other platforms as well. My intention is to use R datasets on SQL Server as a sample tables. Is there a package that would do automatic conversion from the dataset "schema" into a SQL Server CREATE TABLE statement (and INSERT INTO statements)? For example. > str(cars) 'data.frame': 50 obs. of 2 variables: $
2009 Oct 20
2
Problems importing Unix SAS .ssd04 file to R (Win)
Hello, I'm trying to import a SAS file made using SAS on Unix. Currently I'm using SAS on Windows and I'm trying to import that .ssd04 file to R. The file name of the file is testfile.ssd04 and it is located in 'M:\sasuser'. I'm using Windows XP and R 2.91. Basically what I'm doing is ############ r code ############## > library(foreign) > sashome <-
2010 Apr 29
1
data.table error
I'm trying to learn data.table package but I get a following annoying error message: > install.packages("data.table") trying URL 'http://www.freestatistics.org/cran/bin/macosx/universal/contrib/2.10/data.table_1.2.tgz' Content type 'application/x-gzip' length 66823 bytes (65 Kb) opened URL ================================================== downloaded 65 Kb The
2008 Nov 28
3
regexp help needed
Hello, I have a vector of dates and I would like to grep the year component from this vector (= all digits after the last punctuation character) dates <- c("28.7.08","28.7.2008","28/7/08", "28/7/2008", "28/07/2008", "28-07-2008", "28-07-08") the resulting vector should look like "08" "2008"
2009 Sep 12
1
How to visualize paired t-test results?
I would like to know if you have any suggestions how to visualize the results from a paired t-test (see the example data below). I tried to produce plots that show the mean and CI's from the original data and the estimate of the difference between means and the confidence intervals (see below) from the t-test. I really don't know what would be the best way to graphically display the
2011 Oct 05
3
help with regexp
Dear list memebers, I am stuck with using regular expressions. Imagine I have a vector of character strings like: test <- c('filename_1_def.pdf', 'filename_2_abc.pdf') How could I use regexpressions to extract only the 'def'/'abc' parts of these strings? Some try from my side yielded no results: testresults <-
2011 Oct 18
1
How to read data sequentially into R (line by line)?
I have a data set like this in one .txt file (cols separated by !): APE!KKU!684! APE!VAL!! APE!UASU!! APE!PLA!1! APE!E!10! APE!TPVA!17122009! APE!STAP!1! GG!KK!KK! APE!KKU!684! APE!VAL!! APE!UASU!! APE!PLA!1! APE!E!10! APE!TPVA!17122009! APE!STAP!1! GG!KK!KK! APE!KKU!684! APE!VAL!! APE!UASU!! APE!PLA!1! APE!E!10! APE!TPVA!17122009! APE!STAP!1! GG!KK!KK! it contains over 14 000 000 records. Now
2008 Aug 30
1
strsplit and regexp
Dear list, I am trying to split a string using regexp: x <- "2 Value 34 a-c 45 t" strsplit(x, "[0-9]") [[1]] [1] "" " Value " "" " a-c " "" " t" But I don't want to lose the digits (pattern), the result should be: [[1]] [1] "2" " Value " "34" " a-c "
2009 Feb 25
3
regexp capturing group in R
Hello, Newbie question: how do you capture groups in a regexp in R? Let's say I have txt="blah blah start=20080101 end=20090224". I'd like to get the two dates start and end. In Perl, one would say: my ($start,$end) = ($txt =~ /start=(\d{8}).*end=(\d{8})/); I've tried: txt <- "blah blah start=20080101 end=20090224" m <-
2008 Nov 02
5
R newbie: how to replace string/regular expression
Hello; I am a R newbie and would like to know correct and efficient method for doing string replacement. I have a large data set, where I want to replace character "M", "b", and "K" (currency in Million, Billion and K) to millions. That is 209.7B with (209.7 * 10e6) and 100.00K with (100.00 *1/100) and etc.. d <- c("120.0M", "11.01m",
2010 Mar 15
2
tcltk and R
I have had some comments on sqldf regarding its dependence on tcltk such as the second last sentence on this blog post: http://translate.google.com/translate?hl=en&sl=zh-CN&u=http://www.wentrue.net/blog/%3Fp%3D453&prev=http://blogsearch.google.com/blogsearch%3Fhl%3Den%26ie%3DUTF-8%26q%3Dsqldf%26lr%3D%26sa%3DN%26start%3D10 sqldf does not directly use tcltk but it does use strapply in
2010 Jul 02
3
Good Package(s) for String and URL processing?
Are there packages that allow improved String and URL processing? E.g. extract parts of a URLs such as sub-domains, top-level domain, protocols (e.g. https, http, ftp), file type based on endings, check if a URL is valid or not, etc... I am currently only using split and paste. Are there better and more efficient ways to handle strings e.g. finding sub-strings or to do pattern matching? What