Re: [R] Filling color's points in legend's plot in R

2012-01-19 Thread PtitBleu
Hello Tsidkenu, Not sure that I have well understood your question but maybe you can add fill to your legend function : legend(10,90,legend=c(TR=100 años,TR=50 años,TR=25 años,TR=10 años),lwd=2,pt.cex=1.5,bty='n',pch=c(24,22,21,23), fill=c(red,green,blue,black)) Have a good day, Ptit Bleu. --

[R] Sweave question - Setting Soutput code chunks to stay inside page margins?

2012-01-19 Thread Tal Galili
Hello all, Sometimes I get to make an R code chunk (in Sweave) which is longer then the margins of the page. Is there a way to force it to go to the next line (in Sweave) once that happens? Here are two cases this happens in the resulting .tex file (one is a hard case, and the other is simpler)

Re: [R] Sweave question - Setting Soutput code chunks to stay inside page margins?

2012-01-19 Thread Yihui Xie
Do you have a practical case in which you have to print 114 a's without spaces? I mean this is such an extreme case that is unlikely to happen in real life. As long as you have spaces in your string, it will be easy for LaTeX to wrap long lines, although LaTeX should be able to do it even if the

[R] looking for an ecological dataset

2012-01-19 Thread Vito Muggeo (UniPa)
dear all, apologizes for this off-topic question. I am looking for a ecological dataset (n100, say) including measurements of one or more growth variable and age. Could anyone to suggest the R package/URL where I can find it? many thanks, vito -- Vito

[R] add1 GLM - Warning message, what does it mean?

2012-01-19 Thread Jhope
Hi All, I am wondering if anyone can tell me what the warning message below the model means? J add1(DTA.glm,~ Aeventexhumed + Veg + Berm + HTL + Estuary + Rayos) Single term additions Model: cbind(MaxHatch, TotalEggs - MaxHatch) ~ Aeventexhumed + Veg + Berm + HTL Df Deviance

[R] Bash script produces: Error in library('package') : there is no package called 'package'

2012-01-19 Thread Leila Lackey
This is a follow-up to a post from 2007: https://stat.ethz.ch/pipermail/r-help/2007-April/129009.html Summary of the Problem: Packages are correctly installed and can be loaded when R is opened interactively or using a R script. However, a bash scripts produces an error similar to the following:

Re: [R] add1 GLM - Warning message, what does it mean?

2012-01-19 Thread Prof Brian Ripley
On Thu, 19 Jan 2012, Jhope wrote: Hi All, I am wondering if anyone can tell me what the warning message below the model means? Which one?: there are two warnings! 1) most likely indicates that Rayos is a character variable. 2) indicates that you have missing values in the variables you are

[R] Split values in vector

2012-01-19 Thread Johannes Radinger
Hello, I have a vector which looks like x$ART ... [35415] 0001-1;02-1;05-1; [35417] 01-1; 01-1;02-1; [35419] 01-1; 00 [35421] 01-1;04-1;05-1;

Re: [R] Sweave question - Setting Soutput code chunks to stay inside page margins?

2012-01-19 Thread Tal Galili
Hi Yihui, The a's case happens when, for example, one prints some long equation function without using spaces in it. It happened to me in something I wrote which I will write now while including spaces if I had known it would solve the issue, but I have yet to have found one (for Sweave, that is

[R] cacheSweave questions (usage and forward compatibility)

