Re: [R] Plotting sigma symbol with unicode and turning into pdf

2009-08-12 Thread Dieter Menne
Jonathan R. Blaufuss wrote: > > > set.seed(1) > Data=rnorm(100,sd=1) > plot(density(Data)) > text(25000,0.4, > paste("\u03c3 = ", > format(round(sd(Data),digits=3),big.mark=",")), > font=2, col="blue") > That example gives a latin "s" in my Windows system

Re: [R] Slicing cra**y csv files

2009-08-12 Thread Patrick Connolly
On Wed, 12-Aug-2009 at 03:36AM -0700, jorgusch wrote: |> |> First of all, sorry for not giving all information. |> |> Secondly, thanks a lot. This is a real help!! I did not know, that you can |> use names... |> This is really simple and works great!!! |> |> If anyone is close enough to the peo

Re: [R] Proper / Improper scoring Rules

2009-08-12 Thread Daniel Malter
results=c(0.31,0.36,0.33) names(results)=c("y=good","y=better","y=best") results names(results)[results==max(results)] which(names(results)==(names(results)[results==max(results)])) More generally, however, avoid protected operators in your variable names (like the equality sign)! Rather choose s

Re: [R] what is the difference between the two logistic models?

2009-08-12 Thread Daniel Malter
As I wrote in my previous email, you need to pick up a methods book that deals with an introduction to regression analysis. Using factors in R means using dummy variable coding. The coefficients estimated in your model using factors indicate, the effect of teaching.method = 2 in comparison to th

Re: [R] Proper / Improper scoring Rules

