[R] looking for a function to plot the distribution of values (not sure of the name)
Hello, I have a dataframe of two columns : A (with values A1, A2, ..., Ai, ... A2) and B (with values B1, B2, ..., Bi, ... B2) and I would like to plot a graph like this : X=A Y= (the density of B as a function of A) * (the value of B as a function of A) I think it must already exist a function in R calculating Y but as I'm really not used to use (and talk of) statistics (especially in english), I don't know how to call this kind of function and then I didn't manage to find a solution in some posts (what to use as keywords ?). Thanks in advance for your help (and your tolerance), Have a good day, Ptit Bleu. -- View this message in context: http://www.nabble.com/looking-for-a-function-to-plot-the-distribution-of-values-%28not-sure-of-the-name%29-tp24845160p24845160.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] find a sequence of characters in a vector
Hello, I'm just looking for an easy way to find the positions of a complete sequence in a bigger vector. For example : c(a,z,e) in c(a,z,e,r,t,a,z,a,z,e,c) and the result should be 1 8 that is the positions of the beginning of the complete sequence. I tried with %in%, match, is.element but all I get is, for example which(c(a,z,e) in c(a,z,e,r,t,a,z,a,z,e,c)) 1 2 3 meaning that each character is in the bigger vector. It must be easy, except for me. Sorry. If you have a solution, thanks in advance to share it. Have a good week-end, Ptit Bleu. -- View this message in context: http://www.nabble.com/find-a-sequence-of-characters-in-a-vector-tp23888063p23888063.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Re sults sometimes in seconds with difftime unit=mins
Hello, I'm trying to calculate an integration and x-axis is a time (format : %Y-%m-%d %H:%M:%S). I use diff(date, units=mins) in a loop for but sometimes the results stay in seconds (95% is ok). Examples for 2 sets of data are given below (first result stays in seconds whereas the second in minutes as expected). Have you already seen this behaviour ? Any idea to solve this problem ? Thanks in advance. Have a good week-end, Ptit Bleu. strptime(datajour$Date, format=%Y-%m-%d %H:%M:%S) [1] 2009-03-26 11:21:31 2009-03-26 11:22:17 2009-03-26 11:27:18 2009-03-26 11:36:59 2009-03-26 11:41:59 2009-03-26 11:46:59 [7] 2009-03-26 11:51:59 2009-03-26 11:57:00 2009-03-26 12:02:00 2009-03-26 12:07:00 2009-03-26 12:12:00 2009-03-26 12:17:00 [13] 2009-03-26 12:22:00 2009-03-26 12:27:01 2009-03-26 12:32:01 2009-03-26 12:37:01 2009-03-26 12:42:01 2009-03-26 12:47:01 [19] 2009-03-26 12:52:01 2009-03-26 12:57:01 2009-03-26 13:02:02 2009-03-26 13:07:02 2009-03-26 13:12:03 2009-03-26 13:17:03 [25] 2009-03-26 13:22:03 2009-03-26 13:27:03 2009-03-26 13:32:03 2009-03-26 13:37:03 2009-03-26 13:42:03 2009-03-26 13:47:03 [31] 2009-03-26 13:52:03 2009-03-26 13:57:04 2009-03-26 14:01:02 2009-03-26 14:06:05 2009-03-26 14:11:05 2009-03-26 14:16:06 [37] 2009-03-26 14:21:06 2009-03-26 14:26:08 2009-03-26 14:31:09 2009-03-26 14:36:10 2009-03-26 14:41:10 2009-03-26 14:46:15 [43] 2009-03-26 14:51:15 2009-03-26 14:56:15 2009-03-26 15:01:15 2009-03-26 15:06:17 2009-03-26 15:11:17 2009-03-26 15:16:19 [49] 2009-03-26 15:21:19 2009-03-26 15:26:19 2009-03-26 15:31:22 2009-03-26 15:36:23 2009-03-26 15:41:24 2009-03-26 15:46:24 [55] 2009-03-26 15:51:25 2009-03-26 15:56:25 2009-03-26 16:01:25 2009-03-26 16:06:26 2009-03-26 16:11:26 2009-03-26 16:16:26 [61] 2009-03-26 16:21:27 2009-03-26 16:26:27 2009-03-26 16:31:28 2009-03-26 16:36:28 2009-03-26 16:41:29 2009-03-26 16:46:30 [67] 2009-03-26 16:51:31 2009-03-26 16:56:31 2009-03-26 17:01:32 2009-03-26 17:06:32 2009-03-26 17:11:33 2009-03-26 17:16:33 [73] 2009-03-26 17:21:33 2009-03-26 17:26:35 2009-03-26 17:31:36 2009-03-26 17:36:36 2009-03-26 17:41:36 2009-03-26 17:46:36 [79] 2009-03-26 17:51:39 2009-03-26 17:56:40 2009-03-26 18:01:40 2009-03-26 18:06:40 2009-03-26 18:11:40 2009-03-26 18:16:40 [85] 2009-03-26 18:21:41 2009-03-26 18:26:41 2009-03-26 18:31:41 2009-03-26 18:36:41 2009-03-26 18:41:41 2009-03-26 18:46:41 [91] 2009-03-26 18:51:42 2009-03-26 18:56:42 2009-03-26 19:06:42 as.numeric(diff(strptime(datajour$Date, format=%Y-%m-%d %H:%M:%S), units=mins)) [1] 46 301 581 300 300 300 301 300 300 300 300 300 301 300 300 300 300 300 300 301 300 301 300 300 300 300 300 300 300 300 301 238 303 300 301 300 302 301 [39] 301 300 305 300 300 300 302 300 302 300 300 303 301 301 300 301 300 300 301 300 300 301 300 301 300 301 301 301 300 301 300 301 300 300 302 301 300 300 [77] 300 303 301 300 300 300 300 301 300 300 300 300 300 301 300 600 strptime(datajour$Date, format=%Y-%m-%d %H:%M:%S) [1] 2009-03-26 11:22:24 2009-03-26 11:27:25 2009-03-26 11:37:04 2009-03-26 11:42:04 2009-03-26 11:47:04 2009-03-26 11:52:04 [7] 2009-03-26 11:57:04 2009-03-26 12:02:05 2009-03-26 12:07:06 2009-03-26 12:12:06 2009-03-26 12:17:06 2009-03-26 12:22:06 [13] 2009-03-26 12:27:07 2009-03-26 12:32:07 2009-03-26 12:37:07 2009-03-26 12:42:07 2009-03-26 12:47:07 2009-03-26 12:52:08 [19] 2009-03-26 12:57:08 2009-03-26 13:02:08 2009-03-26 13:07:09 2009-03-26 13:12:09 2009-03-26 13:17:09 2009-03-26 13:22:09 [25] 2009-03-26 13:27:09 2009-03-26 13:32:09 2009-03-26 13:37:09 2009-03-26 13:42:09 2009-03-26 13:47:09 2009-03-26 13:52:09 [31] 2009-03-26 13:57:10 2009-03-26 14:01:08 2009-03-26 14:06:11 2009-03-26 14:11:11 2009-03-26 14:16:12 2009-03-26 14:21:12 [37] 2009-03-26 14:26:15 2009-03-26 14:31:18 2009-03-26 14:36:18 2009-03-26 14:41:19 2009-03-26 14:46:22 2009-03-26 14:51:22 [43] 2009-03-26 14:56:23 2009-03-26 15:01:24 2009-03-26 15:06:24 2009-03-26 15:11:24 2009-03-26 15:16:24 2009-03-26 15:21:24 [49] 2009-03-26 15:26:24 2009-03-26 15:31:28 2009-03-26 15:36:29 2009-03-26 15:41:29 2009-03-26 15:46:30 2009-03-26 15:51:33 [55] 2009-03-26 15:56:33 2009-03-26 16:01:33 2009-03-26 16:06:33 2009-03-26 16:11:34 2009-03-26 16:16:34 2009-03-26 16:21:35 [61] 2009-03-26 16:26:35 2009-03-26 16:31:35 2009-03-26 16:36:35 2009-03-26 16:41:35 2009-03-26 16:46:36 2009-03-26 16:51:37 [67] 2009-03-26 16:56:37 2009-03-26 17:01:37 2009-03-26 17:06:38 2009-03-26 17:11:38 2009-03-26 17:16:38 2009-03-26 17:21:38 [73] 2009-03-26 17:26:40 2009-03-26 17:31:43 2009-03-26 17:36:43 2009-03-26 17:41:43 2009-03-26 17:46:44 2009-03-26 17:51:45 [79] 2009-03-26 17:56:46 2009-03-26 18:01:46 2009-03-26 18:06:46 2009-03-26 18:11:47 2009-03-26 18:16:47 2009-03-26 18:21:48 [85] 2009-03-26 18:26:48 2009-03-26 18:31:48 2009-03-26 18:36:48 2009-03-26 18:41:48 2009-03-26 18:46:48 2009-03-26 18:51:48 [91] 2009-03-26
Re: [R] How to combine xtable and minipage with Sweave ?
Dear Duncan, Thanks for the tips, but I haven't found a way to modify your solution so that I can include a table and not a graph (includegraphics works for graphs, I need an 'includetable', I think). I found scripts like yours explaining how to include graphs into table but this is not my case: My problem doesn't come from the graph but from the table ('maybe' my english is not so clear). Do I need to convert the table into a graph (and how) ? Sorry again for such basic questions. Thank you for your help. Ptit Bleu. -- View this message in context: http://www.nabble.com/How-to-combine-xtable-and-minipage-with-Sweave---tp22493636p22533969.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] How to combine xtable and minipage with Sweave ?
Dear Duncan, Thanks for the tips, but I haven't found a way to modify your solution so that I can include a table and not a graph (includegraphics works for graphs, I need an 'includetable', I think). I found scripts like yours explaining how to include graphs into table but this is not my case: My problem doesn't come from the graph but from the table ('maybe' my english is not so clear). Do I need to convert the table into a graph (and how) ? Sorry again for such basic questions. Thank you for your help. Ptit Bleu. -- View this message in context: http://www.nabble.com/How-to-combine-xtable-and-minipage-with-Sweave---tp22493636p22533963.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] [solved] How to combine xtable and minipage with Sweave ?
Thanks to you all (and a bit to some websites dedicated to latex), I finally managed to have a table and a graph side-by-side !!! I'm not sure it will interested people, but here is the script working for me (before the graph was below the table only because I have an empty line between the 2 minipages !!! It's a bit tricky, isnt'it ?): \begin{document} \DefineVerbatimEnvironment{Sinput}{Verbatim}{formatcom = {\color[rgb]{0, 0, 0.56}}} \DefineVerbatimEnvironment{Soutput}{Verbatim}{formatcom = {\color[rgb]{0.56, 0, 0}}} \setkeys{Gin}{width=\textwidth} echo=FALSE, results=tex= rg-read.table(file=d:/RWork/rg.txt, sep=;, dec=., header=T, as.is=T) @ \begin{table}[h] \begin{minipage}[h]{0.49\linewidth} echo=FALSE, results=tex= library(xtable) print(xtable(rg), include.rownames=F, size=\\small, floating=FALSE) @ \end{minipage} \hspace{0.5cm} \begin{minipage}[h]{0.49\linewidth} RsingleA,echo=F,fig=T,width=2.5,height=2.5= plot(1:10) @ \end{minipage} \end{table} \end{document} -- View this message in context: http://www.nabble.com/How-to-combine-xtable-and-minipage-with-Sweave---tp22493636p22541199.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] How to combine xtable and minipage with Sweave ?
Hello, I'm trying to put a dynamic table and a dynamic graph side by side in a pdf document using Sweave. The data.frame used to generate the table is called rg (rg.txt): Date; Code; Data1; Data2 2009-03-10;1;1958;147 2009-03-10;2;302;144 2009-03-10;3;4;141 2009-03-10;4;4;144 2009-03-10;5;217;145 2009-03-10;6;133;147 2009-03-10;7;431;144 2009-03-10;8;177;142 2009-03-10;9;146;143 2009-03-10;10;123;142 2009-03-10;11;308;143 2009-03-10;12;115;144 2009-03-10;13;146;142 2009-03-10;14;124;143 2009-03-10;15;176;142 2009-03-10;16;177;143 The Sweave script to test, saved as test_minipage_sweave.rnw, is the following one (I'm a newbie in Latex and R so I pasted some commands I found here and there) : -- \documentclass[a4paper]{article} \usepackage[T1]{fontenc} \usepackage[frenchb]{babel} \usepackage{geometry} \usepackage{color, pdfcolmk} \usepackage[mediumqspace]{SIunits} \geometry{a4paper,left=1cm,right=1cm,top=1cm,bottom=1.5cm} \date{} \begin{document} \DefineVerbatimEnvironment{Sinput}{Verbatim}{formatcom = {\color[rgb]{0, 0, 0.56}}} \DefineVerbatimEnvironment{Soutput}{Verbatim}{formatcom = {\color[rgb]{0.56, 0, 0}}} \setkeys{Gin}{width=\textwidth} echo=FALSE, results=TEX= rg-read.table(file=d:/RWork/rg.txt, sep=;, dec=., header=T, as.is=T) @ \begin{figure}[ht] \begin{minipage}[b]{0.5\linewidth} \centering RsingleA,echo=F,fig=T,width=2.5,height=2.5= plot(1:10) @ \caption{First figure} \label{fig:figure1} \end{minipage} \end{figure} \hspace{0.5cm} \begin{minipage}{0.7\textwidth} echo=FALSE, results=TEX= library(xtable) print(xtable(kw), include.rownames=F) @ \end{minipage} \end{document} -- The following commands : Sweave(D:/RWork/test_minipage_sweave.rnw) shell(pdflatex D:/RWork/test_minipage_sweave.tex) give me a .pdf file containing the graph but instead of the table I have this text, below the graph : echo=FALSE, results=TEX = library(xtable) print(xtable(kw), include.rownames=F) @ It means that it doesn't recognize a R command but I don't kno why. And it is a problem with minipage because I managed to create a pdf file with only the table. Could someone give me a solution or at least a working example which I can modify ? Thanks in advance, Have a nice week-end, Ptit Bleu. -- View this message in context: http://www.nabble.com/How-to-combine-xtable-and-minipage-with-Sweave---tp22493636p22493636.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] How to combine xtable and minipage with Sweave ?
Hello Dieter, And thank you for the corrections. Concerning the point 3, I'm a bit lost. Is it a problem of place to put the table and the graph side by side (my english is quite as low as my skills in Latex) ? I tried with \begin{minipage}{0.45\textwidth} instead of 0.7 and I put //tiny but no success. I tried to add some \begin{table} before \begin{minipage}[b]{0.45\linewidth} as I saw here : http://texblog.wordpress.com/2007/08/01/placing-figurestables-side-by-side-minipage/ http://texblog.wordpress.com/2007/08/01/placing-figurestables-side-by-side-minipage/ Again ! LaTeX Error: Not in outer par mode. Could you give me a last clue so that I can spend a nice week-end. Thanks in advance, Ptiti Bleu. last script : \documentclass[a4paper]{article} \usepackage[T1]{fontenc} \usepackage[frenchb]{babel} \usepackage{geometry} \usepackage{color, pdfcolmk} \usepackage[mediumqspace]{SIunits} \geometry{a4paper,left=1cm,right=1cm,top=1cm,bottom=1.5cm} \date{} \begin{document} \DefineVerbatimEnvironment{Sinput}{Verbatim}{formatcom = {\color[rgb]{0, 0, 0.56}}} \DefineVerbatimEnvironment{Soutput}{Verbatim}{formatcom = {\color[rgb]{0.56, 0, 0}}} \setkeys{Gin}{width=\textwidth} echo=FALSE, results=tex= rg-read.table(file=d:/RWork/rg.txt, sep=;, dec=., header=T, as.is=T) @ \begin{figure}[ht] \begin{minipage}[b]{0.45\linewidth} \centering RsingleA,echo=F,fig=T,width=2.5,height=2.5= plot(1:10) @ \caption{First figure} \label{fig:figure1} \end{minipage} \end{figure} \hspace{0.5cm} \begin{minipage}{0.45\textwidth} echo=FALSE, results=tex= library(xtable) print(xtable(rg), include.rownames=F, size=\\tiny) @ \end{minipage} \end{document} -- View this message in context: http://www.nabble.com/How-to-combine-xtable-and-minipage-with-Sweave---tp22493636p22496502.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] How to combine xtable and minipage with Sweave ?
Thanks Dieter for the link. In fact it may be a problem with R. The .tex created with R for the table put \begin{table}[ht] and \end{table}\ between \begin{minipage} and \end{minipage} (see below) If I manually change these positions, according to your link, there is no more error ... but the table is below the graph and not side by side. Any idea ? Have a nice week-end, Ptit bleu. File .tex created by Sweave : \begin{minipage}{0.45\textwidth} % latex table generated in R 2.7.2 by xtable 1.5-4 package % Fri Mar 13 17:00:06 2009 \begin{table}[ht] \begin{center} {\tiny \begin{tabular}{lrr} \hline Date kWh\_m2 Nbremesures \\ \hline 2009-03-08 4.53 142 \\ 2009-03-09 1.70 142 \\ 2009-03-10 1.96 147 \\ \hline \end{tabular} } \end{center} \end{table}\end{minipage} -- View this message in context: http://www.nabble.com/How-to-combine-xtable-and-minipage-with-Sweave---tp22493636p22499672.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Odp: nice way to find or not a value (problem with numeric(0))
Hello Petr, In fact spec is data.frame with a column called code (containing numerical values) and some other columns called data1, data2, ... containing data for each equipment (that is for each code). But I don't have the data for all my devices. It means that some 'code' are not in spec$Code. In that case I want to assign a default value to the data. for example : spec$Code spec$data1 4 12.5 820.2 Then, with code=4 spec$data1[spec$Code==code]*(code %in%specmodules$Code) + 1*(!code %in% specmodules$Code) gives 12.5 But with code=654, I get numeric(0) instead of 1 because this value is not in spec$Code and returns numeric(0). I hope it is clearer (is it ?) and that you could find a nice way to write my test (the if-test works but is not very elegant). Thanks in adance for you help, Ptit Bleu. Petr Pikal wrote: Hi r-help-boun...@r-project.org napsal dne 04.03.2009 09:11:06: Hello, I have a data.frame called spec containing data about samples. But I don't have these data for all my samples. So if I have data (that is code of the sample is in spec$Code), I would like to assign data1 to the variable m. If I don't have this data, I would like to assign 1 to m. I tried this : m-spec$data1[spec$Code==code]*(code %in%specmodules$Code) + 1*(!code %in% specmodules$Code) It works when I have the data but if it is not the case I get numeric(0) instead of 1. I finally use the following command. It works but I'm sure there is a more elegant way. if (code %in%spec$Code) m-spec$data1[spec$Code==code] else m-1 It is a bit cryptic what do you want. Above version shall not work as it takes only one logical value but you probably have vector of values. (We do not know code, spec$Code or any other data you have). when I try your first construction with some values I have I get sensible results so without trying to find out how your data really look like I suggest you to inspect it more closely and/or provide some working example demonstrating what you did, what is the result and how the result shall look like. zdrz$sklon*zdrz$otac %in% c(.6,1.2,2)+1*!(zdrz$otac %in% c(.6,1.2,2)) [1] 110 80 50 50 10 1 120 80 50 20 zdrz$otac[5]-NA zdrz$sklon*zdrz$otac %in% c(.6,1.2,2)+1*!(zdrz$otac %in% c(.6,1.2,2)) [1] 110 80 50 50 1 1 120 80 50 20 zdrz$sklon[4]-Inf zdrz$sklon*zdrz$otac %in% c(.6,1.2,2)+1*!(zdrz$otac %in% c(.6,1.2,2)) [1] 110 80 50 Inf 1 1 120 80 50 20 zdrz$sklon[4]-NA zdrz$sklon*zdrz$otac %in% c(.6,1.2,2)+1*!(zdrz$otac %in% c(.6,1.2,2)) [1] 110 80 50 NA 1 1 120 80 50 20 Regards Petr Is there a way to avoid an if-test ? Thanks for your help, Have a good day, Ptit Bleu. -- View this message in context: http://www.nabble.com/nice-way-to-find-or-not-a- value-%28problem-with-numeric%280%29%29-tp22325406p22325406.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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@r-project.org 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. -- View this message in context: http://www.nabble.com/nice-way-to-find-or-not-a-value-%28problem-with-numeric%280%29%29-tp22325406p22352529.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] nice way to find or not a value (problem with numeric(0))
Hello, I have a data.frame called spec containing data about samples. But I don't have these data for all my samples. So if I have data (that is code of the sample is in spec$Code), I would like to assign data1 to the variable m. If I don't have this data, I would like to assign 1 to m. I tried this : m-spec$data1[spec$Code==code]*(code %in%specmodules$Code) + 1*(!code %in% specmodules$Code) It works when I have the data but if it is not the case I get numeric(0) instead of 1. I finally use the following command. It works but I'm sure there is a more elegant way. if (code %in%spec$Code) m-spec$data1[spec$Code==code] else m-1 Is there a way to avoid an if-test ? Thanks for your help, Have a good day, Ptit Bleu. -- View this message in context: http://www.nabble.com/nice-way-to-find-or-not-a-value-%28problem-with-numeric%280%29%29-tp22325406p22325406.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Problem between panel.abline and log scales (lattice)
Hello and Happy New Year to all R-Users !!! I would like to plot a lattice graph with a logarthmic y axis and add two reference lines that is : ref-c(0.0070, 0.0096) graph1-xyplot(data$y1 ~ as.numeric(strptime(data$x1, format=%Y-%m-%d %H:%M:%S)) | as.character(data$Code), list(y = list(log = T)), xlab=X', ylab=Y, panel = function(...) { panel.xyplot(..., type=p, pch=20) panel.abline(h=ref, col=red) } ) print(graph1) With this script, no reference lines are plotted. But if I use list(y = list(log = F)), that is a linear scale, it works. Could you please explain me the problem (and help me to solve it) ? Thanks in advance, Ptit Bleu. -- View this message in context: http://www.nabble.com/Problem-between-panel.abline-and-log-scales-%28lattice%29-tp21411642p21411642.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] xyplot sorted by date
Hello I have a dataframe with 3 columns C1, C2 and C3. C1 and C2 are numerical data and C3 is the date of the data (format : %Y-%m-%d %H:%M:%S) With the lattice package, I would like to plot C1 as function of C2 sorted by the dates, that is something like : xyplot(C1 ~ C2 | as.Date(C3)) It plots somethings but not the truth. I have compared the output with the output of this script x11(15,12) layout(matrix(1:4,2,2) plot(C1[C3=='2008-12-06'] ~ C2[C3=='2008-12-06']) plot(C1[C3=='2008-12-07'] ~ C2[C3=='2008-12-07']) plot(C1[C3=='2008-12-08'] ~ C2[C3=='2008-12-08']) plot(C1[C3=='2008-12-09'] ~ C2[C3=='2008-12-09']) which gives the good curves but it is not as nice as with lattice. Could you please tell me how to solve my problem ? Thanks in advance, Ptit Bleu. -- View this message in context: http://www.nabble.com/xyplot-sorted-by-date-tp20936581p20936581.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] [solved] sapply and median, possible or not ?
Thanks a lot Keith : your function does the job (but I don't understand the trick) ! Have a nice week-end (Thanks to you, I can have a good one :-)), Ptit Bleu. - median.data.frame - function(x, ...) sapply(x, median, ...) I haven't tried it, but it might work hth Keith J -- View this message in context: http://www.nabble.com/sapply-and-median%2C-possible-or-not---tp20378222p20379667.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] sapply and median, possible or not ?
Unfortunately, I have the same error message. lapply(rowsplit, function(x)mean(x[,sapply(x, is.numeric)])) works but not with median. Strange, isn't it? Any other idea? Thanks in advance, Ptit Bleu. Henrique Dallazuanna wrote: Try this: lapply(l, function(x)median(x[,sapply(x, is.numeric)])) -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org 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. -- View this message in context: http://www.nabble.com/sapply-and-median%2C-possible-or-not---tp20378222p20378663.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] sapply and median, possible or not ?
Hello, I have a list of data.frame rowsplit : List of 15 $ (0,0.025] :'data.frame': 169 obs. of 7 variables: $ (0.025,0.05]:'data.frame': 174 obs. of 7 variables: $ (0.05,0.075]:'data.frame': 92 obs. of 7 variables: $ (0.075,0.1] :'data.frame': 76 obs. of 7 variables: $ (0.1,0.125] :'data.frame': 37 obs. of 7 variables: $ (0.125,0.15]:'data.frame': 32 obs. of 7 variables: $ (0.15,0.175]:'data.frame': 45 obs. of 7 variables: $ (0.175,0.2] :'data.frame': 56 obs. of 7 variables: $ (0.2,0.225] :'data.frame': 36 obs. of 7 variables: $ (0.225,0.25]:'data.frame': 47 obs. of 7 variables: $ (0.25,0.275]:'data.frame': 34 obs. of 7 variables: $ (0.275,0.3] :'data.frame': 43 obs. of 7 variables: $ (0.3,0.325] :'data.frame': 29 obs. of 7 variables: $ (0.325,0.35]:'data.frame': 29 obs. of 7 variables: $ (0.35,0.375]:'data.frame': 17 obs. of 7 variables: And I would like to get a data.frame gathering the median value of each variable for each intervall. as.data.frame(t(sapply(rowsplit, mean)) works well but I would prefer to use median but with sapply(rowsplit, median), I get the following message Error in median.default(X[[1L]], ...) : need numeric data. Any idea ? Thanks in advance for your help, Have a nice week-end, Ptit Bleu. PS :I'm under XP and use R2.7.2. -- View this message in context: http://www.nabble.com/sapply-and-median%2C-possible-or-not---tp20378222p20378222.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Question about panel.points
Hello, I'm trying to plot graphs using lattice with this script : xyplot(Y ~ X | factmod, panel = function(x, y) { panel.grid(h=-1, v=-1, col=gray) panel.xyplot(x, y, type=p, pch=20) panel.points(50,Idata, data=devdata, col=red) - this doesn't work }, xlab=X, ylab=Y) factmod is a factor with 18 labels corresponding to the 18 names of my devices. devdata is a data.frame of 2 columns and 18 rows : name of the devices / value of Idata for each device For example (smaller one): devdata-data.frame(c(a,b,c,d), c(1,5,9,7)) And I would like to add the point (50, Idata) per graph that is points(50,1) on the first graph points(50,5) on the second graph, ... At the moment, it plots all the points on every graph (or with another command, only (50,Idata[1]) on all the graphs). Could you please give me a little piece of advice to solve this problem ? Thanks in advance, Ptit Bleu. -- View this message in context: http://www.nabble.com/Question-about-panel.points-tp19528504p19528504.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Best way to select good points in a noisy signal ?
Hello, When I plot y=f(x) from the file xy.txt ( http://www.nabble.com/file/p18773387/xy.txt xy.txt ), I can clearly see a trend. Is there a function or a package able to take the median value of y for an interval of x (x +/- a defined value) to plot nice graph (at least a better one) ? Thanks in advance, Have a nice week-end, Ptit Bleu. -- View this message in context: http://www.nabble.com/Best-way-to-select-good-points-in-a-noisy-signal---tp18773387p18773387.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Newbie's question about lm
Hello, I would like to fit data with the following formula : y=V*(1+alpha*(x-25)) where y and x are my data, V is a constant and alpha is the slope I'm looking for. How to translate this into R-language ? At the moment, I only know : lm(y ~ x) Sorry for such a basic question. I thought I could find the solution in a post but I have to confess that, up to know, I'm not able to understand the posts I read concerning lm (the level of the questions are too high for me and my english quite poor as well). Have a nice evening, Ptit Bleu. -- View this message in context: http://www.nabble.com/Newbie%27s-question-about-lm-tp18511262p18511262.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Start preferred RGui
You are right Keith : it doesn't work. Sorry. In fact it works for a previous version but not for the new ones. Bad luck. Nice week-end anyway, Ptit Bleu. -- View this message in context: http://www.nabble.com/Start-preferred-RGui-tp18400190p18404597.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] how to automatically maximize the graph window (under XP) ?
Hello, Thanks Leandro for your solution. But, in fact, it doesn't match what I'm trying to do ... due to the fact that I didn't clearly tell you what I'm trying to do. I tested the command jpeg() but it doesn't display the curve and I need to see it before saving it. Here is a small example of my script : x11() plot(1:10,1:10, pch=20, col=lightblue, ylab=y, xlab=x, cex.axis=1.5, cex.lab=1.5, cex.main=1.5, cex=1.5, ylim=c(0,12)) points(5, 8, pch=20, col=red, cex=1.5) smartlegend(x=right,y=bottom, inset = 0.02, c(BlaBlaBlaBla, BlaBlaBlaBla), col = c( red, lightblue), pch=20, cex=1.5) The x11() command opens a graphic device whose size is 6.9 6.9 (given by par(din)). (By the way, if I maximize the window, par(din) again gives 6. 6.9). With this size, the legend is ok. But if I maximize the window, there is a lot of whit space in the legend box which occupies too much place. If I launch again the script, but without the x11() command, in a maximized window, the legend display is ok. That's why I would like to directly open a full screen graphic window before plotting the legend. I hope this explaination is clearer and that somebody will have a solution. Thanks in advance, Ptit Bleu. -- View this message in context: http://www.nabble.com/how-to-automatically-maximize-the-graph-window-%28under-XP%29---tp18219242p18252841.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] how to automatically maximize the graph window (under XP) ?
Hello, I'm trying to produce graphs automatically from data stored in database. Before saving the graphs, I would like to maximize the size of the graphs. The best would be to directly open maximized windows with x11() but up to now I failed doing it. I tried different widths and heighs but I never managed to obtain a full screen window. Is there a command to do it ? Thanks in advance, Ptit Bleu. PS : I'm under XP -- View this message in context: http://www.nabble.com/how-to-automatically-maximize-the-graph-window-%28under-XP%29---tp18219242p18219242.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] ggplots - how to increase the number of levels
Hi, Thanks to Hadley Wickham, I am now able to plot some nice weather graphs (see http://www.nabble.com/how-to-plot-image%28%29-without-painting-a-map-%28the-background%29-td15546906.html#a15584405 How to plot a graph on a map ). For some parameters, I would like to increase the number of levels (the number of grey tinges in fact (nuances in french - not sure tinges is the correct english translation)). I tried to add nlevels=10 to the following command : p - qplot(data=lonlat1, longitude, latitude, geom=tile, fill=TCDC, xlab=, ylab=) + scale_fill_gradient(low=white, high=grey) + geom_contour(aes(z = TCDC)) + france_map ... but nothings changes. I have always 5 levels for TCDC : 20 / 40 / 60 / 80 /100. http://www.nabble.com/file/p16396028/tcdc_map.jpg Could you please tell me how to solve this easy (except for me) problem ? Have a nice week, Ptit Bleu. -- View this message in context: http://www.nabble.com/ggplots---how-to-increase-the-number-of-levels-tp16396028p16396028.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] how to plot image() without painting a map (the background)
Hi, Thanks to ggplot2 (and to Hadley Wickham) I managed to plot some nice graphs (not as fast as in a movie but it is ok). One thing I am still looking for is a way to add the values on the contour lines (like with the contour function). I read the stat.contour help page but I haven't found my case. Is it possible to do it or not ? Thanks for your help. Ptit Bleu. - An example of code (99,99% written by Hadley - the errors come from me) with the essai1.txt file : http://www.nabble.com/file/p15829412/essai1.txt essai1.txt library(ggplot2) library(maps) setwd(C:/gfs/) lonlat1-read.table(essai1.txt, sep=,, header=T) names(lonlat1)-c(longitude, latitude, DSWRF, x) france - as.data.frame(map('france', plot=F)[c(x, y)]) france_map - geom_path(aes(x=x, y=y, fill=NULL), data=france) p - qplot(data=lonlat1, longitude, latitude, geom=tile, fill=DSWRF, xlab=, ylab=) + geom_contour(aes(z = DSWRF), size=1, colour=red) + france_map p -- View this message in context: http://www.nabble.com/how-to-plot-image%28%29-without-painting-a-map-%28the-background%29-tp15546906p15829412.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] how to plot image() without painting a map (the background)
Thanks for the fast answer (even negative) and for your help (ggplot is a very nice tool !!!). Have a nice evening (well, we are close to in France), Ptit Bleu. hadley wrote: On Tue, Mar 4, 2008 at 9:15 AM, Ptit_Bleu [EMAIL PROTECTED] wrote: Hi, Thanks to ggplot2 (and to Hadley Wickham) I managed to plot some nice graphs (not as fast as in a movie but it is ok). One thing I am still looking for is a way to add the values on the contour lines (like with the contour function). I read the stat.contour help page but I haven't found my case. Is it possible to do it or not ? Not currently with ggplot - although you can change the colour or the size of the lines to represent the value of the contour. See the examples on http://had.co.nz/ggplot2/stat_contour.html Hadley -- http://had.co.nz/ __ R-help@r-project.org 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. -- View this message in context: http://www.nabble.com/how-to-plot-image%28%29-without-painting-a-map-%28the-background%29-tp15546906p15830591.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] how to plot image() without painting a map (the background)
Hello, I'm trying to plot dayly evolution of the temperature over France from Global Forecast System files (I'm trying is the right expression...). akilonlat03 is the temperature for different latitudes and longitudes à 3 o'clock. akilonlat06 is the temperature for different latitudes and longitudes à 6 o'clock. I would like to plot akilonlat03 and then akilonlat06 and keep the map of France in background. My script (see below) doesn't work as image paints the background as I read somewhere in this forum. So would have someone a solution to correct my script ? Thanks in advance, Ptit Bleu. akilonlat03-interp(lonlat03$Longitude, lonlat03$Latitude, (5/9)*(lonlat03$TMP_200802150300-32)) akilonlat06-interp(lonlat06$Longitude, lonlat06$Latitude, (5/9)*(lonlat06$TMP_200802150600-32)) map('france') image(akilonlat03, col=cm.colors(100), axes=FALSE, add=TRUE) #contour(akilonlat03, col=blue, add=TRUE) image(akilonlat06, col=cm.colors(100), axes=FALSE, add=TRUE) #contour(akilonlat06, col=blue, add=TRUE) -- View this message in context: http://www.nabble.com/how-to-plot-image%28%29-without-painting-a-map-%28the-background%29-tp15546906p15546906.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] TAF/METAR decoder
Hi, I'm looking for a script to translate TAF/METAR code into comprehensive text that I can include in a R-script (METAR is the international standard code format for hourly surface weather observations). I haven't seen anything in the libraries. Do you think such a thing exists for R ? Thanks in advance for your help, Ptit Bleu. -- View this message in context: http://www.nabble.com/TAF-METAR-decoder-tp15068796p15068796.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Must be obvious but not to me : problem with regular expression
Hi, I have a vector called nfichiers of 138 names of file whose extension is .P0 or P1 ... to P8. The script is not the same when the extension is P0 or P(1 to 8). Examples of file names : [128] Output0.P0 [129] Output0.P1 [130] Output0.P2 [131] Output01102007.P0 [132] Output01102007.P1 [133] Output01102007.P2 [134] Output01102007.P3 [135] Output01102007.P4 To extract the names of file with .P0 extension I wrote : nfichiers[grep(.P0, nfichiers)] For the other extensions : nfichiers[grep(.P[^0], nfichiers)] But for the last, I get a length of 138 that is the length of the initial vector although I have 130 files with .P0 extension. So I tried manually with a small vector : s [1] aa.P0 bb.P0 cc.P1 dd.P2 s[grep(.P[^0], s)] [1] cc.P1 dd.P2 It works !!! Has someone an idea to solve this small problem ? Thanks in advance, Ptit Bleu. -- View this message in context: http://www.nabble.com/Must-be-obvious-but-not-to-me-%3A-problem-with-regular-expression-tp14370723p14370723.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Sweave : change value in rnw file to generate multiple single reports ?
Thanks everybody for your help (and sorry to be silent : no network today morning), I think I will first try the solution of Greg Snow-2 or the one of Thierry (because they gave examples of script - as a newbye it is very important to me). I'm also interested in the solutions proposed by Uwe and Gabor, but I'm not familiar with environment variables (I will try ?Sys.getenv) and I have no idea how to edit .rnw file with R (but as it seems that everything is possible with R, so why not). Again thank you, And if you have further advices to help me writing scripts (in R for example), do not hesitate. Have a nice day, Ptit Bleu. PS : I'm using R version 2.5.1 (2007-06-27) with XP -- View this message in context: http://www.nabble.com/Sweave-%3A-change-value-in-rnw-file-to-generate-multiple-%22single%22-reports---tp14256204p14272449.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Sweave : change value in rnw file to generate multiple single reports ?
Dear Uwe, Could you please give me the name of the function to open, to modify and to save a r script ? Just the name and I will look for the way to use them. And if you have a link explaining how to use user customized variables from an environment variable, it will be very helpful (as it is completely new to me). Thanks in advance, Ptit Bleu. Within or before SWeave, you can use R. Hence you can write some R function that first changes the rnw and runs SWeave thereafter, or even better, write something in your SWeave code that reads a user customized variables, e.g. from an environment variable or from some text file. Uwe Ligges -- View this message in context: http://www.nabble.com/Sweave-%3A-change-value-in-rnw-file-to-generate-multiple-%22single%22-reports---tp14256204p14275809.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Sweave : change value in rnw file to generate multiple single reports ?
Greg wrote : Hope this helps, Sure it will ! Thanks again, Have a nice day, Ptit Bleu. -- View this message in context: http://www.nabble.com/Sweave-%3A-change-value-in-rnw-file-to-generate-multiple-%22single%22-reports---tp14256204p14290306.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Sweave : change value in rnw file to generate multiple single reports ?
Hello, I'm still trying to make the life of my colleagues easier. Nice, isn't it ? At the moment, I'm looking for a way to generate multiple single report. In fact I have a .rnw file which send a query to a MySQL database (rs-dbSendQuery(con, statement=select * from treatdata where name='Device1') But of course my colleagues have many devices and don't want to enter the rnw file to change the name of the device. Is there a way to pass arguments to Sweave like Sweave(myfile.rnw, namevar=Device2) and it will change namevar by Device2 into the file myfile.rnw before creating the .tex file ? Or is it possible to do it via another language, that is: loading the rnw file, modifying it, saving it and finally calling Sweave ? Whatever the solution, I need you help. In advance thank you. Ptit Bleu. -- View this message in context: http://www.nabble.com/Sweave-%3A-change-value-in-rnw-file-to-generate-multiple-%22single%22-reports---tp14256204p14256204.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Friendly way to link R - MySQL and non-(R and Mysql) users ?
Dear Gabor, Thanks for the links. I found a a tcl script (see below ; from http://wiki.tcl.tk/15977) which could be a good starting point but I'm not able to translate it into R. Could you help me ? In particularly, what is the command corresponding to append_float_dialog_item ? I looked in ?tcltk but I haven't found append command. Thanks in advance, Have a nice week-end, Ptit Bleu - # Simple sphere demo with UI for Shade # Variables: radius, center coordinates, RGB color set r 600 set X 0 set Y 0 set Z 0 set R 1.0 set G 0.1 set B 0.1 # The UI starts here begin_dialog # Create a dialog box with 7 typed entries append_float_dialog_item Radius append_float_dialog_item X center append_float_dialog_item Y center append_float_dialog_item Z center append_float_dialog_item Red value (0..1) append_float_dialog_item Green value (0..1) append_float_dialog_item Blue value (0..1) # Initial values for items set_float_property_value 0 to $r set_float_property_value 1 to $X set_float_property_value 2 to $Y set_float_property_value 3 to $Z set_float_property_value 4 to $R set_float_property_value 5 to $G set_float_property_value 6 to $B # ask_dialog is true if we hit on OK button if [ask_dialog] { set r [get_float_property_value 0] set X [get_float_property_value 1] set Y [get_float_property_value 2] set Z [get_float_property_value 3] set R [get_float_property_value 4] set G [get_float_property_value 5] set B [get_float_property_value 6] if {$R 1.0} {set R 1.0} if {$G 1.0} {set G 1.0} if {$B 1.0} {set B 1.0} end_dialog } else { end_dialog error cancel_dialog } # End of UI # Create a tagged sphere with radius r at X,Y,Z coordinates create_sphere at [list $X $Y $Z] r $r sphere_1 # set color to sphere_1 set base_color [list $R $G $B] # Render the result render -- View this message in context: http://www.nabble.com/Friendly-way-to--link-R---MySQL-and-non-%28R-and-Mysql%29-users---tf4844081.html#a13908847 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Friendly way to link R - MySQL and non-(R and Mysql) users ?
I found the file tkttest.r in the directory tcltk/demo. From this I hope I will be able to do what I want to. Again thank you for your help, Ptit Bleu. -- View this message in context: http://www.nabble.com/Friendly-way-to--link-R---MySQL-and-non-%28R-and-Mysql%29-users---tf4844081.html#a13911877 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Friendly way to link R - MySQL and non-(R and Mysql) users ?
Hi Peter, In fact, just the beginning of the script is interesting to me. I'm just looking for a simple example : a single box with 3 entries and 3 labels before. Something like the example below but with a label before each entry. I know it is obvious but I don't manage to combine all the examples I saw here http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/ I will keep on reading on testing this week-end, but if you can help me, I thank you in advance. Ptit Bleu. main - tktoplevel() tktitle(main) - My Tool filenames - c(toto, tata, titi) N - length(filenames) text - vector(list, N) textField - vector(list, N) labelText - tclVar(This is a text label) label1 - tklabel(tt,text=tclvalue(labelText)) tkconfigure(label1,textvariable=labelText) tkgrid(label1) for (i in 1:N) { text[[i]] - tclVar(filenames[i]) # get a filename (string value) textField[[i]] - tkentry(main,textvariable=text[[i]]) #build a text field tkgrid(textField[[i]]) } -- View this message in context: http://www.nabble.com/Friendly-way-to--link-R---MySQL-and-non-%28R-and-Mysql%29-users---tf4844081.html#a13909734 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Friendly way to link R - MySQL and non-(R and Mysql) users ?
It's me again (the last message for today - promised). The following script can be very helpful to me (from http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/editboxes.html) but I' like to enter several parameters and have a single 'ok' box to validate all the entered paramaters. Anyone can help me to start ? Thank you, Ptit Bleu. -- View this message in context: http://www.nabble.com/Friendly-way-to--link-R---MySQL-and-non-%28R-and-Mysql%29-users---tf4844081.html#a13911645 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] How to improve a function converting year, day of year, decimal hour into date ?
Hi, I would like to build a date from a year, a day of the year and a decimal hour. Ex : reconst_date(2007,324,12.50) gives 2007-11-20 12:30:0 The following function is doing this job but I would like to know if there is a function which directly converts the decimal hours into hours:minutes:secondes ? Thanks for your help, Have a nice day, Ptit Bleu. reconst_date-function(annee, jour, heured) { str_anneejour-paste(annee,jour,sep= ) str_anneemoisjour-strptime(str_anneejour, %Y %j) heure-trunc(heured) minute-trunc((heured-heure)*60) seconde-((heured-heure)*60-minute)*60 seq_dateR-paste(str_anneemoisjour, ,heure,:,minute,:,round(seconde),sep=) return(seq_dateR) } -- View this message in context: http://www.nabble.com/How-to-improve-a-function-converting-year%2Cday-of-year%2Cdecimal-hour-into-date---tf4843032.html#a13855563 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] How to improve a function converting year, day of year, decimal hour into date ?
Thank you Gabor for your fast answer (received as I was reading R News 4/1) Ptit Bleu. library(chron) chron(paste(1/1/, year, sep = )) + julday + hour/24 That produces a chron, i.e. dates/times class datetime. If you want it as a string use format(...above expression...)See the help desk article in R News 4/1. -- View this message in context: http://www.nabble.com/How-to-improve-a-function-converting-year%2Cday-of-year%2Cdecimal-hour-into-date---tf4843032.html#a13856584 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Friendly way to link R - MySQL and non-(R and Mysql) users ?
Thanks to your help, I managed to link R and a Mysql Database, send queries, plot the results and put everything in a pdf document (with Sweave). My co-workers find the job not bad but they would like to have a friendly interface to send queries and see the graphs (the pdf document is not necessary). Something like this coul be a good starting point : --- | Name of the X columns : ___ | | Name of the Y colums : ___ | | Send query Y/N : ___ | --- I read some posts about this topic but all need a server (if I read well). I'd just want to use it on a local machine. Is there a way to realize such an interface and to link it directly to an R-script (which will send the query to MySQL and will plot the result of the query) ? Thanks for your help, Ptit Bleu. -- View this message in context: http://www.nabble.com/Friendly-way-to--link-R---MySQL-and-non-%28R-and-Mysql%29-users---tf4844081.html#a13858847 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] [Solved] Can I replace NA by 0 (if yes, how) ?
I was sure that there was such a solution. I would have liked to find it. Thank you for your help. Ptit Bleu. - Wollkind, Steven wrote: You don't need to loop. You can just do pfit$coefficients[is.na(pfit$coefficients)] - 0 Steve Wollkind Associate Analyst Geode Capital Management, LLC 1 Post Office Square / 28th Floor / Boston, MA 02109 [EMAIL PROTECTED] Tel: (617) 392-8991 Fax: (617) 476-6389 This e-mail, and any attachments hereto, are intended for use by the addressee(s) only and may contain information that is (i) confidential information of Geode Capital Management, LLC and/or its affiliates, and/or (ii) proprietary information of Geode Capital Management, LLC and/or its affiliates. If you are not the intended recipient of this e-mail, or if you have otherwise received this e-mail in error, please immediately notify me by telephone (you may call collect), or by e-mail, and please permanently delete the original, any print outs and any copies of the foregoing. Any dissemination, distribution or copying of this e-mail is strictly prohibited. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ptit_Bleu Sent: Wednesday, November 07, 2007 11:28 AM To: r-help@r-project.org Subject: Re: [R] Can I replace NA by 0 (if yes, how) ? I found this solution but it must another one much more R-friendly ? for (a in 1:9) { if (is.na(pfit$coefficients[[a]])) (pfit$coefficients[[a]]-0) } Again thank you in advance for explainations concerning NA, Ptit Bleu. -- View this message in context: http://www.nabble.com/Can-I-replace-NA-by-0-%28if-yes%2C-how%29---tf4765 597.html#a13630590 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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@r-project.org 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. -- View this message in context: http://www.nabble.com/Can-I-replace-NA-by-0-%28if-yes%2C-how%29---tf4765597.html#a13644272 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Can I replace NA by 0 (if yes, how) ?
I found this solution but it must another one much more R-friendly ? for (a in 1:9) { if (is.na(pfit$coefficients[[a]])) (pfit$coefficients[[a]]-0) } Again thank you in advance for explainations concerning NA, Ptit Bleu. -- View this message in context: http://www.nabble.com/Can-I-replace-NA-by-0-%28if-yes%2C-how%29---tf4765597.html#a13630590 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] How to find the zero (only the real solution) with the package polynom ?
Hello, I have 3 columns : a, b and a*b I would like to find the pair (a,b) so that a*b is the minimum but not from the points I measured but from the fit of the curve (I have more points that the ones given below but I fit only on this part because I know that the minimum a*b is in this interval). I thought doing it this way : - to fit a*b=f(a) abfit-lm(ab ~ poly(a,8,raw=T)) - to use the package polynom to make the polynom library(polynom) polynomial(abfit$coefficients) 0.03537506 - 0.8506516*x + 8.302545*x^2 - 44.80418*x^3 + 144.2161*x^4 - 283.2458*x^5 + 331.1776*x^6 - 210.5144*x^7 + 55.86646*x^8 - to derive the polynom deriv(polynomial(pfit$coefficients)) -0.8506516 + 16.60509*x - 134.4125*x^2 + 576.8643*x^3 - 1416.229*x^4 + 1987.066*x^5 - 1473.601*x^6 + 446.9317*x^7 - to find the zero solve(deriv(polynomial(pfit$coefficients))) [1] 0.1749897+0.0568886i 0.1749897-0.0568886i 0.3742571-0.1235393i 0.3742571+0.1235393i 0.4778418+0.000i 0.8604070+0.1306799i 0.8604070-0.1306799i And here is my little problem : I don't want the complex solutions, only the real one (0.4778418). I also tried uniroot but I got an error message : uniroot(deriv(polynomial(pfit$coefficients)), c(0.8,0.2)) Error in uniroot(deriv(polynomial(abfit$coefficients)), c(0.8, 0.2)) : Impossible to find the function f Is there a way to extract this real solution ? I thank you in advance for your help, Have a nice day, Ptit Bleu. - Set of points aba*b 0.8 0.033320357 0.026656286 0.760.023930636 0.018187283 0.720.0153903 0.011081016 0.680.007844914 0.005334542 0.640.001598132 0.001022804 0.6 -0.00315939 -0.001895634 0.56-0.006402796-0.003585566 0.52-0.008379886-0.004357541 0.48-0.009528793-0.004573821 0.44-0.010198446-0.004487316 0.4 -0.010638282-0.004255313 0.36-0.010937536-0.003937513 0.32-0.011169004-0.003574081 0.28-0.011343229-0.003176104 0.24-0.0114878 -0.002757072 0.2 -0.011630636-0.002326127 0.16-0.011724586-0.001875934 -- View this message in context: http://www.nabble.com/How-to-find-the-zero-%28only-the-real-solution%29-with-the-package-polynom---tf4756646.html#a13602364 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] How to avoid saving the row index of a data.frame into MySQL ?
Hello everybody, I have data in a data.frame data whose structure is given below. I would like to save them into a MySQL database. It works quite well with dbWriteTable but with this function, it also save the number of the rows (see what I get from MySQL below the data.frame structure. Is there a way to avoid this, that is to save my 15 columns and not 16 ? Thanks in advance for your help. Ptit Bleu. --- Structure of the data.frame (with ls.str()) data : 'data.frame': 1439 obs. of 15 variables: $ V1 : chr 01/03/2007 10:02:19 01/03/2007 10:02:49 01/03/2007 10:03:19 01/03/2007 10:03:49 ... $ V3 : num 4.87 2.11 2.44 3.19 2.25 1.44 1.96 2.36 0.34 3.84 ... $ V4 : num 10.8 10.9 10.9 10.9 11.1 11.2 11.3 11.3 11.5 11.6 ... $ V5 : int 581 591 673 736 754 725 738 662 554 452 ... $ V6 : num 1.57 1.59 1.83 1.99 2.03 1.96 1.99 1.79 1.49 1.21 ... $ V7 : num 1.63 1.65 1.88 2.05 2.1 2.02 2.04 1.85 1.55 1.27 ... $ V8 : num 0.401 0.401 0.401 0.401 0.401 0.402 0.401 0.4 0.401 0.402 ... $ V9 : num 245 244 246 246 246 ... $ V10: num 5.04 5.15 5.82 6.35 6.46 6.2 6.25 5.63 4.73 3.82 ... $ V11: num 417 419 418 415 413 ... $ V12: num 416 419 416 415 413 ... $ V13: num 49 49 49 49 49 ... $ V14: num 16.3 16.2 16.9 17.5 17.5 18.1 18.4 18.9 19.1 19.5 ... $ V15: num 360 360 360 360 360 360 360 360 360 360 ... $ V16: num 14.0 14.0 14.0 14.0 14.0 ... - First columns saved in the MySQL database 1059 |01/03/2007 18:51:20 |1.33 |10.9 |0 |0.02 | ... 1060 |01/03/2007 18:51:50 |0.17 |10.8 |0 |0.00 | ... 1061 |01/03/2007 18:52:20 |0.39 |10.8 |0 |0.00 | ... 1062 |01/03/2007 18:52:50 |1.44 |10.8 |0 |0.00 | ... -- View this message in context: http://www.nabble.com/How-to-avoid-saving-the-row-index-of-a-data.frame-into-MySQL---tf4606925.html#a13154777 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Creating nice looking lists: how?
Hi, I don't know if it will help you but to retrieve the slope of lm(y~x), I use : coefficients(lm(y~x))[2] ([1] for the intercept) I should not tell this but It took me a long time to find this obvious thing. Have a nice week-end, Ptit Bleu. Sergey Goriatchev wrote: Hello, For my functions I want to create output similar in appearance to that of what you get when you print a summary of lm model: Residuals: Min1Q Median3Q Max -0.209209 -0.043133 0.001793 0.044105 0.234750 Coefficients: Estimate Std. Error t valuePr(|t|) (Intercept) 0.981762 0.004089 240.103 2e-16 *** Factor 1-0.009581 0.006381 -1.501 0.134296 Factor 2-0.008993 0.009182 -0.979 0.328163 Factor 3 0.029960 0.009547 3.138 0.001866 ** Factor 4-0.026575 0.007370 -3.606 0.000363 *** Factor 5-0.004847 0.006382 -0.760 0.448138 Factor 6 0.005099 0.006483 0.786 0.432202 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 I want: 1) no $ before the list component names 2) component names that take values from outside variables (ex.: number - 10 There are 'number' factors in the model:) There is not much information on how to create nice output in terms of lists, so I was looking for core to write the summary(lm) output, but could not find much. Obviously, I can type summary.lm, but it does not show how to create the name Coefficients: Could someone give me pointers on how to create nice lists? Thanks Sergey __ R-help@r-project.org 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. -- View this message in context: http://www.nabble.com/Creating-nice-looking-lists%3A-how--tf4534730.html#a12942721 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] RE : Must be easy, but haven't found the function (numerical integration)
Hello Ravi, I was also trying to write down such a calculation but I did not manage (I didn't use diff(x)). Thank you for the solution. Ptit Bleu. Ravi Varadhan wrote: Here is a simple trapezoidal rule integrator: x - time y - value area - sum(diff(x)*(y[-1]+y[-length(y)]))/2 Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ptit_Bleu Sent: Tuesday, September 18, 2007 11:24 AM To: r-help@r-project.org Subject: Re: [R] RE : Must be easy, but haven't found the function (numerical integration) Thanks to all. cumsum can be helpful but the solution given by David seems to match my request. I will test it as soon as possible (before the end of the week, I hope). Have a nice end of day, Ptit Bleu. GOUACHE David wrote: try : library(Bolsatd) ?sintegral or: library(caTools) ?trapz David Gouache Arvalis - Institut du Végétal Station de La Minière 78280 Guyancourt Tel: 01.30.12.96.22 / Port: 06.86.08.94.32 -Message d'origine- De : Ptit_Bleu [mailto:[EMAIL PROTECTED] Envoyé : lundi 17 septembre 2007 12:09 À : [EMAIL PROTECTED] Objet : [R] Must be easy,but haven't found the function (numerical integration) Hi, I have a data frame of 2 columns with the following types : data$day char data$value num And I plot my data with : plot(strptime(donnees$day,format=%Y-%m-%d %H:%M:%S),donnees$value, type=l) And I'd just like to get the numerical value of the integration of this graph. I looked at ?integrate but, as far as I understood (that is, not very much, due to my poor english), it seems that it doesn't work with values in data frame. Could you please help me to do this ? Thanks in advance, Have a nice week, Ptit Bleu. -- View this message in context: http://www.nabble.com/Must-be-easy%2C-but-haven%27t-found-the-function-%28nu merical-integration%29-tf4465684.html#a12732936 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. -- View this message in context: http://www.nabble.com/Must-be-easy%2C-but-haven%27t-found-the-function-%28nu merical-integration%29-tf4465684.html#a12759423 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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@r-project.org 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. -- View this message in context: http://www.nabble.com/Must-be-easy%2C-but-haven%27t-found-the-function-%28numerical-integration%29-tf4465684.html#a12792420 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] It works but I don't know how (nice scientific notation with Lattice)
Hi, I had problems to display my results in a nice way (according to me). Thanks to posts of people of this forum, I solved my problems (ticks with a scientific notation and how to write nicely V/m2 in the label of the x-axis) but ... I don't understand the script. Can somebody explain me how the short script below writes the scientific notation ? I guess it is the result of ans$bottom$labels$labels - parse(text = ans$bottom$labels$labels) but it is really not clear to me. Thanks in advance for your explainations Ptit Bleu. library(lattice) x-c(10,100,1000,1,10,20,200,2000,2,20) y-c(1,2,3,4,5,2,4,6,8,10) z-c(1,1,1,1,1,2,2,2,2,2) xyplot(y ~ x | z, scales = list(x = list(log = T)), xscale.components = function(...) { ans - xscale.components.default(...) ans$bottom$labels$labels - parse(text = ans$bottom$labels$labels) ans } , xlab=(expression(paste(X (V/,m^2, , ylab=Y (arb. unit)) -- View this message in context: http://www.nabble.com/It-works-but-I-don%27t-know-how-%28nice-scientific-notation-with-Lattice%29-tf4488112.html#a12798983 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Must be easy, but haven't found the function (numerical integration)
Hi, I have a data frame of 2 columns with the following types : data$day char data$value num And I plot my data with : plot(strptime(donnees$day,format=%Y-%m-%d %H:%M:%S),donnees$value, type=l) And I'd just like to get the numerical value of the integration of this graph. I looked at ?integrate but, as far as I understood (that is, not very much, due to my poor english), it seems that it doesn't work with values in data frame. Could you please help me to do this ? Thanks in advance, Have a nice week, Ptit Bleu. -- View this message in context: http://www.nabble.com/Must-be-easy%2C-but-haven%27t-found-the-function-%28numerical-integration%29-tf4465684.html#a12732936 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] [solved] Re: I can't do it again on an other PC : R+RMySQL -error loading dll
Thanks for the procedure. It sounds easy. I will test it when I have time and see if there are differences (I hope I won't see anything : from a working configuration, if I change to RODBC, I'd like to get another working one). Ptit BLeu. Vladimir Eremeev wrote: Hi! In my case, advantages of using RODBC are in the fact that it is working, and is getting updated on a regular basis. Nothing more. :) I also had some difficulties to set up the DSN, old Windows NT 4.0 required couple of restarts, and guessing correct 'magic' line to make MS Excel to retrieve the data was difficult. The procedure is simplified in Win2000/XP. I have MySQL ODBC 3.51 Driver installed. Then I go to Start - Control Panel - Administrative Tools, double-click on 'Data sources (ODBC)', click 'Add' in the opened window, choose 'MySQL ODBC 3.51 Driver' from the list, enter host name, database name, user name and password. Port is 3306 by default. Then pressing 'Test Data source' shows if everything is set up correctly. MySQL also have to be configured to allow connections. RODBC also contains the file with the comprehensive instructions (R_HOME/Library/RODBC/Readme). Ptit_Bleu wrote: Hi Vladimir, In fact, at the beginning, I tried to install RODBC and the MySQL driver but I did not manage (I think due to the driver and the configuration in the control panel). Then I tried to install RMySQL and DBI on my PC (not the one with the real database), and it worked without any problem. So I keep working with RMySQL. You think there are advantages to try again installing RODBC ? Anyway, for the moment, I think I will continue with RMySQL, just because it works. But for me it is a good reason (especially because I'm not a specialist of PCs and I don't have the time to become one. I'm only an end-user). Have a nice day, Ptit Bleu. Vladimir Eremeev wrote: Do you need precisely RMySQL and DBI? RODBC can successfully replace this. I used RMySQL some time ago, but then, after the next version upgrade it stopped working. Switching to RODBC was almost without pain, since function names were quite similar. I simply replaced dbGetQuery with sqlGetQuery in my script and voilia. However, you need to install the MySQL ODBC driver and set up a data source in the Windows Control Panel before. -- View this message in context: http://www.nabble.com/I-can%27t-do-it-again-on-an-other-PC-%3A-R%2BRMySQL--%3Eerror-loading-dll-tf4414597.html#a12634485 Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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.