[R] Functions Accessing Databases

2009-04-02 Thread Bob Roberts
Hello, I'm accessing a MySQL database from inside R and had a problem with a function. In the database, there is data from years 1985 to 2007 that I would like to retrieve. I can easily get the data from one year by the following: info1985=dbGetQuery(con, statement='the SQL query') Inside the

[R] Convert Character to Date

2009-03-31 Thread Bob Roberts
Hello, I have a date in the format Year-Month Name (e.g. 1990-January) and R classes it as a character. I want to convert this character into a date format, but when I try as.Date(1990-January, "%Y-%B"), I get back NA. The function strptime also gives me NA back. Thanks. [[a

[R] Extract Row on Criteria

2009-03-05 Thread Bob Roberts
Hi, I have a data frame and I want to extract the entire rows that have the 20 largest numbers in column Z. How would I go about doing that? Thanks. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://s

[R] Eliminate Factors from Data Frame

2009-03-04 Thread Bob Roberts
Hi, I formed a 49 by 3 data frame by reading in a text file using read.table(), and combining it with a matrix that I made by using unlist() on a list of character strings. I would like to do some simple arithmetic operations on the elements in the data frame columns (e.g. column 3/column2) b

[R] Number Regular Expressions

2009-03-03 Thread Bob Roberts
Hi, I'm trying to write a regular expression that captures numbers in the form 9,007,653,372,262.48 but does not capture dates in the form 09/30/2005 I have tried numerous expressions, but they all seem to return the dates as well. Thanks. [[alternative HTML version deleted]]

[R] Characters To Matrix

2009-03-03 Thread Bob Roberts
Hi, I have a data set that I read in using readLines, but R classes it as a character string. The data set has multiple columns and rows, but I only want the first 2 columns in the form of a matrix. Thanks for the help. [[alternative HTML version deleted]] __