Re: [R] SQL like function?
Hi Gabor, Wow, this is awesome although I eventually should learn MySQL for integrating it on web-based DB management using PHP or Perl, this is a very helpful tool for me to start with! Thank you very much Gabor Grothendieck wrote: Others have already pointed out %in% but regarding your comment about SQL, you can use SQL to manipulate R data frames using the sqldf package which provides an interface to lower level RSQLite (and RMySQL in the future) routines. The following examples use SQLite underneath: DF - data.frame(observation = c(1,2,3,4,5)) ID - data.frame(ID = c(1, 3, 4)) library(sqldf) sqldf(select observation, observation in (select * from ID) `ID?` from DF) # or sqldf(select observation, observation in (1, 3, 4) `ID?` from DF) See home page at: http://sqldf.googlecode.com On 9/7/07, Takatsugu Kobayashi [EMAIL PROTECTED] wrote: Hi RUsers, I am wonder if I can search observations whose IDs matches any of the values in another vector, such as in MySQL. While I am learing MySQL for future database management, I appreciate if anyone could give me a hint. Suppose I have one 5*1 vector containing observation IDs and frequencies, and one 3*1 vector containing observation IDs. observation-c(1,2,3,4,5) ID-c(1,3,4) Then, I would like to program a code that returns a results showing matched observations like result: TRUE FALSE TRUE TRUE FALSE I am reading S programming, but I cannot find a way to do this. Thank you very much. Taka __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SQL like function?
Great. Regarding the web, note that there are actually quite a few R web projects as well: http://www.lmbe.seu.edu.cn/CRAN/doc/FAQ/R-FAQ.html#R-Web-Interfaces I have used rpad (www.rpad.org) which has an integrated web server right in the R package making setup a non-issue. On 9/8/07, Takatsugu Kobayashi [EMAIL PROTECTED] wrote: Hi Gabor, Wow, this is awesome although I eventually should learn MySQL for integrating it on web-based DB management using PHP or Perl, this is a very helpful tool for me to start with! Thank you very much Gabor Grothendieck wrote: Others have already pointed out %in% but regarding your comment about SQL, you can use SQL to manipulate R data frames using the sqldf package which provides an interface to lower level RSQLite (and RMySQL in the future) routines. The following examples use SQLite underneath: DF - data.frame(observation = c(1,2,3,4,5)) ID - data.frame(ID = c(1, 3, 4)) library(sqldf) sqldf(select observation, observation in (select * from ID) `ID?` from DF) # or sqldf(select observation, observation in (1, 3, 4) `ID?` from DF) See home page at: http://sqldf.googlecode.com On 9/7/07, Takatsugu Kobayashi [EMAIL PROTECTED] wrote: Hi RUsers, I am wonder if I can search observations whose IDs matches any of the values in another vector, such as in MySQL. While I am learing MySQL for future database management, I appreciate if anyone could give me a hint. Suppose I have one 5*1 vector containing observation IDs and frequencies, and one 3*1 vector containing observation IDs. observation-c(1,2,3,4,5) ID-c(1,3,4) Then, I would like to program a code that returns a results showing matched observations like result: TRUE FALSE TRUE TRUE FALSE I am reading S programming, but I cannot find a way to do this. Thank you very much. Taka __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SQL like function?
Others have already pointed out %in% but regarding your comment about SQL, you can use SQL to manipulate R data frames using the sqldf package which provides an interface to lower level RSQLite (and RMySQL in the future) routines. The following examples use SQLite underneath: DF - data.frame(observation = c(1,2,3,4,5)) ID - data.frame(ID = c(1, 3, 4)) library(sqldf) sqldf(select observation, observation in (select * from ID) `ID?` from DF) # or sqldf(select observation, observation in (1, 3, 4) `ID?` from DF) See home page at: http://sqldf.googlecode.com On 9/7/07, Takatsugu Kobayashi [EMAIL PROTECTED] wrote: Hi RUsers, I am wonder if I can search observations whose IDs matches any of the values in another vector, such as in MySQL. While I am learing MySQL for future database management, I appreciate if anyone could give me a hint. Suppose I have one 5*1 vector containing observation IDs and frequencies, and one 3*1 vector containing observation IDs. observation-c(1,2,3,4,5) ID-c(1,3,4) Then, I would like to program a code that returns a results showing matched observations like result: TRUE FALSE TRUE TRUE FALSE I am reading S programming, but I cannot find a way to do this. Thank you very much. Taka __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SQL like function?
observation %in% ID --- Takatsugu Kobayashi [EMAIL PROTECTED] wrote: Hi RUsers, I am wonder if I can search observations whose IDs matches any of the values in another vector, such as in MySQL. While I am learing MySQL for future database management, I appreciate if anyone could give me a hint. Suppose I have one 5*1 vector containing observation IDs and frequencies, and one 3*1 vector containing observation IDs. observation-c(1,2,3,4,5) ID-c(1,3,4) Then, I would like to program a code that returns a results showing matched observations like result: TRUE FALSE TRUE TRUE FALSE I am reading S programming, but I cannot find a way to do this. Thank you very much. Taka __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SQL like function?
observation %in% ID b On Sep 7, 2007, at 1:40 AM, Takatsugu Kobayashi wrote: Hi RUsers, I am wonder if I can search observations whose IDs matches any of the values in another vector, such as in MySQL. While I am learing MySQL for future database management, I appreciate if anyone could give me a hint. Suppose I have one 5*1 vector containing observation IDs and frequencies, and one 3*1 vector containing observation IDs. observation-c(1,2,3,4,5) ID-c(1,3,4) Then, I would like to program a code that returns a results showing matched observations like result: TRUE FALSE TRUE TRUE FALSE I am reading S programming, but I cannot find a way to do this. Thank you very much. Taka __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SQL like function?
Hi RUsers, I am wonder if I can search observations whose IDs matches any of the values in another vector, such as in MySQL. While I am learing MySQL for future database management, I appreciate if anyone could give me a hint. Suppose I have one 5*1 vector containing observation IDs and frequencies, and one 3*1 vector containing observation IDs. observation-c(1,2,3,4,5) ID-c(1,3,4) Then, I would like to program a code that returns a results showing matched observations like result: TRUE FALSE TRUE TRUE FALSE I am reading S programming, but I cannot find a way to do this. Thank you very much. Taka __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.