2009-08-12 Thread Donald Catanzaro, PhD
Hi All, I have done more background research (including Frank's book) so I feel that my second question is answered. However, as a novice R user I still have the following problem, accessing the output of predict. So simplifying my question, using the example provided in the Design package

Re: [R] logistic regression

2009-08-12 Thread Daniel Malter
This reads as if you need to pick up a methods book on regression more generally. My guess is that "teaching method" is perfectly collinear with "TotalHours." Therefore, your model matrix is rank deficient. That is, if it is the case that teaching method=(1), (2), and (3) imply total hours=(0), (1)

Re: [R] psi not functioning in nlrob?

2009-08-12 Thread Xiao Xiao
Thank you Keo! After installing MASS the default "psi=psi.huber" is working now. However I still can't get "psi=psi.bisquare" to work, and here's another error message: > model3=nlrob(y~a1*x^a2,data=transient,psi=psi.bisquare, > start=list(a1=0.02,a2=0.7),maxit=1000) Error in na.fail.default(list(

Re: [R] psi not functioning in nlrob?

2009-08-12 Thread Keo Ormsby
You have to install MASS package first. Hope this does the trick. Best, Keo. Xiao Xiao wrote: Hi all, I'm trying to fit a nonlinear regression by "nlrob": model3=nlrob(y~a1*x^a2,data=transient,psi=psi.bisquare, start=list(a1=0.02,a2=0.7),maxit=1000) However an error message keeps popping up

Re: [R] REMOVE ME

2009-08-12 Thread Mehdi Khan
You can do it yourself by unsubscribing. On Wed, Aug 12, 2009 at 8:48 PM, Tim Paysen wrote: > This mailing list is too intrusive. Remove my name. >[[alternative HTML version deleted]] > > > __ > R-help@r-project.org mailing list > https://stat

[R] what is the difference between the two logistic models?

2009-08-12 Thread SNN
Hi All, I have data with 400 individuals and the following information Grade: pass or fail coded as 1 for pass and 0 for fail Sex: male or female ( coded as 1 for male and 2 for female ) Age Teaching.method : can be 1,2,3 I want to fit a logistic regression where the outcome if (1=pass

[R] logistic regression

2009-08-12 Thread SNN
Hi All, I have data with 400 individuals and the following information Grade: pass or fail Sex: male or female Age Teaching.metho : can be 1,2,3 TotalHours: can be 0,1,2 I want to fit a logistic regression and for the TotalHours I am getting nothing! What could be the reason. What does the

[R] tcltk in BATCH mode

2009-08-12 Thread Angel Spassov
DeaR list, I am writing a user friendly script for an interactive use of R. The user is supposed to click on a bat-File in Windows-environment and to enter some values in a pop-up window. Let us assume we have the script given below. If she sources this script within R, everything works smoothly.

Re: [R] Map of UK Counties - to use in R

2009-08-12 Thread Raoul
Thanks a million Roger! This works well. All I now need to do is to figure how I can plot data from a csv file onto the map. I really appreciate your assistance! Regards, Raoul Roger Bivand wrote: > > The illustration you show is for the so-called traditional or historical > counties of England

Re: [R] REMOVE ME

2009-08-12 Thread Jorge Ivan Velez
Dear Tim, You can do this yourself at https://stat.ethz.ch/mailman/listinfo/r-help (scroll down). HTH, Jorge On Wed, Aug 12, 2009 at 11:48 PM, Tim Paysen <> wrote: > This mailing list is too intrusive. Remove my name. >[[alternative HTML v

Re: [R] REMOVE ME

2009-08-12 Thread stephen sefick
remove yourself! On Wed, Aug 12, 2009 at 10:48 PM, Tim Paysen wrote: > This mailing list is too intrusive.  Remove my name. >        [[alternative HTML version deleted]] > > > __ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo

Re: [R] Creating a column based on data in another column

2009-08-12 Thread Mehdi Khan
willsclahanstationcut$wills.vs30<- recode(willsclahanstationcut$area.VSCAT,c("B"=686,"C"= 464,"BC"= 724, "D"=301,"CD"= 372, "D"= 800, "DE"= 1000, "WATER"=0)) where $vs30 is the column I want to create, $area.VSCAT is the column which contains the labels. On Wed, Aug 12, 2009 at 8:46 PM, Mehdi Kh

[R] REMOVE ME

2009-08-12 Thread Tim Paysen
This mailing list is too intrusive.  Remove my name. [[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.ht

Re: [R] Creating a column based on data in another column

2009-08-12 Thread Mehdi Khan
Hey guys, I have the same question, except in reverse: if we had letter classifications and wanted to assign numerical values to them (the case I stated previously except the other way around) how would we do that? I am trying to use the recode function in the car package but not having any luck..

Re: [R] Another Plotting Hint - changing fill color for points

2009-08-12 Thread Scott Sherrill-Mix
I don't really use Word or .wmf but maybe try a high pixel count .png e.g. png('test.png',height=480*5,width=480*5,res=72*5) plot(1:10, col = "red", bg = "grey", pch=21, cex =1.7) dev.off() Scott Scott Sherrill-Mix Department of Microbiology University of Pennsylvania 402B Johnson Pavilion 3610

Re: [R] to extract a section of the matrix

2009-08-12 Thread Daniel Malter
x=c("blah","blub","bleep","foo") y=rnorm(4) yourdata=data.frame(x,y) yourdata newdata=yourdata[order(y),] newdata thisiswhatyouwant=newdata[1:2,] thisiswhatyouwant hth, daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- V

[R] to extract a section of the matrix

2009-08-12 Thread Inchallah Yarab
HI, i have this matrix and i want to extract  a section of the matrix which present the first and second value of optim position:    OptimYear    LRPhase  PriorLRPosition     OptimPosition    LRPosition   5  2009    

Re: [R] Obtaining the value of x at a given value of y in a smooth.spline object

2009-08-12 Thread Greg Snow
A few functions that may help are splinefun or approxfun along with uniroot. From: Kavitha Venkatesan [kavitha.venkate...@gmail.com] Sent: Wednesday, August 12, 2009 3:43 PM To: Greg Snow Cc: r-help@r-project.org Subject: Re: [R] Obtaining the value of x at

Re: [R] Random sampling while keeping distribution of nearest neighbor distances constant.

2009-08-12 Thread Emmanuel Levy
> But if the 1st order differences are the same, then doesn't it follow that > the 2nd, 3rd, ... order differences must be the same between the original and > the new "random" vector.  What am I missing? You are missing nothing sorry, I wrote something wrong. What I would like to be preserved is

Re: [R] Random sampling while keeping distribution of nearest neighbor distances constant.

2009-08-12 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: Emmanuel Levy [mailto:emmanuel.l...@gmail.com] > Sent: Wednesday, August 12, 2009 4:48 PM > To: Nordlund, Dan (DSHS/RDA) > Cc: r-h...@stat.math.ethz.ch; dev djomson > Subject: Re: [R] Random sampling while keeping distribution of nearest > neighbor > distances

Re: [R] Simulating points from GLM corresponding to new x-values

2009-08-12 Thread Clifford Long
Hi Jacob, At the risk of embarrassing myself, I gave it a shot. I'll throw this out on the list, if for no other reason than perhaps someone with higher wattage than myself might tear it apart and give you something both useful and perhaps elegant (from an R coding standpoint). (see the followin

Re: [R] Random sampling while keeping distribution of nearest neighbor distances constant.

2009-08-12 Thread Emmanuel Levy
Dear Daniel, Thank a lot for your suggestion. It is helpful and got me thinking more about it so that I can rephrase it: Given a vector V containing X values, comprised within 1 and N. I'd like to sample values so that the *distribution* of distances between the X values is similar. There are se

Re: [R] Matrix Integral

2009-08-12 Thread Moshe Olshansky
Hi, Is your matrix K symmetric? If yes, there is an "analytical" solution. --- On Sat, 1/8/09, nhawrylyshyn wrote: > From: nhawrylyshyn > Subject: [R] Matrix Integral > To: r-help@r-project.org > Received: Saturday, 1 August, 2009, 12:15 AM > > Hi, > > Any help on this would be appreciated:

Re: [R] Random sampling while keeping distribution of nearest ne

2009-08-12 Thread Emmanuel Levy
Thanks for your suggestion Ted, This would indeed work for the particular example I gave, but I am looking for a general solution. For example, if my values are: V=c(2,4,5,6) Then there would be two possibilities: 2,4,5,6 or 4,5,6,8 more generally, what I mean is that the matrix of distances betw

Re: [R] Games in R

2009-08-12 Thread Ronggui Huang
Hi, another package can be found here http://r-forge.r-project.org/projects/fun/ 2009/8/13 Bjørn Arild Mæland : > Hi, > > There's a couple of games listed on crantastic: > http://crantastic.org/tags/games > > -Bjorn > > 2009/8/12 David Croll : >> Hi everybody - this is an oddball question. >> >>

Re: [R] Random sampling while keeping distribution of nearest neighbor distances constant.

2009-08-12 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Emmanuel Levy > Sent: Wednesday, August 12, 2009 3:05 PM > To: r-h...@stat.math.ethz.ch > Cc: dev djomson > Subject: [R] Random sampling while keeping distribution of nearest neigh

Re: [R] metaplot in rmeta: y-axis disappears

2009-08-12 Thread David Scott
Roaman wrote: Thank you, the x-axis includes zero, but even, when I try to plot it not including zero, the y-axis kepps disappearing. One can't even add the axis afterwards! Here is an example: library(rmeta) set.seed(123) # simulated data: theta <- 0.5 sds <- runif(50,0.8,8) b <

[R] Random sampling while keeping distribution of nearest neighbor distances constant.

2009-08-12 Thread Emmanuel Levy
Dear All,(my apologies if it got posted twice, it seems it didn't get through) I cannot find a solution to the following problem although I suppose this is a classic. I have a vector V of X=length(V) values comprised between 1 and N. I would like to get random samples of X values also compri

Re: [R] Random sampling while keeping distribution of nearest ne

2009-08-12 Thread Ted Harding
On 12-Aug-09 22:05:24, Emmanuel Levy wrote: > Dear All, > I cannot find a solution to the following problem although I imagine > that it is a classic, hence my email. > > I have a vector V of X values comprised between 1 and N. > > I would like to get random samples of X values also comprised bet

[R] Plotting sigma symbol with unicode and turning into pdf

2009-08-12 Thread Jonathan R. Blaufuss
Paul, You solution worked out really well when I ran my code in R. However, when I try to turn the plot into a pdf, the unicode string no longer seems to function and instead of the sigma symbol there are just two periods (See example code below). The following is the code working in the R en

Re: [R] Another Plotting Hint - changing fill color for points

2009-08-12 Thread Jason Rupert
This worked great. Regarding the second question - can you expound a bit more on the effect of the device? Right now, as shown by the test code because I am on a Windows machine and need to import the image to Word I am using WMF. Is there a better device that I should use that will help wi

[R] Random sampling while keeping distribution of nearest neighbor distances constant.

2009-08-12 Thread Emmanuel Levy
Dear All, I cannot find a solution to the following problem although I imagine that it is a classic, hence my email. I have a vector V of X values comprised between 1 and N. I would like to get random samples of X values also comprised between 1 and N, but the important point is: * I would like

Re: [R] Another Plotting Hint - changing fill color for points

2009-08-12 Thread Sarah Goslee
Yes, you can do that. You need to specify pch in the range of 21-25, and can then specify both col and bg (background color). Oddly, the help for this option is under ?points rather than ?par or ?pch, but there are many examples. Your second question would depend heavily on the device you use and

[R] psi not functioning in nlrob?

2009-08-12 Thread Xiao Xiao
Hi all, I'm trying to fit a nonlinear regression by "nlrob": model3=nlrob(y~a1*x^a2,data=transient,psi=psi.bisquare, start=list(a1=0.02,a2=0.7),maxit=1000) However an error message keeps popping up saying that the function psi.bisquare doesn't exist. I also tried psi.huber, which is supposed t

Re: [R] Obtaining the value of x at a given value of y in a smooth.spline object

2009-08-12 Thread Kavitha Venkatesan
I do want a programmatic solution. I was thinking of the linear interpolation based on the 2 y-values bracketing the given y as well, I think I will pursue this. Thanks a lot for your suggestion, Kavitha On Wed, Aug 12, 2009 at 4:25 PM, Greg Snow wrote: > Part of the problem is that there could i

Re: [R] Using bold font with bquote

2009-08-12 Thread Paul Murrell
Hi Jonathan R. Blaufuss wrote: Scott, Your suggestion works great for changing the numbers to bold font, but is it possible to change the sigma symbol and the equals sign to bold font as well? I've poked around ?plotmath and am I right in saying that there is a different method for controlling s

Re: [R] Nominal variables in SVM?

2009-08-12 Thread Erik Iverson
This is where a small, reproducible example will definitely help us discover your problem. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Noah Silverman Sent: Wednesday, August 12, 2009 4:29 PM To: Achim Zeileis Cc: r help Subjec

[R] Another Plotting Hint - changing fill color for points

2009-08-12 Thread Jason Rupert
Is it possible to change the fill color of a point? For example, the outer color being "Blue" and inner color being "Grey". I've tried changing "col" and "bg", but that does not seem to have the desired effect. Below is another attempt, but the pixel resolution of the points function does n

Re: [R] Combinatorial problem

2009-08-12 Thread David Scott
Bernd Bischl wrote: Dimitris Rizopoulos wrote: you could try something like the following: groups <- list(gp1 = 1:3, gp2 = 4:5, gp3 = 6:7, gp4 = 8:10, gp5 = 11) combn(5, 2, function (x) expand.grid(groups[x]), simplify = FALSE) combn(5, 3, function (x) expand.grid(groups[x]), si

Re: [R] Nominal variables in SVM?

2009-08-12 Thread Noah Silverman
OR, as Steve suggested in a previous post, would it make more sense in training an SVM to convert a single nominal column into a series of binary columns? " color = ("red, "blue", "green") So, imagine if the features for your examples were color and height, your "feature matrix" for N exam

Re: [R] Nominal variables in SVM?

2009-08-12 Thread Noah Silverman
Thanks for all the suggestions. My data was loaded in from a csv file with about 80 columns (3 of these columns are nominal) no specific settings for the nominal columns. Currently, if I call svm (e1071), I get an error about the nominal column. Do I need to tell R to change the column to a fa

Re: [R] Nominal variables in SVM?

2009-08-12 Thread Achim Zeileis
On Wed, 12 Aug 2009, Noah Silverman wrote: Hi, The answers to my previous question about nominal variables has lead me to a more important question. What is the "best practice" way to feed nominal variable to an SVM. As some of the previous posters have already indicated: The data structur

Re: [R] problem loading ncdf library on MAC

2009-08-12 Thread Dan Kelley
Right. I have udunits2 installed, but that's not enough. It seems to want udunits, instead, even though the latter is deprecated. I downloaded the older package from http://www.unidata.ucar.edu/downloads/udunits/index.jsp but it does not compile, e.g. ../port/cfortran/cfortran.h:133:3: e

Re: [R] Nominal variables in SVM?

2009-08-12 Thread Erik Iverson
Noah, depending on what function you use, it might do this automatically for you if you give the function a formula containing a factor. Otherwise, see ?model.matrix. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Noah Silverm

Re: [R] Nominal variables in SVM?

2009-08-12 Thread Bernd Bischl
Noah Silverman wrote: That makes sense. I my data is already nominal, I need to "expand" a single column into several binary ones. Is there an easy function to do this in R, or do I need to create something from scratch? (If I have to create my own, any suggestions?) Thanks! -N Hi Noah,

Re: [R] Plotting Hints - how to add minor tics on axes

2009-08-12 Thread Gavin Simpson
On Wed, 2009-08-12 at 11:51 -0700, Jason Rupert wrote: > Using the standard plotting routine in R, i.e. no special packages, is > there a way to add in minor tics to the axes? > > Also, is there a way to make sure the major axes labels are at the > origin? When I'm looking at a plot, the major

Re: [R] Nominal variables in SVM?

2009-08-12 Thread Noah Silverman
That makes sense. I my data is already nominal, I need to "expand" a single column into several binary ones. Is there an easy function to do this in R, or do I need to create something from scratch? (If I have to create my own, any suggestions?) Thanks! -N On 8/12/09 1:55 PM, Steve Liano

Re: [R] nominal to numeric function

2009-08-12 Thread Daniel Malter
foo <- c("blue", "red", "green") foo=as.factor(foo) foo=as.numeric(as.character(foo)) foo #the numeric ordering is alphabetic hth, daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-

Re: [R] Nominal variables in SVM?

2009-08-12 Thread Steve Lianoglou
Hi, On Aug 12, 2009, at 2:53 PM, Noah Silverman wrote: Hi, The answers to my previous question about nominal variables has lead me to a more important question. What is the "best practice" way to feed nominal variable to an SVM. For example: color = ("red, "blue", "green") I could transl

Re: [R] Plotting Hints - how to add minor tics on axes

2009-08-12 Thread Greg Snow
You can use the axis function to add tick marks and labels at specified positions (including whatever origin you want to use). If you add shorter tick marks without labels, then they are minor ticks (usually you will suppress the default axes using axes=FALSE or xaxt/yaxt='n', then use the axis

Re: [R] Simulating points from GLM corresponding to new x-values

2009-08-12 Thread Jacob Nabe-Nielsen
Hi Cliff -- thanks for the suggestion. I tried extracting the predicted mean and standard error using predict(). Afterwards I simulated the dependent variable using rnorm(), with mean and standard deviation taken from the predict() function (sd = sqrt(n)*se). The points obtained this way we

[R] Nominal variables in SVM?

2009-08-12 Thread Noah Silverman
Hi, The answers to my previous question about nominal variables has lead me to a more important question. What is the "best practice" way to feed nominal variable to an SVM. For example: color = ("red, "blue", "green") I could translate that into an index so I wind up with color= (1,2,3) Bu

[R] Plotting Hints - how to add minor tics on axes

2009-08-12 Thread Jason Rupert
Using the standard plotting routine in R, i.e. no special packages, is there a way to add in minor tics to the axes? Also, is there a way to make sure the major axes labels are at the origin? When I'm looking at a plot, the major axes labels are present, but it looks like they start a bit aw

Re: [R] Games in R

2009-08-12 Thread Greg Snow
Well there is the sudoku package on CRAN, but sorry it does not play tic-tac-toe or simulate flight. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-hel

Re: [R] Obtaining the value of x at a given value of y in a smooth.spline object

2009-08-12 Thread Greg Snow
Part of the problem is that there could in theory be multiple x values that result in the same y value. One approach if you are happy with something interactive rather than programatical is to use the TkSpline function in the TeachingDemos package to fit the spline function and drag the x-value

Re: [R] How to label and unlabel points on scatterplot with mouse pointer

2009-08-12 Thread Greg Snow
Here is one approach that works on Windows (but not other platforms): HWidentify <- function(x,y,label=seq_along(x), xlab=deparse(substitute(x)), ylab=deparse(substitute(y)), ...) { plot(x,y,xlab=xlab, ylab=ylab,...) dx <- grconvertX(x,to='ndc')

Re: [R] Games in R

2009-08-12 Thread Bjørn Arild Mæland
Hi, There's a couple of games listed on crantastic: http://crantastic.org/tags/games -Bjorn 2009/8/12 David Croll : > Hi everybody - this is an oddball question. > > > I wonder if anybody has programmed any games in R, such as Sudoku, > Tic-Tac-Toe and the like. Or even a flight simulator... > >

Re: [R] problem loading ncdf library on MAC

2009-08-12 Thread Steve Lianoglou
Hi, On Aug 12, 2009, at 2:23 PM, Dan Kelley wrote: I think ncdf is broken now, and so is Rnetcdf. I can't build from source, either. If I find a solution, I'll post it here. FYI, I have an intel-based Mac running the latest OS and with R 2.9.1 While I haven't compiled it myself, it seems

[R] Attached file following download failure

2009-08-12 Thread Fowler, Mark
Hello, I'm working with a package that uses download.file in functions to extract information from remote databases. My current environment is Windows XP Pro SP3, R 2.7. A full extraction can be a great deal of data, so the download is accomplished in generally manageable packets, such that a sin

[R] biOps load problem

2009-08-12 Thread Jonathan Lees
I am trying to install and use the biOps package on my x86_64 GNU/Linux ssytem. I have installed the fftw-3.2.2.tar.gz and biOps_0.2.1.tar.gz but when I start R and try to load the library, I get this message: ## > library(biOps) Error in dyn.load(file, DL

Re: [R] Map of UK Counties - to use in R

2009-08-12 Thread Hisaji ONO
Hello. shapefiles in geographic coordinates for Epi Info http://www.cdc.gov/epiinfo/europe.htm second-level at 1998, free available but not public domain Regards. --- Roger Bivand wrote: > > The illustration you show is for the so-called > traditional or historical > counties of Engla

Re: [R] Using bold font with bquote

2009-08-12 Thread Jonathan R. Blaufuss
Scott, Your suggestion works great for changing the numbers to bold font, but is it possible to change the sigma symbol and the equals sign to bold font as well? I've poked around ?plotmath and am I right in saying that there is a different method for controlling symbol fonts? Thank you for

Re: [R] problem loading ncdf library on MAC

2009-08-12 Thread Dan Kelley
I think ncdf is broken now, and so is Rnetcdf. I can't build from source, either. If I find a solution, I'll post it here. FYI, I have an intel-based Mac running the latest OS and with R 2.9.1 -- View this message in context: http://www.nabble.com/problem-loading-ncdf-library-on-MAC-tp2319519

[R] Games in R

2009-08-12 Thread David Croll
Hi everybody - this is an oddball question. I wonder if anybody has programmed any games in R, such as Sudoku, Tic-Tac-Toe and the like. Or even a flight simulator... R mateys! Let's make some t-tests! Regards, David __ R-help@r-project.org mail

Re: [R] nominal to numeric function

2009-08-12 Thread Dimitris Rizopoulos
another approach may be: foo <- c("blue", "red", "green") s.foo <- sample(foo, 20, TRUE) s.foo match(s.foo, foo) I hope it helps. Best, Dimitris Noah Silverman wrote: Hi, Thanks for the tip, Neither method works as my data is truly nominal - foo <- c("

Re: [R] nominal to numeric function

2009-08-12 Thread Noah Silverman
Hi, Thanks for the tip, Neither method works as my data is truly nominal - foo <- c("blue", "red", "green") as.numeric(foo) [1] NA NA NA Warning message: NAs introduced by coercion Rapid Miner has a function that will aut

Re: [R] Using bold font with bquote

2009-08-12 Thread Scott Sherrill-Mix
>From ?plotmath, it looks like when using expressions you set the font inside the expression (e.g. bold(x)). It looks you tried this already but I wonder if there was something tiny out of place since the following works for me: text(25000,0.3,bquote(bold(sigma==.(mySigma)),list('mySigma'=form

Re: [R] R numeric string problem

2009-08-12 Thread Bert Gunter
You need to read up about finite precision arithmetic and floating point representation. In brief, note that 2^64 requires 20 decimal digits, and some bits in double precision must be given up to sign, exponent, etc. leaving 53 bits for precision = 16 decimal digits. This is exactly the number of d

[R] Obtaining the value of x at a given value of y in a smooth.spline object

2009-08-12 Thread Kavitha Venkatesan
I have some data fit to a smooth.spline object as follows: (x=vector of data for the predictor variable, y=vector of data for the response variable) fit <- smooth.spline(x,y) Now, given a spline fit point y_new, I want to be able to find out what value of x_new yielded this fit value. How to do s

Re: [R] Map of UK Counties - to use in R

2009-08-12 Thread Roger Bivand
The illustration you show is for the so-called traditional or historical counties of England, which may be available somewhere. There are non-georeferenced PNG files on Wikipedia, which might be used, but as far as I can see, only UK-based academics can register for access to the edina UK borders

Re: [R] R numeric string problem

2009-08-12 Thread Henrique Dallazuanna
Use colClasses argument in read.table to set the class of column: For a file with two columns, where the first is string and the other is numeric: read.table('your_file.dat', colClasses = c('character', 'numeric')) On Wed, Aug 12, 2009 at 1:43 PM, Andrew C wrote: > > Hi, > > I have a text (.da

[R] R numeric string problem

2009-08-12 Thread Andrew C
Hi, I have a text (.dat) file, in which each row contains several long numeric strings. One of the strings is 38 digits long, for example: 03200801200801172008011720092904008901 When I read in the data file, this string shows up as 3.200801e+36. To get rid of the scientific notation, I used "

Re: [R] paste first row string onto every string in column

2009-08-12 Thread Jill Hollenbach
Thanks so much everybody, this has been incredibly helpful--not only is my immediate issue solved but I've learned a lot in the process. The lapply solution is best for me, as I need flexibility to edit df's with varying numbers of columns. Now, one more question: after appending the string from

Re: [R] getting dates from a ts object

2009-08-12 Thread Gabor Grothendieck
time(obj) gives the times of a ts object, obj. On Wed, Aug 12, 2009 at 12:51 PM, Data Analytics Corp. wrote: > Hi, > > I have a ts object called data.gas that has three economic variables: > gasoline consumption (gas), price per gallon (price), and household income > (income) by month from January

[R] getting dates from a ts object

2009-08-12 Thread Data Analytics Corp.
Hi, I have a ts object called data.gas that has three economic variables: gasoline consumption (gas), price per gallon (price), and household income (income) by month from January 1970 to December 2008. I want to plot this gas and price variables using ggplot2, but ggplot2 will not allow an

[R] Using bold font with bquote

2009-08-12 Thread Jonathan R. Blaufuss
I'm trying to annotate a density plot and I'm using bquote to paste the sigma symbol next to the numeric text of the standard deviation calculation that I am performing. I have been able to successfully turn the sigma symbol and numeric output the color blue, but when I try to change the font of

Re: [R] Superscripts in axis label

2009-08-12 Thread Eik Vettorazzi
oops, there was a little problem with an automated text replacement in my last post. m^3 should be read as m ^ 3 (without white space). or, using curly brackets for safety, try plot(1,ylab=expression("Soil moisture content"~~bgroup("(",m^{3}*m^{-3},")"))) hth. Buckmaster, Sarah schrieb: Than

Re: [R] nominal to numeric function

2009-08-12 Thread Phil Spector
It's generally safer to use as.numeric(as.character(variablename)) since it eliminates problems associated with factors. - Phil Spector Statistical Computing Facility

Re: [R] nominal to numeric function

2009-08-12 Thread Daniel Malter
Hi you can use newvariable=as.numeric(variablename). This converts your factors into numeric variables, but not always with the desired result. So make sure that you check whether "newvariable" gives you what you want. Otherwise recoding by hand is indicated. Best, Daniel Noah Silverman-3 wrot

Re: [R] inserting into data frame gives "invalid factor level, NAs generated"

2009-08-12 Thread Scott Sherrill-Mix
Your running into the pretty common factor vs character problem in R. By default data.frame turns character vectors into factor (sort of like ENUM in mysql) vectors. Since you only have 1 factor (empty string '') in your starting dataframe, when you go to insert new data R sees a new value and comp

Re: [R] paste first row string onto every string in column

2009-08-12 Thread Don MacQueen
Let's start with something simple and relatively easy to understand, since you're new to this. First, here's an example of the core of the idea: paste('a',1:4) [1] "a 1" "a 2" "a 3" "a 4" Make it a little closer to your situation: paste('a*',1:4, sep='') [1] "a*1" "a*2" "a*3" "a*4" Somet

[R] inserting into data frame gives "invalid factor level, NAs generated"

2009-08-12 Thread karinlag
I am calculating some values that I am inserting into a data frame. From what I have read, creating the dataframe ahead of time is more efficient, since rbind (so far the only solution I have found to appending to a data frame) is not very fast. What I am doing is the following: # create data fra

Re: [R] C-statistic comparison with partially paired datasets

2009-08-12 Thread Hanneke Wijnhoven
Frank, Thank you for your quick response! I want to compare the discriminative capacity of different anthropometric measures in predicting mortality, focussing on the "thin" site of these measures. Since these associations are not linear (U shaped for BMI and inversily J-shaped for mid-upper

[R] Generating logistic regression data for specific ORs

2009-08-12 Thread Denis Aydin
Dear R-users I want to generate data for a logistic regression for an epidemiological simulation. First, I created a "disease-vector" containing a "1" if a subject is a cases (i.e. has the disease) and a "0" if a subject is a control. E.g.: > disease <- as.factor( c(rep(1, n.cases), rep(0,

Re: [R] Superscripts in axis label

2009-08-12 Thread Eik Vettorazzi
Hi Sarah, expression works well, but you have to use it as function. plot(1,ylab=expression("Soil moisture content "~~bgroup("(",m^3*m^{-3},")"))) see ?plotmath for further examples hth. Buckmaster, Sarah schrieb: Hi All, I am trying to lable the y-axis on my scatterplot with the following

Re: [R] axis scale

2009-08-12 Thread Don MacQueen
Without a short reproducible example your question is difficult to understand, and difficult to give a useful answer. See comments below. -Don At 7:13 AM -0700 8/12/09, maram salem wrote: Dear All, I'm trying to plot a histogram (with the relative frequencies as the Y axis), But the scale of

[R] Help for R (Advanced matrix addition (large or undefined number of matrices)

2009-08-12 Thread Lina Rusyte
Dear Sirs,   I would like to ask you, what function can I use for matrices addition? I couldn’t find any information about it in the manual or in the internet. (A+B suits, when the number of matrixes is small, function sum() doesn’t suit for matrices addition, because it sums all variables i

Re: [R] SystemFit

2009-08-12 Thread Arne Henningsen
Hi Ferdogan, Sorry for the late response. On Thu, Jul 23, 2009 at 8:29 AM, Ferdogan wrote: > I have two products which are substitudes. I try to fix a system as below to > mydata. > > Demand1 = A1 -B1*Price1 + C1*Price2 > Demand2 = A2 +B2*Price1 - C2*Price2 > > I would expect C1 & B2 to be symmet

Re: [R] Symbolic references - passing variable names into functions

2009-08-12 Thread Gabor Grothendieck
Returning the changed value as in Erik's answer is probably the most common and R-like solution but here are two others. The assign/get approach is perhaps the closest to what you are asking for. # replacement function approach # replacement function - rhs is formula whose response is assigned t

Re: [R] CCF for hourly time series?

2009-08-12 Thread Katharina Appel
Hi Andreas, thank you for replying so soon. You are right, your code works perfectly for my example. Unfortunately, the real data contains inner NAs, which I forgot to include. Sorry about that. Any other suggestions? Thanks, Katharina Original-Nachricht > Datum: Wed, 12 Aug 20

Re: [R] ggplot2: override facet names in facet_wrap?

2009-08-12 Thread hadley wickham
That's on the to do list :( Hadley On Tue, Aug 11, 2009 at 10:00 PM, Ben Bolker wrote: > > >  Thanks.  I can get it to work for facet_grid (which will do for my current > purposes) but am curious about whether there's a way to do the same > for facet_wrap (which doesn't have a "labeller" argument)

[R] Superscripts in axis label

2009-08-12 Thread Buckmaster, Sarah
Hi All, I am trying to lable the y-axis on my scatterplot with the following: "Soil moisture content (m3m-3)" I am using the following coding for plotting the graph: plot(soilmoisture~gradientlevel, xlab="Levels of droughting gradient", ylab="Soil moisture content (m3m-3)", bty="l", font.main="2

[R] Re : Re : Zoo and numeric data

2009-08-12 Thread Inchallah Yarab
Thank you Gavin very much for this explication!!! inchallah yarab De : Gavin Simpson Cc : r-help@r-project.org Envoyé le : Mercredi, 12 Août 2009, 14h50mn 37s Objet : Re: [R] Re : Zoo and numeric data On Wed, 2009-08-12 at 10:03 +, Inchallah Yarab wro

Re: [R] Symbolic references - passing variable names into functions

2009-08-12 Thread Erik Iverson
I think ONE answer to what you actually want to do might be f <- function(dataf, col1 = "column1", col2 = "column2") { dataf[[col1]] <- dataf[[col2]] # just as an example dataf } -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.o

Re: [R] paste first row string onto every string in column

2009-08-12 Thread Benilton Carvalho
you could stick everything in a 1-liner, but that would make it less readable: myf <- function(x){ tmp <- as.character(x) c(tmp[1], paste(tmp[1], tmp[-1], sep="")) } df2 <- as.data.frame(sapply(df, myf)) b On Aug 12, 2009, at 3:39 AM, milton ruser wrote: Hi Jill, Completely not elega

[R] Symbolic references - passing variable names into functions

2009-08-12 Thread Alexander Shenkin
Hello All, I am trying to write a function which would operate on columns of a dataframe specified in parameters passed to that function. f = function(dataf, col1 = "column1", col2 = "column2") { dataf$col1 = dataf$col2 # just as an example } The above, of course, does not work a

  1   2   >