2012-01-19 Thread Tal Galili
Hello all, I would like to ask several questions regarding cacheSweave: 1) Is there a way to set cache=true globally? (I tried it using \SweaveOpts but it didn't seem to work) 2) Is there a way to flush specific cache once it is created? (other then erasing the entire cache directory)? Changing

Re: [R] Not generating line chart

2012-01-19 Thread Jan van der Laan
Devarayalu, This is FAQ 7.22: http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f use print(qplot()) Regards, Jan Sri krishna Devarayalu Balanagu balanagudevaray...@gvkbio.com schreef: Hi All, Can you please help me, why this code in not

Re: [R] Bash script produces: Error in library('package') : there is no package called 'package'

2012-01-19 Thread Petr Savicky
On Thu, Jan 19, 2012 at 12:13:00AM -0800, Leila Lackey wrote: This is a follow-up to a post from 2007: https://stat.ethz.ch/pipermail/r-help/2007-April/129009.html Summary of the Problem: Packages are correctly installed and can be loaded when R is opened interactively or using a R

Re: [R] New PLYR issue

2012-01-19 Thread Gunnar Oehmichen
Hi, thanks a lot. That was quite helpful, not only in terms of providing a solution to my problem, but in terms of efficiently explaining, what the problem is about. On 17/01/2012 18:26, Jeff Newmiller wrote: Replying to old messages without including context (particularly old ones) is

Re: [R] Not generating line chart

2012-01-19 Thread Jan van der Laan
Devarayalu, Please reply to the list. And it would have easier if you would have outputted your data using dput (in your case dput(Orange1)) so that I and other r-help members can just copy the data into R. Not everybody had Excell available (I for example haven't). The easier you make it

Re: [R] Split values in vector

2012-01-19 Thread Gerrit Eichner
Hi, Johannes, maybe X - unlist( strsplit( as.character( x$ART), split = ;, fixed = TRUE)) X - strsplit( X, split = -, fixed = TRUE) X - sapply( X, function( x) if( length(x) == 2) rep( x[1], as.numeric( x[2])) else x[1] ) table(X, useNA = always)

[R] nls issue

2012-01-19 Thread Mathew Brown
Hello, I'm trying to make a non-linear regression using the attached data and this model. When I run it I get the following message: Error in nls(y ~ 1/(a + w * x), data = df, start = list(a = 1, w = 1), : singular gradient mod - nls(y~1/(a+w*x),data=df,start=list(a=1,w=1),trace = TRUE)

[R] What does the : operator mean in glm formulas

2012-01-19 Thread Xiaobo Gu
Hi, I see the following is the credit scoreing in R guide : m2-glm(formula = good_bad ~ checking + duration + history+ purpose +amount + savings + employed + installp + marital + coapp +age + other + depends + telephon + foreign +checking:amount What does checking:amount mean? Regards,

Re: [R] Problems with Panel Data estimation

2012-01-19 Thread JBrettas
Anyone? ): -- View this message in context: http://r.789695.n4.nabble.com/Problems-with-Panel-Data-estimation-tp4306602p4309813.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

Re: [R] add1 GLM - Warning message, what does it mean?

2012-01-19 Thread Jhope
Thank you Prof Ripley, I understand and changed Rayos into a factor. Can someone please tell me how to change the: Model: cbind(MaxHatch, TotalEggs - MaxHatch) ~ Aeventexhumed + Veg + Berm + HTL Into a model that has?: Model: cbind(MaxHatch, TotalEggs - MaxHatch) ~ 1 Best, J --

[R] Legend problem in line charts

2012-01-19 Thread Sri krishna Devarayalu Balanagu
Hi all, Small problem in generating the line charts. Question: Legend for the first graph is coming wrong., for second graph correctly. Please fix the legend postion at the down of graph. Plesae give me the solution. Thank you Devarayalu Orange1 - structure(list(REFID = c(7, 7, 7, 7, 7,

Re: [R] Sweave question - Setting Soutput code chunks to stay inside page margins?

2012-01-19 Thread Duncan Murdoch
On 12-01-19 3:24 AM, Tal Galili wrote: Hello all, Sometimes I get to make an R code chunk (in Sweave) which is longer then the margins of the page. Is there a way to force it to go to the next line (in Sweave) once that happens? Sweave normally uses a verbatim environment, so you have to

Re: [R] Mean of simulation runs given in a table

2012-01-19 Thread Irek Szczesniak
Thank you, William, for your help! It works great. My final call looks like this: pars - c(.(nodes), .(load), .(buffer), .(deflections)) ddply(i, pars, summarize, mm_created = mean(mean_created), ms_created = mean(sdev_created), mm_admitted = mean(mean_admitted),

Re: [R] Not generating line chart

2012-01-19 Thread Jan van der Laan
As I mentioned in my previous reply: do not only email to me personally but also include the mailinglist. This gives other members also the opportunity to answer your question and lets other members, who might have a similar question, also see the answer. As for your first question: put

Re: [R] Table Intersection

2012-01-19 Thread rantree
thank you a lot :) -- View this message in context: http://r.789695.n4.nabble.com/Table-Intersection-tp4306968p4309929.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list

[R] converting a for loop into a foreach loop

2012-01-19 Thread kalee
Dear all, Just wondering if someone could help me out converting my code from a for() loop into a foreach() loop or using one of the apply() function. I have a very large dataset and so I'm hoping to make use of a parallel backend to speed up the processing time. I'm having trouble getting

Re: [R] What does the : operator mean in glm formulas

2012-01-19 Thread Ted Harding
On 19-Jan-2012 Xiaobo Gu wrote: Hi, I see the following is the credit scoreing in R guide : m2-glm(formula = good_bad ~ checking + duration + history + purpose +amount + savings + employed + installp + marital + coapp +age + other + depends + telephon + foreign +checking:amount What does

Re: [R] What does the : operator mean in glm formulas

2012-01-19 Thread David Winsemius
On Jan 19, 2012, at 8:02 AM, Xiaobo Gu wrote: Hi, I see the following is the credit scoreing in R guide : m2-glm(formula = good_bad ~ checking + duration + history+ purpose +amount + savings + employed + installp + marital + coapp +age + other + depends + telephon + foreign

Re: [R] cacheSweave questions (usage and forward compatibility)

2012-01-19 Thread Ben Bolker
Tal Galili tal.galili at gmail.com writes: Hello all, I would like to ask several questions regarding cacheSweave: 1) Is there a way to set cache=true globally? (I tried it using \SweaveOpts but it didn't seem to work) 2) Is there a way to flush specific cache once it is created? (other

[R] r help: source-function is very slow

2012-01-19 Thread Jos van Nijnatten
Hello everybody, I noticed a performance problem when using the source-function in R. When I try to source an r script that is located in the same directory as the script I execute via command line ('R -f file.r' contents 'source(someOtherScript.r)') it's very fast. But if I put

Re: [R] Interpreting script - write.csv

2012-01-19 Thread David Winsemius
On Jan 18, 2012, at 10:48 PM, Jhope wrote: Hi All, I am a beginner to R and a prof helped me with some script. I am having trouble understanding the below line. Is it finding the file turtlehatch.csv? I do not have my working directory set to this file. If so I tried (file.choose) and

Re: [R] What does the : operator mean in glm formulas

2012-01-19 Thread Xiaobo Gu
Such a model consists of a series of terms separated by +operators. In the above ,term means individual variable. The terms themselves consist of variable and factor names separated by : operators. What does term mean in this? Such a term is interpreted as the interaction of all the variables

Re: [R] What does the : operator mean in glm formulas

2012-01-19 Thread David Winsemius
On Jan 19, 2012, at 8:56 AM, Xiaobo Gu wrote: Such a model consists of a series of terms separated by +operators. In the above ,term means individual variable. The terms themselves consist of variable and factor names separated by : operators. What does term mean in this? Such a term is

Re: [R] Filling color's points in legend's plot in R

2012-01-19 Thread Tsidkenu
Thanks for the reply but I want to color (of gray) the triangle, square, circle and the other symbol appear in the legend. -- View this message in context: http://r.789695.n4.nabble.com/Filling-color-s-points-in-legend-s-plot-in-R-tp4308966p4310070.html Sent from the R help mailing list archive

Re: [R] r help: source-function is very slow

2012-01-19 Thread Uwe Ligges
On 19.01.2012 14:25, Jos van Nijnatten wrote: Hello everybody, I noticed a performance problem when using the source-function in R. When I try to source an r script that is located in the same directory as the script I execute via command line ('R -f file.r' contents

Re: [R] Filling color's points in legend's plot in R

2012-01-19 Thread Uwe Ligges
On 19.01.2012 15:02, Tsidkenu wrote: Thanks for the reply but I want to color (of gray) the triangle, square, circle and the other symbol appear in the legend. PLEASE do read the posting guide. Uwe Ligges -- View this message in context:

Re: [R] r help: source-function is very slow

2012-01-19 Thread Duncan Murdoch
On 12-01-19 8:25 AM, Jos van Nijnatten wrote: Hello everybody, I noticed a performance problem when using the source-function in R. When I try to source an r script that is located in the same directory as the script I execute via command line ('R -f file.r' contents 'source(someOtherScript.r)')

[R] Help with .csv file reading !

2012-01-19 Thread aaurouss
Hello, Here's my problem : I have a csv file which I have to read with read.table() function (or read.csv). The file has about 6 lines whose data are written this way: character;character;character;character 14/10/2010 13:10;0;49;0;49; 14/10/2010 13:20;0;49;0;49; 14/10/2010

Re: [R] cacheSweave questions (usage and forward compatibility)

2012-01-19 Thread Yihui Xie
Tal, You probably need to cc the package author for reliable answers, but my attempts are below anyway: 1) true or TRUE? I'm not exactly sure how this option is parsed (checking the source code is one way to go), but for knitr, it does not allow true to mean TRUE, and \SweaveOpts{cache=TRUE}

Re: [R] r help: source-function is very slow

2012-01-19 Thread Jos van Nijnatten
Hello Uwe, Duncan and the rest of the community, It indeed seemed to be a file system problem and I'm lucky to figure that out before it crashed. New computer's great and everything is working fine again. Sorry for wasting your time ;-) On Thursday, January 19, 2012 15:16, Duncan Murdoch

Re: [R] Help with .csv file reading !

2012-01-19 Thread David Winsemius
On Jan 19, 2012, at 9:22 AM, aaurouss wrote: Hello, Here's my problem : I have a csv file which I have to read with read.table() function (or read.csv). The file has about 6 lines whose data are written this way: character;character;character;character 14/10/2010 13:10;0;49;0;49;

Re: [R] breakpoints and nonlinear regression

2012-01-19 Thread Vito Muggeo (UniPa)
dear Julian, Il 18/01/2012 14.36, crimsonengineer87 ha scritto: Thanks for the comments. Yes, I also had segmented and then I went away from that. I can't remember. I've tried using it but I get some sort of strange error. Here's some code ... it is difficult for me to help you without

Re: [R] Help with .csv file reading !

2012-01-19 Thread David Winsemius
On Jan 19, 2012, at 9:34 AM, David Winsemius wrote: On Jan 19, 2012, at 9:22 AM, aaurouss wrote: Hello, Here's my problem : I have a csv file which I have to read with read.table() function (or read.csv). The file has about 6 lines whose data are written this way:

Re: [R] Split values in vector

2012-01-19 Thread Johannes Radinger
Hi, just for explaining it a little bit furhter here a small sample dataframe (similar to that I am working with). var1 -seq(1,5) var2 -c(A,B,C,D,E) var3 -c(00,01-1;02-3;04-1,01-2;02-1,01-0;04-12,NA) x - data.frame(var1,var2,var3) The final dataframe should look like: When there is the

[R] Alaska and Hawaii map data?

2012-01-19 Thread Kevin Burton
I can plot each county of the contiguous 48 states or all of them using variations of map('county', region=c('wisconsin' . . . .) in the maps package. I was wondering whether similar data was available for Alaska and Hawaii? I was also wondering if there was a database that listed FIPS

Re: [R] Legend problem in line charts

2012-01-19 Thread Petr PIKAL
Hi Hi all, Small problem in generating the line charts. Question: Legend for the first graph is coming wrong., for second graph correctly. Please fix the legend postion at the down of graph. Plesae give me the solution. Thank you Devarayalu Orange1 - structure(list(REFID

Re: [R] graph paper look

2012-01-19 Thread David L Carlson
You could look at grid(), but the Note in the documentation suggests If more fine tuning is required, use abline(h = ., v = .) directly. Also grid() uses the default axis positions so if you specify details of the axis with xlim, ylim, etc the grid does not line up on the tickmarks. Using abline

[R] Reading in tab (and space) delimited data within a script XXXX

2012-01-19 Thread Dan Abner
Hello everyone, I use Bob Muenchen's approach for reading in in-stream (to use SAS parlance) delimited data within a script. This works great: mystring - id,workshop,gender,q1,q2,q3,q4 1,1,f,1,1,5,1 2,2,f,2,1,4,1 3,1,f,2,2,4,3 4,2, ,3,1, ,3 5,1,m,4,5,2,4 6,2,m,5,4,5,5 7,1,m,5,3,4,4

[R] cannot dyn.load dll from path

2012-01-19 Thread Adrian Dragulescu
Hello, I'm on Windows, and according to the documentation R searches along the search path when looking for dll's for dyn.load. For illustration, I've copied the XML.dll from package XML in the C:/Temp folder if (file.exists(C:/Temp/XML.dll)) { Sys.setenv(path = paste(C:/Temp;,

Re: [R] Reading in tab (and space) delimited data within a script XXXX

2012-01-19 Thread R. Michael Weylandt
Simply change the sep = , argument of read table: for a space and \t for a tab. E.g., read.table(text = data3, sep = , header = TRUE) Take a look at ?read.table for more info about the sep argument (In particular the special behavior of the default sep = ) Thanks for the well-posed question

Re: [R] Reading in tab (and space) delimited data within a script XXXX

2012-01-19 Thread Dan Abner
Hi Michael, Thanks for your responses. When I do this, I am not successful. What am I doing wrong? data3- + OBSNOAGESEXALKPHOSLABCAMMOLPHOSMMOLAGEGROUP + 2176M8453.20.93 + 2276M52.180.843 + 2368M8252.150.521 + 2469M8452.31.361 + 2576F100325.31.073 + 2670F903200.972 + 2771F109322.30.942 +

Re: [R] Reading in tab (and space) delimited data within a script XXXX

2012-01-19 Thread David Winsemius
On Jan 19, 2012, at 11:37 AM, Dan Abner wrote: Hello everyone, I use Bob Muenchen's approach for reading in in-stream (to use SAS parlance) delimited data within a script. This works great: mystring - id,workshop,gender,q1,q2,q3,q4 1,1,f,1,1,5,1 2,2,f,2,1,4,1 3,1,f,2,2,4,3 4,2, ,3,1, ,3

Re: [R] R package dev: how to export constant?

2012-01-19 Thread Jonas Stein
Jonas, I've just seen your function 'sistring' code and it's different from the code in Thanks a lot for reporting this bug. It is fixed now in the git repository. I added some examples, but they do not work: R CMD check sitools = snip ### ** Examples library(sitools)

Re: [R] Reading in tab (and space) delimited data within a script XXXX

2012-01-19 Thread Jeff Newmiller
Cannot see what you are doing wrong, since you don't show that. It looks like you have eliminated all delimiters from your input data. Perhaps your editor settings are doing something to your data (though usually tabs if altered become spaces).

[R] fitting an exp model

2012-01-19 Thread arivald
Hello there, I am trying to fit an exponential model using nls to some data. #data t - c(0,15,30,60,90,120,240,360,480) var - c(0.36,9.72,15.50,23.50,31.44,40.66,59.81,73.11,81.65) df - data.frame(t, var) # model # var ~ a+b*(1-exp(-k*t)) # I'm looking for values of a,b and k #

[R] Global sensitivity indices using sensitivity package: sobol, sobol2002

2012-01-19 Thread Adiaba
Dear R users, I have been trying to estimate global sensitivity indices such as the sobol 1st and 2nd order indices. I managed to obtain the PRCC. The example presented in the sensitivity package on sobol2002 seems to work well for linear models: for example: calculate y for given x values.

[R] R connect to Informix Database

2012-01-19 Thread Scotty33
Hi, I am new to R and wondering if it is possible for it to connect to an Informix database. I tried google but nothing came back that I could figure out. Can somebody tell me if its possible (which I believe it is) and how to connect to an Informix database using R. Thanks! -- View this

[R] RODBC problem inserting into tables

2012-01-19 Thread Faensen
I have a problem with RODBC statements that seems to be related to inserting data into a table during an SQL batch (MS SQL Server). It started from a stored procedure that didn't return data to R but I could boil it down to the following simplified code snippets. The first one does work:

Re: [R] R connect to Informix Database

2012-01-19 Thread R. Michael Weylandt michael.weyla...@gmail.com
If you can't get an answer here it may be worth posting to the R-SIG-DB list in 24 hours or so. (special interest group for databases) Data bases are not an area I know at all, but I think RODBC attempts to work with a universal database standard so that might be worth exploring. But like I

Re: [R] cannot dyn.load dll from path

2012-01-19 Thread Duncan Murdoch
On 19/01/2012 11:19 AM, Adrian Dragulescu wrote: Hello, I'm on Windows, and according to the documentation R searches along the search path when looking for dll's for dyn.load. For illustration, I've copied the XML.dll from package XML in the C:/Temp folder if

[R] state multi-state modeling using hidden markov routine in the msm package

2012-01-19 Thread Stephen Nyangoma
Hello Chris, I am trying to fit a 4 state multi-state model using hidden markov routine in the msm package. 1. initial parameters: twoway4.q - rbind(c(0, 0.25, 0, 0.25), c(0.166, 0, 0.166, 0.166), c(0, 0.25, 0, 0.25), c(0, 0, 0, 0)) ematrix - rbind( c(0, 0.01, 0, 0), c(0.01, 0, 0.01,0),

[R] venn.diagram how to control circle diameter

2012-01-19 Thread Mikael Johnson
Hi there, Is there a way to control the circle diameter in venn.diagram function of VennDiagram package? Thanks Mike [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] Executable expressions

2012-01-19 Thread R. Michael Weylandt
Fabulous example, Baptiste! Yeah, the knock is that it's just not at all clear and too often symptomatic of someone trying to be too clever by half when there's usually a better way. There are times when these tricks can be really helpful for non-standard evaluation (e.g., the curve() function --

Re: [R] cannot dyn.load dll from path

2012-01-19 Thread Adrian Dragulescu
It doesn't work even if I set it with \\. My path has a mixture of \\ and / and other entries work fine. if (file.exists(C:/Temp/XML.dll)) { Sys.setenv(path = paste(C:\\Temp;C:/Temp;, Sys.getenv(path), sep=)) dyn.load(XML.dll) # doesn't find it! } Error in inDL(x, as.logical(local),

Re: [R] Reading in tab (and space) delimited data within a script XXXX

2012-01-19 Thread R. Michael Weylandt
I can't reproduce your problem: both of these work just fine for me. read.table(text = data3, header = TRUE, sep = , row.names = OBSNO) read.table(textConnection(data3), header = TRUE, sep = , row.names = OBSNO, na.string = -99) dput(data3) OBSNO AGE SEX ALKPHOS LAB CAMMOL PHOSMMOL

Re: [R] cannot dyn.load dll from path

2012-01-19 Thread Duncan Murdoch
On 19/01/2012 1:42 PM, Adrian Dragulescu wrote: It doesn't work even if I set it with \\. My path has a mixture of \\ and / and other entries work fine. if (file.exists(C:/Temp/XML.dll)) { Sys.setenv(path = paste(C:\\Temp;C:/Temp;, Sys.getenv(path), sep=)) dyn.load(XML.dll) # doesn't

Re: [R] Reading in tab (and space) delimited data within a script XXXX

2012-01-19 Thread David L Carlson
Your first email has data3- OBSNO AGE SEX ALKPHOS LAB CAMMOL PHOSMMOL AGEGROUP 21 76 M 84 5 3.2 0.9 3 22 76 M 5 2.18 0.84 3 23 68 M 82 5 2.15 0.52 1 24 69 M 84 5 2.3 1.36 1 25 76 F 100 3 25.3 1.07 3 26 70 F 90 3 20 0.97 2 27 71 F 109 3 22.3 0.94 2 28 70 -99 65 3 24.3 1.42 2 29 74 F 61 3 25 0.87

Re: [R] Reading in tab (and space) delimited data within a scriptXXXX

2012-01-19 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Dan Abner Sent: Thursday, January 19, 2012 8:51 AM To: R. Michael Weylandt Cc: r-help@r-project.org Subject: Re: [R] Reading in tab (and space) delimited data within a

Re: [R] Filling color's points in legend's plot in R

2012-01-19 Thread R. Michael Weylandt
You might be able to do it with overplotting,(i.e., do the solid grey using the pch values in the 20s and then use a hollow symbol to put a black border on it) but I don't see a natural way to change the background color for just those characters. How'd you do so on the body of the plot?

Re: [R] Executable Expressions II

2012-01-19 Thread R. Michael Weylandt
Glad you got it worked out -- I don't know C# but if it's portable-ish to C++ you may also want to look at Dirk's RInside project: http://dirk.eddelbuettel.com/code/rinside.html and here in web-deployment http://dirk.eddelbuettel.com/blog/2011/11/30/#rinside_and_wt Michael On Wed, Jan 18,

Re: [R] fitting an exp model

2012-01-19 Thread Ben Bolker
arivald rzepus.m at gmail.com writes: I am trying to fit an exponential model using nls to some data. #data t - c(0,15,30,60,90,120,240,360,480) var - c(0.36,9.72,15.50,23.50,31.44,40.66,59.81,73.11,81.65) df - data.frame(t, var) # model # var ~ a+b*(1-exp(-k*t)) # I'm

[R] read in Stata and SPSS with value labels/formats

2012-01-19 Thread Xu Jun
Sorry I forgot the subject line last time Dear R experts, I am using the foreign package to read in Stata and SPSS format data files (same data but I tried different format). I first tried using read.dta for the Stata format: ## library(foreign) mystata -

Re: [R] Executable Expressions II

2012-01-19 Thread Ajay Askoolum
Thank you very much for this information. From: R. Michael Weylandt michael.weyla...@gmail.com Cc: Richard M. Heiberger r...@temple.edu; R General Forum r-help@r-project.org Sent: Thursday, 19 January 2012, 19:17 Subject: Re: [R] Executable Expressions II

Re: [R] drop rare factors

2012-01-19 Thread Sam Steingold
* Sarah Goslee fnenu.tbf...@tznvy.pbz [2012-01-18 17:36:16 -0500]: Here's one way, worked out in lots of steps so you can see how each works: thanks, it all makes perfect sense, and I wrote this function based on your instructions: drop.levels - function (frame, column, threshold) { size -

[R] What is a 'closure'?

2012-01-19 Thread Ajay Askoolum
The R Language Definition at http://cran.r-project.org/doc/manuals/R-lang.html states in the following section 4.3.2 Argument matching This subsection applies to closures but not to primitive functions. What are 'closures'? [[alternative HTML version deleted]]

Re: [R] drop rare factors

2012-01-19 Thread Sarah Goslee
Hi Sam, To be of any use whatsoever, we need a reproducible example. What's frame? What's column? What's threshold? Remind the list what you're trying to do. The list gets lots of traffic; if you delete out all the context nobody will remember what you need. Sarah On Thu, Jan 19, 2012 at 2:44

Re: [R] What is a 'closure'?

2012-01-19 Thread R. Michael Weylandt
http://www.lemnica.com/esotericR/Introducing-Closures/ Any function you work with will be a closure -- primitives are built-in functions that users can't create. (without source editing recompiling R) E.g. the function c() (type it without parentheses at the prompt to see its code) Let me know

Re: [R] Alaska and Hawaii map data?

2012-01-19 Thread Ray Brownrigg
On Fri, 20 Jan 2012, Kevin Burton wrote: I can plot each county of the contiguous 48 states or all of them using variations of map('county', region=c('wisconsin' . . . .) in the maps package. I was wondering whether similar data was available for Alaska and Hawaii? I was also

Re: [R] fitting an exp model

2012-01-19 Thread Rolf Turner
On 20/01/12 06:38, arivald wrote: Hello there, I am trying to fit an exponential model using nls to some data. #data t- c(0,15,30,60,90,120,240,360,480) var- c(0.36,9.72,15.50,23.50,31.44,40.66,59.81,73.11,81.65) df- data.frame(t, var) # model # var ~ a+b*(1-exp(-k*t)) # I'm looking for

Re: [R] What is a 'closure'?

2012-01-19 Thread Ajay Askoolum
Michael, thank you, especially for the link. I think I understand. The vocabulary is so different! I know 'closure' as 'user-defined function'. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] What is a 'closure'?

2012-01-19 Thread Ben Bolker
Ajay Askoolum aa2e72e at yahoo.co.uk writes: Michael, thank you, especially for the link. I think I understand. The vocabulary is so different! I know 'closure' as 'user-defined function'. Not quite. All (??) user-defined functions are closures, but lots of non-user-defined functions

Re: [R] drop rare factors

2012-01-19 Thread Sam Steingold
create data: mydata - data.frame(MyFactor = factor(rep(LETTERS[1:4], times=c(1000, 2000, 30, 4))), something = runif(3034)) define function: drop.levels - function (df, column, threshold) { size - nrow(df) if (threshold 1) threshold - threshold * size tab - table(df[column]) keep -

[R] POSIXct value display incorrect for some values

2012-01-19 Thread Curt Seeliger
First, the reproducable example, showing how converting from character to POSIXct to character changes the milliseconds in the first time stamp though not in the second: as.POSIXct('2010-06-03 9:03:58.324') [1] 2010-06-03 09:03:58.323 PDT as.POSIXct('2010-06-03 9:03:58.325') [1] 2010-06-03

Re: [R] drop rare factors

2012-01-19 Thread Sarah Goslee
Everywhere that you use df[column] should be df[[column]] That's the only thing I see, *except* that df() and drop() are base functions, so you shouldn't use those as variable names. Remind the list what you're trying to do. The list gets lots of traffic; if you delete out all the context

Re: [R] drop rare factors

2012-01-19 Thread William Dunlap
That's the only thing I see, *except* that df() and drop() are base functions, so you shouldn't use those as variable names. I don't think that is much of a problem. The local versions will be used in the function. A bigger problem is naming your function 'drop.levels'. There is a core R

Re: [R] What is a 'closure'?

2012-01-19 Thread Ajay Askoolum
Thanks for clarifying. Is my (new) understanding stated below correct? - A closure is any function (user- or system- defined) where is.primitive(functionName) is FALSE. - is.primitive(functionName) is FALSE when functionName is a system-defined function that is coded in R itself.

Re: [R] drop rare factors

2012-01-19 Thread Sarah Goslee
On Thu, Jan 19, 2012 at 4:11 PM, William Dunlap wdun...@tibco.com wrote: That's the only thing I see, *except* that df() and drop() are base functions, so you shouldn't use those as variable names. I don't think that is much of a problem.  The local versions will be used in the function.

Re: [R] What is a 'closure'?

2012-01-19 Thread peter dalgaard
On Jan 19, 2012, at 21:39 , Ben Bolker wrote: Ajay Askoolum aa2e72e at yahoo.co.uk writes: Michael, thank you, especially for the link. I think I understand. The vocabulary is so different! I know 'closure' as 'user-defined function'. Not quite. All (??) user-defined functions

Re: [R] What is a 'closure'?

2012-01-19 Thread Bert Gunter
On Thu, Jan 19, 2012 at 1:15 PM, Ajay Askoolum aa2e...@yahoo.co.uk wrote: Thanks for clarifying. Is my (new) understanding stated below correct? No. -- Bert - A closure is any function (user- or system- defined) where is.primitive(functionName) is FALSE. - is.primitive(functionName)

Re: [R] computing scores from a factor analysis

2012-01-19 Thread William Revelle
Wolfgang, Since you seem to be doing this in the psych package, it would have been faster to directly ask the author (me). Luckily, I saw the question on R-Help. The principal components step is being done on the correlation matrix, not on the raw data matrix, thus, it is not able to find

Re: [R] read in Stata and SPSS with value labels/formats

2012-01-19 Thread Frank Harrell
require(Hmisc) ?spss.get Xu Jun wrote Sorry I forgot the subject line last time Dear R experts, I am using the foreign package to read in Stata and SPSS format data files (same data but I tried different format). I first tried using read.dta for the Stata format:

[R] Establishing groups using something other than ifelse()

2012-01-19 Thread Sam Albers
Hello all, This is one of those Is there a better way to do this questions. Say I have a dataframe (df) with a grouping variable (z). This is my base data. Now I know that there is a higher order level of grouping that exist for my group variable. So what I want to do is create a new column that

Re: [R] Establishing groups using something other than ifelse()

2012-01-19 Thread Justin Haynes
how bout levels(df$z)[grep('A',levels(df$z))] - 'A' levels(df$z)[grep('B',levels(df$z))] - 'B' levels(df$z)[grep('C',levels(df$z))] - 'C' does that do what you're wanting? On Thu, Jan 19, 2012 at 3:05 PM, Sam Albers tonightstheni...@gmail.comwrote: Hello all, This is one of those Is there

Re: [R] What is a 'closure'?

2012-01-19 Thread Hadley Wickham
On Thu, Jan 19, 2012 at 1:45 PM, Ajay Askoolum aa2e...@yahoo.co.uk wrote: The R Language Definition at http://cran.r-project.org/doc/manuals/R-lang.html states in the following section 4.3.2 Argument matching This subsection applies to closures but not to primitive functions. What are

Re: [R] Establishing groups using something other than ifelse()

2012-01-19 Thread Sam Albers
On Thu, Jan 19, 2012 at 3:34 PM, Justin Haynes jto...@gmail.com wrote: how bout levels(df$z)[grep('A',levels(df$z))] - 'A' levels(df$z)[grep('B',levels(df$z))] - 'B' levels(df$z)[grep('C',levels(df$z))] - 'C' does that do what you're wanting? Shoot. Might have made my example confusing,

Re: [R] Establishing groups using something other than ifelse()

2012-01-19 Thread Jorge I Velez
Hi Sam, Check the examples in require(car) ?recode HTH, Jorge.- On Thu, Jan 19, 2012 at 6:05 PM, Sam Albers wrote: Hello all, This is one of those Is there a better way to do this questions. Say I have a dataframe (df) with a grouping variable (z). This is my base data. Now I know that

[R] Bayesian data analysis recommendations

2012-01-19 Thread C W
Dear all, I am trying to learn Bayesian inference and Bayesian data analysis, I am new in the field. Would any experts on the list recommend any good sites or materials for beginners? My approach is to learn and understand the theory first, then program on my own using R, though I see there are

[R] snow - bootstrapped correlation ranking

2012-01-19 Thread Patrik Waldmann
I wonder if someone could help me adjusting the following code to parallelized snow code: #Creating a data set (not needed to be parallel) n-100 p-100 x-matrix(rnorm(n*p),p) y-rnorm(n) # Bootstrapping nboot-1000 alpha-0.05 rhoboot - array(0, dim=c(p,nboot)) bootranks - array(0, dim=c(p,nboot))

[R] question re. package playwith not able to run command getting error message that I'm attempting to use non function

2012-01-19 Thread Farhat Maha
Hello, I managed to install playwith package and all its prerequisites. My R version is R 2.14: R version 2.14.1 (2011-12-22) Copyright (C) 2011 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: i486-pc-linux-gnu (32-bit) All my packages were updated, and recently

[R] dataframe: how to select an element from a row

2012-01-19 Thread ikuzar
Hi, I 'd like to select the Date where myvalue =1800 appears the* first time*. For instance: df =data.frame(date, myvalue, ...) ... Datemyvalue 2012-01-052500 2012-01-06 2450 *2012-01-07 1800* 2012-01-08

[R] Apply Function to List by Group Returning Result with Dim of List

2012-01-19 Thread jamesrobinsonjnr
I have a panel data set defined as a simple data.frame with a factor age and income. I would like to generate the results of a set function such as (sum, mean, or even diff) separate for each factor (category or age group). However I want the result to have the same dimension as the overal

  1   2   >