Re: [R] Fwd: about plantbreeding library
Please keep in mind that this is the R-help mailing list, not the plantbreeding-help mailing list, so most (perhaps all) of us don't know what the theory behind your work is. The fact that you are attempting to load data sets and use functions that are not accessible yet you are forging on anyway suggests to me that you don't know the theory either, and are blindly attempting to follow some unmentioned recipe. Just be warned that the theory is your responsibility. You probably need to load some library (plantbreeding?) using the library or require functions before the multienv data set or the stability function will be usable. You only need to install a package onto your computer once, but you need to re-load any packages you want to use at some time in each analysis session. I advise reading the Introduction to R document that comes with the software. You may also need to Google a bit to learn how to install packages from R-forge for your operating system. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Waqas Shafqat waqas1...@gmail.com wrote: -- Forwarded message -- From: Waqas Shafqat waqas1...@gmail.com Date: Sat, Aug 17, 2013 at 10:18 AM Subject: Re: [R] about plantbreeding library To: Marc Girondot marc_...@yahoo.fr problem 1 stability analysis setwd(E:/) Data - read.table(file=setwd.csv, header=TRUE, sep=,) Data environments genotypes relication yield 1 1 1 134 2 1 1 235 3 1 1 333 4 1 2 143 5 1 2 243 6 1 2 344 7 1 3 156 8 1 3 257 9 1 3 354 102 1 132 112 1 233 122 1 331 132 2 144 142 2 246 152 2 348 162 3 158 172 3 257 182 3 359 193 1 144 203 1 245 213 1 347 223 2 155 233 2 256 243 2 357 253 3 160 263 3 261 273 3 363 # stability analysis data(multienv) Warning message: In data(multienv) : data set �multienv� not found out - stability (dataframe = multienv , yvar = yield, genotypes = genotypes, + environments = environments, replication = replication) Error: could not find function stability out Error: object 'out' not found above errors are found in stability analysis) problem 2 diallel setwd(E:/) Data - read.table(file=setwd.csv, header=TRUE, sep=,) Data Days.Taken.to.Tesselling X X.1 X.2 Days.Taken.to.Silking X.3 X.4 X.5 1 Crosses R1 R2 R3R1 R2 R3 NA 2 A 545 52 54 5258 59 58 NA 3 OH 28 54 53 5359 60 59 NA 4 OH 54-3A 56 56 5562 61 63 NA 5 WF 9 54 52 5360 58 59 NA 6 B 42 53 55 5461 62 61 NA 7N 48-1 55 53 5261 60 60 NA 8PB 7-1 55 56 5662 62 63 NA 9 52 B4 56 54 5660 59 60 NA 10A 545 x OH 28 53 52 5256 58 56 NA 11 A 545 x OH 54-3A 55 55 5360 59 61 NA 12 A 545 x WF 9 56 57 5662 63 63 NA 13 A 545 x B 42 53 52 5359 60 59 NA 14 A 545 x N 48-1 54 52 5361 60 60 NA 15 A 545 x PB 7-1 55 57 5663 62 62 NA 16A 545 x 52 B4 58 56 5665 64 64 NA 17OH 28 x A 545 53 53 5261 60 61 NA 18 OH 28 x OH 54-3A 50 52 5259 58 58 NA 19 OH 28 x WF 9 55 55 56
Re: [R] latin1 encoding in WriteXLS
Yes, it also occurs with WriteXLS version 3.2.1. This test on several computers always leads to the same error. Hugo Varet 2013/8/17 Rainer Hurling rhur...@gwdg.de Am 13.08.2013 19:40, schrieb Hugo Varet: Dear R users, I've just updated the WriteXLS package (on R 3.0.1) and I now have an error when exporting a data.frame with the argument Encoding=latin1. For example, these two lines work: library(WriteXLS) WriteXLS(iris, iris.xls) whereas these ones don't work: library(WriteXLS) WriteXLS(iris, irislatin1.xls,Encoding=latin1) I get this message: Argument Sepal.Length isn't numeric in subroutine entry at C:/Perl64/lib/Encode.pm line 217, CSVFILE line 1. Modification of a read-only value attempted at C:/Perl64/lib/Encode.pm line 218, CSVFILE line 1. The Perl script 'WriteXLS.pl' failed to run successfully. Message d'avis : l'exécution de la commande 'perl -IC:/Users/varet/Documents/R/win-library/3.0/WriteXLS/Perl C:/Users/varet/Documents/R/win-library/3.0/WriteXLS/Perl/WriteXLS.pl --CSVPath C:\Users\varet\AppData\Local\Temp\RtmpEzqFNz/WriteXLS --verbose FALSE --AdjWidth FALSE --AutoFilter FALSE --BoldHeaderRow FALSE --FreezeRow 0 --FreezeCol 0 --Encoding latin1 C:\Users\varet\Desktop\irislatin1.xls' renvoie un statut 255 Does anyone know why it failed? May it be a problem with Perl? Thanks for your help, Hugo Varet Does this also occur with WriteXLS version 3.2.1 ? [[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.
[R] Amelia, Zelig and latex in R
Dear listers, I am running some OLS on multiply imputed data using Amelia. I first imputed the data with Amelia. than I run a OLS using Zelig to obtain a table of results accounting for the multiply imputed data-sets. And I'd like to do this for various models. Finally, I want to output all the models in a table of results for latex. I've tried with Stargazer because it seems to support Zelig output, but when I run stargazer on a set of objects containing the output of zelig, I get the following error: Error: unrecognized object type. this message is repeated for each model I passed to Stargazer. I am sorry I can't provide a working example, because I should make up some multiply imputed data first. Hoewever, summarizing what I did is: imputed1 - amelia(x=data1, m=10) imputed2 - amelia(x=data2, m=10) lm.imputed1 - zelig(Y ~ X + Z, data = imputed1) lm.imputed2 - zelig(Y ~ X + Z, data = imputed2) stargazer(lm.imputed1, lm.imputed2) The outcome is the error I mentioned above. Thanks in advance for all the support you can offer. Regards, f. [[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.
Re: [R] is there anything wrong with doing a multinomial logistic like it is a binary logistic regression?
At 04:13 17/08/2013, Eunice Chou wrote: My outcome variable (y) is 3 categories. Is there anything bad about using the following code to get a parameter estimate for my bivariate model? publicfit = glm(y ~ public, data=dataSPSS.vmj, family=binomial) Have you tried it? What did R tell you? [[alternative HTML version deleted]] Michael Dewey i...@aghmed.fsnet.co.uk http://www.aghmed.fsnet.co.uk/home.html __ 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] Is it possible to avoid copying arrays when calling list()?
Thanks for the input, but it looks like I found a simple solution. Turns out that if you assign to lists by name, then R doesn't make extra copies: x-double(10^9) mylist-list() system.time(mylist[[1]]-x) user system elapsed 2.992 3.352 6.364 x-double(10^9) mylist-list() system.time(mylist$x-x) user system elapsed 0 0 0 This is on R version 3.0.1. On 08/16/2013 10:37 PM, David Winsemius wrote: On Aug 16, 2013, at 2:23 PM, Gang Peng wrote: If you don't want to copy the data, you can use environments. You can first define x and y in the global environment and then in the function, use function get() to get x, y in the global environment. When you change x and y in the function, x and y also change in the global environment. That doesn't sound like the behavior I expect in R. Do you care to illustrate this? -- David. Best, Gang 2013/8/16 MRipleymrip...@gmail.com Usually R is pretty good about not copying objects when it doesn't need to. However, the list() function seems to make unnecessary copies. For example: system.time(x-double(10^9)) user system elapsed 1.772 4.280 7.017 system.time(y-double(10^9)) user system elapsed 2.564 3.368 5.943 system.time(z-list(x,y)) user system elapsed 5.520 6.748 12.304 I have a function where I create two large arrays, manipulate them in certain ways, and then return both as a list. I'm optimizing the function, so I'd like to be able to build the return list quickly. The two large arrays drop out of scope immediately after I make the list and return it, so copying them is completely unnecessary. Is there some way to do this? I'm not familiar with manipulating lists through the .Call interface, and haven't been able to find much about this in the documentation. Might it be possible to write a fast (but possibly unsafe) list function using .Call that doesn't make copies of the arguments? PS A few things I've tried. First, this is not due to triggering garbage collection -- even if I call gc() before list(x,y), it still takes a long time. Also, I've tried rewriting the function by creating the list at the beginning as in: result - list(x=double(10^9),y=double(**10^9)) and then manipulating result$x and result$y but this made my code run slower, as R seemed to be making other unnecessary copies while manipulating elements of a list like this. I've considered (though not implemented) creating an environment rather than a list, and returning the environment, but I'd rather find a simple way of creating a list without making copies if possible. __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/** posting-guide.htmlhttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. David Winsemius Alameda, CA, USA __ 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] Amelia, Zelig and latex in R
Hi Christopher, thanks for your reply. Unfortunately, that's not what I am looking for. I would like to have a table with the results of the two models (lm.imputed1 and lm.imputed2) in two separate columns. According to stargazer syntax I should type something like: stargazer(lm.imputed1, lm.imputed2, summary = FALSE) but then I get my error: Error: Unrecognized object type. Even though your example is insightful, I can't figure out how to solve my problem. Any advice is very welcome. Regards, f. On 17 August 2013 17:02, Christopher Desjardins cddesjard...@gmail.comwrote: Does this do what you want? library(Amelia) library(Zelig) library(stargazer) library(xtable) data(africa) m = 10 imp1 - amelia(x = africa,cs=country,m=m) imp2 - amelia(x = africa,cs=country,m=m) lm.imputed1 - zelig(infl ~ trade + civlib, model=ls,data = imp1) lm.imputed2 - zelig(infl ~ trade + civlib, model=ls,data = imp2) # Stargazer for(i in 1:m){ print(stargazer(as.data.frame(summary(lm.imputed1[[i]])$coef),as.data.frame(summary(lm.imputed2[[i]])$coef))) } # xtable for(i in 1:m){ print(xtable(summary(lm.imputed1[[i]]))) print(xtable(summary(lm.imputed2[[i]]))) } On Sat, Aug 17, 2013 at 6:37 AM, Francesco Sarracino f.sarrac...@gmail.com wrote: Dear listers, I am running some OLS on multiply imputed data using Amelia. I first imputed the data with Amelia. than I run a OLS using Zelig to obtain a table of results accounting for the multiply imputed data-sets. And I'd like to do this for various models. Finally, I want to output all the models in a table of results for latex. I've tried with Stargazer because it seems to support Zelig output, but when I run stargazer on a set of objects containing the output of zelig, I get the following error: Error: unrecognized object type. this message is repeated for each model I passed to Stargazer. I am sorry I can't provide a working example, because I should make up some multiply imputed data first. Hoewever, summarizing what I did is: imputed1 - amelia(x=data1, m=10) imputed2 - amelia(x=data2, m=10) lm.imputed1 - zelig(Y ~ X + Z, data = imputed1) lm.imputed2 - zelig(Y ~ X + Z, data = imputed2) stargazer(lm.imputed1, lm.imputed2) The outcome is the error I mentioned above. Thanks in advance for all the support you can offer. Regards, f. [[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. -- Francesco Sarracino, Ph.D. https://sites.google.com/site/fsarracino/ [[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.
Re: [R] Amelia, Zelig and latex in R
Does this do what you want? library(Amelia) library(Zelig) library(stargazer) library(xtable) data(africa) m = 10 imp1 - amelia(x = africa,cs=country,m=m) imp2 - amelia(x = africa,cs=country,m=m) lm.imputed1 - zelig(infl ~ trade + civlib, model=ls,data = imp1) lm.imputed2 - zelig(infl ~ trade + civlib, model=ls,data = imp2) # Stargazer for(i in 1:m){ print(stargazer(as.data.frame(summary(lm.imputed1[[i]])$coef),as.data.frame(summary(lm.imputed2[[i]])$coef))) } # xtable for(i in 1:m){ print(xtable(summary(lm.imputed1[[i]]))) print(xtable(summary(lm.imputed2[[i]]))) } On Sat, Aug 17, 2013 at 6:37 AM, Francesco Sarracino f.sarrac...@gmail.comwrote: Dear listers, I am running some OLS on multiply imputed data using Amelia. I first imputed the data with Amelia. than I run a OLS using Zelig to obtain a table of results accounting for the multiply imputed data-sets. And I'd like to do this for various models. Finally, I want to output all the models in a table of results for latex. I've tried with Stargazer because it seems to support Zelig output, but when I run stargazer on a set of objects containing the output of zelig, I get the following error: Error: unrecognized object type. this message is repeated for each model I passed to Stargazer. I am sorry I can't provide a working example, because I should make up some multiply imputed data first. Hoewever, summarizing what I did is: imputed1 - amelia(x=data1, m=10) imputed2 - amelia(x=data2, m=10) lm.imputed1 - zelig(Y ~ X + Z, data = imputed1) lm.imputed2 - zelig(Y ~ X + Z, data = imputed2) stargazer(lm.imputed1, lm.imputed2) The outcome is the error I mentioned above. Thanks in advance for all the support you can offer. Regards, f. [[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. [[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.
Re: [R] Error in Corpus() in tm package
Le vendredi 16 août 2013 à 19:35 -0700, Ajinkya Kale a écrit : I am trying to use the text mining package ... I keep getting this error : rm(list=ls()) library(tm) sourceDir - Z:\\projectk_viz\\docs_to_index ovid - Corpus(DirSource(sourceDir),readerControl = list(language = lat)) Error in if (vectorized (length = 0)) stop(vectorized sources must have positive length) : missing value where TRUE/FALSE needed I am not sure what it means. The posting guide asks for a reproducible example. If you cannot make available to us the contents of sourceDir, at least you should tell us what kind of files it contains. Have you tried with only some of the files the directory contains ? Regards --ajinkya [[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. __ 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] Amelia, Zelig and latex in R
What do you mean by results? Do you want just the estimated parameters? And are you looking for one big table with all the estimated parameters from all imputation runs? Chris On Sat, Aug 17, 2013 at 11:18 AM, Francesco Sarracino f.sarrac...@gmail.com wrote: Hi Christopher, thanks for your reply. Unfortunately, that's not what I am looking for. I would like to have a table with the results of the two models (lm.imputed1 and lm.imputed2) in two separate columns. According to stargazer syntax I should type something like: stargazer(lm.imputed1, lm.imputed2, summary = FALSE) but then I get my error: Error: Unrecognized object type. Even though your example is insightful, I can't figure out how to solve my problem. Any advice is very welcome. Regards, f. On 17 August 2013 17:02, Christopher Desjardins cddesjard...@gmail.comwrote: Does this do what you want? library(Amelia) library(Zelig) library(stargazer) library(xtable) data(africa) m = 10 imp1 - amelia(x = africa,cs=country,m=m) imp2 - amelia(x = africa,cs=country,m=m) lm.imputed1 - zelig(infl ~ trade + civlib, model=ls,data = imp1) lm.imputed2 - zelig(infl ~ trade + civlib, model=ls,data = imp2) # Stargazer for(i in 1:m){ print(stargazer(as.data.frame(summary(lm.imputed1[[i]])$coef),as.data.frame(summary(lm.imputed2[[i]])$coef))) } # xtable for(i in 1:m){ print(xtable(summary(lm.imputed1[[i]]))) print(xtable(summary(lm.imputed2[[i]]))) } On Sat, Aug 17, 2013 at 6:37 AM, Francesco Sarracino f.sarrac...@gmail.com wrote: Dear listers, I am running some OLS on multiply imputed data using Amelia. I first imputed the data with Amelia. than I run a OLS using Zelig to obtain a table of results accounting for the multiply imputed data-sets. And I'd like to do this for various models. Finally, I want to output all the models in a table of results for latex. I've tried with Stargazer because it seems to support Zelig output, but when I run stargazer on a set of objects containing the output of zelig, I get the following error: Error: unrecognized object type. this message is repeated for each model I passed to Stargazer. I am sorry I can't provide a working example, because I should make up some multiply imputed data first. Hoewever, summarizing what I did is: imputed1 - amelia(x=data1, m=10) imputed2 - amelia(x=data2, m=10) lm.imputed1 - zelig(Y ~ X + Z, data = imputed1) lm.imputed2 - zelig(Y ~ X + Z, data = imputed2) stargazer(lm.imputed1, lm.imputed2) The outcome is the error I mentioned above. Thanks in advance for all the support you can offer. Regards, f. [[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. -- Francesco Sarracino, Ph.D. https://sites.google.com/site/fsarracino/ [[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.
Re: [R] Amelia, Zelig and latex in R
Oh and are you looking for just the summarized results over all the imputed runs? i thought you wanted them from each iteration. On Sat, Aug 17, 2013 at 11:38 AM, Christopher Desjardins cddesjard...@gmail.com wrote: What do you mean by results? Do you want just the estimated parameters? And are you looking for one big table with all the estimated parameters from all imputation runs? Chris On Sat, Aug 17, 2013 at 11:18 AM, Francesco Sarracino f.sarrac...@gmail.com wrote: Hi Christopher, thanks for your reply. Unfortunately, that's not what I am looking for. I would like to have a table with the results of the two models (lm.imputed1 and lm.imputed2) in two separate columns. According to stargazer syntax I should type something like: stargazer(lm.imputed1, lm.imputed2, summary = FALSE) but then I get my error: Error: Unrecognized object type. Even though your example is insightful, I can't figure out how to solve my problem. Any advice is very welcome. Regards, f. On 17 August 2013 17:02, Christopher Desjardins cddesjard...@gmail.comwrote: Does this do what you want? library(Amelia) library(Zelig) library(stargazer) library(xtable) data(africa) m = 10 imp1 - amelia(x = africa,cs=country,m=m) imp2 - amelia(x = africa,cs=country,m=m) lm.imputed1 - zelig(infl ~ trade + civlib, model=ls,data = imp1) lm.imputed2 - zelig(infl ~ trade + civlib, model=ls,data = imp2) # Stargazer for(i in 1:m){ print(stargazer(as.data.frame(summary(lm.imputed1[[i]])$coef),as.data.frame(summary(lm.imputed2[[i]])$coef))) } # xtable for(i in 1:m){ print(xtable(summary(lm.imputed1[[i]]))) print(xtable(summary(lm.imputed2[[i]]))) } On Sat, Aug 17, 2013 at 6:37 AM, Francesco Sarracino f.sarrac...@gmail.com wrote: Dear listers, I am running some OLS on multiply imputed data using Amelia. I first imputed the data with Amelia. than I run a OLS using Zelig to obtain a table of results accounting for the multiply imputed data-sets. And I'd like to do this for various models. Finally, I want to output all the models in a table of results for latex. I've tried with Stargazer because it seems to support Zelig output, but when I run stargazer on a set of objects containing the output of zelig, I get the following error: Error: unrecognized object type. this message is repeated for each model I passed to Stargazer. I am sorry I can't provide a working example, because I should make up some multiply imputed data first. Hoewever, summarizing what I did is: imputed1 - amelia(x=data1, m=10) imputed2 - amelia(x=data2, m=10) lm.imputed1 - zelig(Y ~ X + Z, data = imputed1) lm.imputed2 - zelig(Y ~ X + Z, data = imputed2) stargazer(lm.imputed1, lm.imputed2) The outcome is the error I mentioned above. Thanks in advance for all the support you can offer. Regards, f. [[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. -- Francesco Sarracino, Ph.D. https://sites.google.com/site/fsarracino/ [[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.
Re: [R] regex challenge
Bill I found a workaround: f - ff(formula, lab) f - as.formula(gsub(`, , as.character(deparse(f Thanks for your elegant solution. Frank -- Thanks Bill. The problem is one of the results of convertName might be 'Heading(Age in Years)*age' (this is for the tables package), and as.name converts this to `Heading(...)*age` and the backticks cause the final formula to have a mixture of regular elements and ` ` quoted expression elements, making the formula invalid. Best, Frank --- -- Frank E Harrell Jr Professor and Chairman School of Medicine Department of Biostatistics Vanderbilt University __ 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] Error in Corpus() in tm package
It contains all text files which were converted from doc, docx, ppt etc. using libreoffice. Some of them are non-english text documents. Sorry I cannot share the corpus.. but if someone can shed light on what might cause this error then I can try to eliminate those documents if some specific docs are causing it. On Sat, Aug 17, 2013 at 9:55 AM, Milan Bouchet-Valat nalimi...@club.frwrote: Le vendredi 16 août 2013 à 19:35 -0700, Ajinkya Kale a écrit : I am trying to use the text mining package ... I keep getting this error : rm(list=ls()) library(tm) sourceDir - Z:\\projectk_viz\\docs_to_index ovid - Corpus(DirSource(sourceDir),readerControl = list(language = lat)) Error in if (vectorized (length = 0)) stop(vectorized sources must have positive length) : missing value where TRUE/FALSE needed I am not sure what it means. The posting guide asks for a reproducible example. If you cannot make available to us the contents of sourceDir, at least you should tell us what kind of files it contains. Have you tried with only some of the files the directory contains ? Regards --ajinkya [[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. -- Sincerely, Ajinkya http://ajinkya.info [[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.
[R] Runtime error using ncdf
HI everyone, I have encountered a problem while using ncdf to open nc files in R. I found in the internet several comments in the past but no solution. I could not find a direct solution but I found the source of the problem, if anyone may know where the solution could be, and an indirect solution. The problem occurs when opening large nc files with the ncdf package at 64bits. There may be a default setting on how big the files can be because the file opens just fine in R at 32 bits (I could not use the 32 bit version as very soon my process reached the RAM memory limit). If of interest to anyone, I ended up splitting my files (making them smaller than 2GB) using a software call NCO: http://www.ncl.ucar.edu/Support/talk_archives/2007/1053.html and then working in R at 64.. Cheers, Camilo Camilo Mora, Ph.D. Department of Geography, University of Hawaii Currently available in Colombia Phone: Country code: 57 Provider code: 313 Phone 776 2282 From the USA or Canada you have to dial 011 57 313 776 2282 http://www.soc.hawaii.edu/mora/ __ 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] Runtime error using ncdf
Hi Camilo, you don't say what platform you are running on, but the version of the underlying netcdf library installed on your machine must have been properly compiled to enable access to files greater than 2GB. Otherwise, the R interface to the netcdf library cannot work with such files. You might check how old your netcdf library is and/or whether it was compiled with large file support. If you are working on Linux, I suggest upgrading to ncdf4 instead of continuing with ncdf; the ncdf package was deprecated many years ago and does not get bug fixes. Regards, --Dave On Sat, Aug 17, 2013 at 12:56 PM, Camilo Mora cm...@dal.ca wrote: HI everyone, I have encountered a problem while using ncdf to open nc files in R. I found in the internet several comments in the past but no solution. I could not find a direct solution but I found the source of the problem, if anyone may know where the solution could be, and an indirect solution. The problem occurs when opening large nc files with the ncdf package at 64bits. There may be a default setting on how big the files can be because the file opens just fine in R at 32 bits (I could not use the 32 bit version as very soon my process reached the RAM memory limit). If of interest to anyone, I ended up splitting my files (making them smaller than 2GB) using a software call NCO: http://www.ncl.ucar.edu/**Support/talk_archives/2007/**1053.htmlhttp://www.ncl.ucar.edu/Support/talk_archives/2007/1053.html and then working in R at 64.. Cheers, Camilo Camilo Mora, Ph.D. Department of Geography, University of Hawaii Currently available in Colombia Phone: Country code: 57 Provider code: 313 Phone 776 2282 From the USA or Canada you have to dial 011 57 313 776 2282 http://www.soc.hawaii.edu/**mora/ http://www.soc.hawaii.edu/mora/ __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- David W. Pierce Division of Climate, Atmospheric Science, and Physical Oceanography Scripps Institution of Oceanography, La Jolla, California, USA (858) 534-8276 (voice) / (858) 534-8561 (fax)dpie...@ucsd.edu [[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.
Re: [R] Error in Corpus() in tm package
Funny, it works fine if I use VectorSource ovid - Corpus(VectorSource(list.files(sourceDir)[1:1253]), readerControl = list(language = lat)) So I tried only executing DirDource(sourceDir) and that fails with the error i mentioned earlier. So its not a problem with Corpus() which I thought initially it was. Also, I noticed that VectorSource works way more faster than having a DirSource there. Any particular reason ? On Sat, Aug 17, 2013 at 11:16 AM, Ajinkya Kale kaleajin...@gmail.comwrote: It contains all text files which were converted from doc, docx, ppt etc. using libreoffice. Some of them are non-english text documents. Sorry I cannot share the corpus.. but if someone can shed light on what might cause this error then I can try to eliminate those documents if some specific docs are causing it. On Sat, Aug 17, 2013 at 9:55 AM, Milan Bouchet-Valat nalimi...@club.frwrote: Le vendredi 16 août 2013 à 19:35 -0700, Ajinkya Kale a écrit : I am trying to use the text mining package ... I keep getting this error : rm(list=ls()) library(tm) sourceDir - Z:\\projectk_viz\\docs_to_index ovid - Corpus(DirSource(sourceDir),readerControl = list(language = lat)) Error in if (vectorized (length = 0)) stop(vectorized sources must have positive length) : missing value where TRUE/FALSE needed I am not sure what it means. The posting guide asks for a reproducible example. If you cannot make available to us the contents of sourceDir, at least you should tell us what kind of files it contains. Have you tried with only some of the files the directory contains ? Regards --ajinkya [[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. -- Sincerely, Ajinkya http://ajinkya.info -- Sincerely, Ajinkya http://ajinkya.info [[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.
Re: [R] Error in Corpus() in tm package
I think I know why it works faster, cause VectorSource in above code only takes the files names as a corpus and not the contents of the files :D duh! Any suggestions to create a vector source out of contents of the txt files ? On Sat, Aug 17, 2013 at 1:59 PM, Ajinkya Kale kaleajin...@gmail.com wrote: Funny, it works fine if I use VectorSource ovid - Corpus(VectorSource(list.files(sourceDir)[1:1253]), readerControl = list(language = lat)) So I tried only executing DirDource(sourceDir) and that fails with the error i mentioned earlier. So its not a problem with Corpus() which I thought initially it was. Also, I noticed that VectorSource works way more faster than having a DirSource there. Any particular reason ? On Sat, Aug 17, 2013 at 11:16 AM, Ajinkya Kale kaleajin...@gmail.comwrote: It contains all text files which were converted from doc, docx, ppt etc. using libreoffice. Some of them are non-english text documents. Sorry I cannot share the corpus.. but if someone can shed light on what might cause this error then I can try to eliminate those documents if some specific docs are causing it. On Sat, Aug 17, 2013 at 9:55 AM, Milan Bouchet-Valat nalimi...@club.frwrote: Le vendredi 16 août 2013 à 19:35 -0700, Ajinkya Kale a écrit : I am trying to use the text mining package ... I keep getting this error : rm(list=ls()) library(tm) sourceDir - Z:\\projectk_viz\\docs_to_index ovid - Corpus(DirSource(sourceDir),readerControl = list(language = lat)) Error in if (vectorized (length = 0)) stop(vectorized sources must have positive length) : missing value where TRUE/FALSE needed I am not sure what it means. The posting guide asks for a reproducible example. If you cannot make available to us the contents of sourceDir, at least you should tell us what kind of files it contains. Have you tried with only some of the files the directory contains ? Regards --ajinkya [[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. -- Sincerely, Ajinkya http://ajinkya.info -- Sincerely, Ajinkya http://ajinkya.info -- Sincerely, Ajinkya http://ajinkya.info [[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.
[R] remove from list
[[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.
[R] Appropriateness of R functions for multicore
Has there been any systematic evaluation of which core R functions are safe for use with multicore? Of current interest, I have tried calling read.table() via mclapply() to more quickly read in hundreds of raw data files (I have a 24 core system with 72 GB running Ubuntu, a perfect platform for multicore). There was a 40% failure rate, which doesn't occur when I invoke read.table() serially from within a single thread. Another example was using pvec() to invoke sapply(strsplit(),...) on a huge character vector (to pull out fields from within a field). It looked like a perfect application for pvec(), but it fails when serial execution works. I thought I'd ask before taking on the task of digging into the underlying code to see what is might be causing failure in a multicore (well, multi-threaded) context. As an alternative, I could define multiple cluster nodes locally, but that shifts the tradeoff a bit in whether parallel execution is advantageous - the overhead is significantly more, and even with 72 GB, it does impose greater limits on how many cores can be used. Bill Hopkins __ 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] A function taken out of its original environment performs more slowly.
Hi dear R-users, I encountered an interesting pattern. Take for example the function combn(), I copied and pasted the function definition and saved it as a new function named combn2() (see the end of this email). As it turned out, combn2() seems to be substantially slower than the original function combn() (see benchmark below), system.time(combn(30, 5)); system.time(combn2(30, 5)) user system elapsed 0.304 0.003 0.308 user system elapsed 1.591 0.007 1.602 I wonder if there is any reason for this difference and if there is any way to reduce the performance difference. Thanks! combn2 - function (x, m, FUN = NULL, simplify = TRUE, ...) { stopifnot(length(m) == 1L) if (m 0) stop(m 0, domain = NA) if (is.numeric(x) length(x) == 1L x 0 trunc(x) == x) x - seq_len(x) n - length(x) if (n m) stop(n m, domain = NA) m - as.integer(m) e - 0 h - m a - seq_len(m) nofun - is.null(FUN) if (!nofun !is.function(FUN)) stop('FUN' must be a function or NULL) len.r - length(r - if (nofun) x[a] else FUN(x[a], ...)) count - as.integer(round(choose(n, m))) if (simplify) { dim.use - if (nofun) c(m, count) else { d - dim(r) if (length(d) 1L) c(d, count) else if (len.r 1L) c(len.r, count) else c(d, count) } } if (simplify) { out - matrix(r, nrow = len.r, ncol = count) } else { out - vector(list, count) out[[1L]] - r } if (m 0) { i - 2L nmmp1 - n - m + 1L while (a[1L] != nmmp1) { if (e n - h) { h - 1L e - a[m] j - 1L } else { e - a[m - h] h - h + 1L j - 1L:h } a[m - h + j] - e + j r - if (nofun) x[a] else FUN(x[a], ...) if (simplify) out[, i] - r else out[[i]] - r i - i + 1L } } if (simplify) array(out, dim.use) else out } [[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.
Re: [R] A function taken out of its original environment performs more slowly.
On 18.08.2013 01:05, Xiao He wrote: Hi dear R-users, I encountered an interesting pattern. Take for example the function combn(), I copied and pasted the function definition and saved it as a new function named combn2() (see the end of this email). As it turned out, combn2() seems to be substantially slower than the original function combn() (see benchmark below), system.time(combn(30, 5)); system.time(combn2(30, 5)) combn is bytecode compiled, combn2 not: try library(compiler) combn2 - cmpfun(combn2) and you won't see such a difference anymore. Best, Uwe Ligges user system elapsed 0.304 0.003 0.308 user system elapsed 1.591 0.007 1.602 I wonder if there is any reason for this difference and if there is any way to reduce the performance difference. Thanks! combn2 - function (x, m, FUN = NULL, simplify = TRUE, ...) { stopifnot(length(m) == 1L) if (m 0) stop(m 0, domain = NA) if (is.numeric(x) length(x) == 1L x 0 trunc(x) == x) x - seq_len(x) n - length(x) if (n m) stop(n m, domain = NA) m - as.integer(m) e - 0 h - m a - seq_len(m) nofun - is.null(FUN) if (!nofun !is.function(FUN)) stop('FUN' must be a function or NULL) len.r - length(r - if (nofun) x[a] else FUN(x[a], ...)) count - as.integer(round(choose(n, m))) if (simplify) { dim.use - if (nofun) c(m, count) else { d - dim(r) if (length(d) 1L) c(d, count) else if (len.r 1L) c(len.r, count) else c(d, count) } } if (simplify) { out - matrix(r, nrow = len.r, ncol = count) } else { out - vector(list, count) out[[1L]] - r } if (m 0) { i - 2L nmmp1 - n - m + 1L while (a[1L] != nmmp1) { if (e n - h) { h - 1L e - a[m] j - 1L } else { e - a[m - h] h - h + 1L j - 1L:h } a[m - h + j] - e + j r - if (nofun) x[a] else FUN(x[a], ...) if (simplify) out[, i] - r else out[[i]] - r i - i + 1L } } if (simplify) array(out, dim.use) else out } [[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. __ 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] Appropriateness of R functions for multicore
In most threaded multitasking environments it is not safe to perform IO in multiple threads. In general you will have difficulty performing IO in parallel processing so it is best to let the master hand out data to worker tasks and gather results from them for storage. Keep in mind that just because you have eight cores for processing doesn't mean you have eight hard disks, so if your problem is IO bound in single processor operation then it will also be IO bound in threaded operation. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. Hopkins, Bill bill.hopk...@level3.com wrote: Has there been any systematic evaluation of which core R functions are safe for use with multicore? Of current interest, I have tried calling read.table() via mclapply() to more quickly read in hundreds of raw data files (I have a 24 core system with 72 GB running Ubuntu, a perfect platform for multicore). There was a 40% failure rate, which doesn't occur when I invoke read.table() serially from within a single thread. Another example was using pvec() to invoke sapply(strsplit(),...) on a huge character vector (to pull out fields from within a field). It looked like a perfect application for pvec(), but it fails when serial execution works. I thought I'd ask before taking on the task of digging into the underlying code to see what is might be causing failure in a multicore (well, multi-threaded) context. As an alternative, I could define multiple cluster nodes locally, but that shifts the tradeoff a bit in whether parallel execution is advantageous - the overhead is significantly more, and even with 72 GB, it does impose greater limits on how many cores can be used. Bill Hopkins __ 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.
Re: [R] Fwd: about plantbreeding library
If you have properly installed the plantbreeding package, then each time you start R, you need to type: library(plantbreeding) before you can access the data or the functions in the package. Kevin On Sat, Aug 17, 2013 at 12:18 AM, Waqas Shafqat waqas1...@gmail.com wrote: -- Forwarded message -- From: Waqas Shafqat waqas1...@gmail.com Date: Sat, Aug 17, 2013 at 10:18 AM Subject: Re: [R] about plantbreeding library To: Marc Girondot marc_...@yahoo.fr problem 1 stability analysis setwd(E:/) Data - read.table(file=setwd.csv, header=TRUE, sep=,) Data environments genotypes relication yield 1 1 1 134 2 1 1 235 3 1 1 333 4 1 2 143 5 1 2 243 6 1 2 344 7 1 3 156 8 1 3 257 9 1 3 354 102 1 132 112 1 233 122 1 331 132 2 144 142 2 246 152 2 348 162 3 158 172 3 257 182 3 359 193 1 144 203 1 245 213 1 347 223 2 155 233 2 256 243 2 357 253 3 160 263 3 261 273 3 363 # stability analysis data(multienv) Warning message: In data(multienv) : data set multienv not found out - stability (dataframe = multienv , yvar = yield, genotypes = genotypes, + environments = environments, replication = replication) Error: could not find function stability out Error: object 'out' not found above errors are found in stability analysis) problem 2 diallel setwd(E:/) Data - read.table(file=setwd.csv, header=TRUE, sep=,) Data Days.Taken.to.Tesselling X X.1 X.2 Days.Taken.to.Silking X.3 X.4 X.5 1 Crosses R1 R2 R3R1 R2 R3 NA 2 A 545 52 54 5258 59 58 NA 3 OH 28 54 53 5359 60 59 NA 4 OH 54-3A 56 56 5562 61 63 NA 5 WF 9 54 52 5360 58 59 NA 6 B 42 53 55 5461 62 61 NA 7N 48-1 55 53 5261 60 60 NA 8PB 7-1 55 56 5662 62 63 NA 9 52 B4 56 54 5660 59 60 NA 10A 545 x OH 28 53 52 5256 58 56 NA 11 A 545 x OH 54-3A 55 55 5360 59 61 NA 12 A 545 x WF 9 56 57 5662 63 63 NA 13 A 545 x B 42 53 52 5359 60 59 NA 14 A 545 x N 48-1 54 52 5361 60 60 NA 15 A 545 x PB 7-1 55 57 5663 62 62 NA 16A 545 x 52 B4 58 56 5665 64 64 NA 17OH 28 x A 545 53 53 5261 60 61 NA 18 OH 28 x OH 54-3A 50 52 5259 58 58 NA 19 OH 28 x WF 9 55 55 5664 63 63 NA 20 OH 28 x B 42 51 53 5357 58 57 NA 21 OH 28 x N 48-1 54 54 5460 60 59 NA 22 OH 28 x PB 7-1 58 57 5765 65 64 NA 23OH 28 x 52 B4 53 52 5359 60 59 NA 24 OH 54-3A x A 545 54 56 5663 62 62 NA 25 OH 54-3A x OH 28 53 54 5459 60 60 NA 26 OH 54-3A x WF 9 51 52 5259 58 58 NA 27 OH 54-3A x B 42 52 52 5460 61 60 NA 28OH 54-3A x N 48-1 55 55 5663 62 63 NA 29OH 54-3A x PB 7-1 54 54 5662 62 63 NA 30 OH 54-3A x 52 B4 51 53 5257 58 57 NA 31 WF 9 x A 545 57 58 5765 64 64 NA 32 WF 9 x OH 28 54 53 5362 61 61 NA 33 WF 9 x OH 54-3A 56 56 5664 63 64 NA 34 WF 9 x B 42 56 54 5460 61 60 NA 35WF 9 x N 48-1 53 51 5159 58 58 NA 36WF 9 x PB 7-1 56 55
Re: [R] remove from list
Please read the details offered in the resources below. On Aug 17, 2013, at 2:27 PM, Tony Paredes wrote: [[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. David Winsemius Alameda, CA, USA __ 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] remove from list
Sent from my T-Mobile 4G LTE Device Original message From: David Winsemius dwinsem...@comcast.net Date: 08/17/2013 9:39 PM (GMT-07:00) To: Tony Paredes tgal...@gmail.com Cc: r-help@r-project.org Subject: Re: [R] remove from list Please read the details offered in the resources below. On Aug 17, 2013, at 2:27 PM, Tony Paredes wrote: [[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. David Winsemius Alameda, CA, USA __ 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. [[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.
[R] First time r user
Hello R users, I have recently begun a project to analyze a large data set of approximately 1.5 million rows it also has 9 columns. My objective consists of locating particular subsets within this data ie. take all rows with the same column 9 and perform a function on that subset. It was suggested to me that i use the ddply() function from the Pylr package. Any advice would be greatly appreciated Thanks much, Dylan [[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.