Re: [R] Help with data.table

2017-02-28 Thread François Morneau
Hello, Not sure but have you consider using : expand.grid(E1, E2) that will create a data.frame of all combinations of your two vectors and then use it for your search. Best, François Le 01/03/2017 à 08:27, Evan Kransdorf a écrit : Hello, I need some help with data.table. I am trying to

[R] Help with data.table

2017-02-28 Thread Evan Kransdorf
Hello, I need some help with data.table. I am trying to use data.table to do a binary search of a large table using 2 keys. KEY1 KEY2 PARAM1 row1 1 2-0.031 row2 2 8 -0.456 row3 3 24-7.86 row4 5 2 2.89 I set the keys: #DT<-setke

Re: [R] Von Mises mixtures: mu and kappa?

2017-02-28 Thread Bert Gunter
If you believe that a fit to simulated data should give you parameter estimates identical to those used for the simulation, then I suggest that you stop posting and consult a local statistical expert: you don't know what you're doing. If I have misunderstood your post, then just ignore the above a

[R] plotly example that highlights a line

2017-02-28 Thread Roy Mendelssohn - NOAA Federal
Hi All: In searching online, I have found examples of using plotly with ggplot2 graphics, say using geom_line, where there are multiple lines and by selecting the "factor" in the legend makes the particular line disappear or reappear (see https://plot.ly/ggplot2/). I am wondering if anyone

Re: [R] Σχετ: plotting dates in x axis

2017-02-28 Thread Jim Lemon
Hi Maria, No problem. Taking the example I used before: aa<-data.frame(var1=runif(180), SDATE=paste(sample(1998:2012,180,TRUE), sample(1:12,180,TRUE),sample(1:28,180,TRUE),sep="-")) aa$sdate<-as.Date(aa$SDATE) plot(aa$sdate,aa$var1,xaxt="n") # set the tick marks at the middle of every other year

Re: [R] Novice users in need of urgent help with boxplots

2017-02-28 Thread David L Carlson
As Mark and Wray have indicated, you have not told us what you have actually tried other than search the internet. If you spent 3 days learning R and don't know how to import a .csv file from Excel, you should be emailing the instructor of the course. Use Save As in Excel to save your spreadshee

Re: [R] Optional arguments in stats::nls

2017-02-28 Thread Duncan Murdoch
On 28/02/2017 11:07 AM, Rytis Bagdziunas wrote: Hello everyone, I've been struggling with the usage of ellipsis argument for stats::nls and similar functions. In particular, nls manual indicates this: ...: Additional optional arguments. None are used at present. The documentation is incorrec

Re: [R] Novice users in need of urgent help with boxplots

2017-02-28 Thread Marc Schwartz
> On Feb 28, 2017, at 8:11 AM, Ashley Patton via R-help > wrote: > > > Hi, please forgive me but I am completely new to R and have no experience > with it other than a 3 day training course but I need to use it for an urgent > project and don't have time to learn a whole new language before

Re: [R] Novice users in need of urgent help with boxplots

2017-02-28 Thread WRAY NICHOLAS
The first thing you need to do is to read your data in. Convert your excel file to a csv file, say mydata.csv, and make sure that you know where it is eg folder "Datafile" on C drive. Then use setwd("C:/Datafile") and then read.csv("mydata.csv") That should upload it and you can trawl t'interne

[R] Optional arguments in stats::nls

2017-02-28 Thread Rytis Bagdziunas
Hello everyone, I've been struggling with the usage of ellipsis argument for stats::nls and similar functions. In particular, nls manual indicates this: ...: Additional optional arguments. None are used at present. However, "none are used" seems to be slightly misleading. Here's an example: d

[R] Novice users in need of urgent help with boxplots

2017-02-28 Thread Ashley Patton via R-help
Hi, please forgive me but I am completely new to R and have no experience with it other than a 3 day training course but I need to use it for an urgent project and don't have time to learn a whole new language before the deadline, although I hope to get there soon. My question is this. I have

Re: [R] How to speed this up?

2017-02-28 Thread Thierry Onkelinx
Dear Jen, Vectorisation is the keyword here. 250k sample takes only 2.5 seconds on my machine. 2.5 million takes 29 seconds. n <- 250e3 # country code cc <- "+212" # prefixes IAM <- c(610,611,613,615,616, 618,641,642,648,650,651,652,653,

[R] How to speed this up?

2017-02-28 Thread Jen
Hi, I'm trying to generate 2.5 million phone numbers. The code below generates a random sample of 250K MPNS for Morocco. It takes about 10 minutes. I need to generate 2.5 million. I've run it through once and it took about 45 hours. Is there a way to speed this up? Thanks, Jen # generate ra

Re: [R] Von Mises mixtures: mu and kappa?

2017-02-28 Thread Peter Mills
Thank you Bert for the references. I have found mix.vmf as a possible alternative to movMF but am stuck with applying either to my application. Does anyone know why mix.vmf requires to 2 columns for x? For example when I use: gWD <- c(0.1, 1, 0.9, 0.7,0.3) > mix.vmf(gWD, 2) I get the error: ‘Er

Re: [R] if and

2017-02-28 Thread David L Carlson
This is not a reproducible example. You did not even show us one of the scripts that apparently did work. None of your if() statements contains a logical expression. You should read "An Introduction to R" and probably other tutorials on R. https://cran.r-project.org/doc/manuals/r-release/R-intr

[R] Σχετ: Σχετ: Σχετ: plotting dates in x axis

2017-02-28 Thread Maria Lathouri via R-help
Hi Petr I followed your suggestion and I have attached a saved txt file with the data and the script using dput(). I hope this time will work.  But by the way your code worked as well.  Many thanks.  Kind regards,Maria Στις 1:06 μ.μ. Τρίτη, 28 Φεβρουαρίου 2017, ο/η PIKAL Petr έγραψε: H

Re: [R] Replace Text but not from within a word

2017-02-28 Thread Marc Schwartz
> On Feb 28, 2017, at 8:36 AM, Jeff Newmiller wrote: > > For tasks like this, you will probably want to make sure to import the data > as character data rather than as a factor. E.g. > > dat <- read.csv( "myfile.csv", header=FALSE, as.is=TRUE ) > > You can check what you have with the str()

Re: [R] Replace Text but not from within a word

2017-02-28 Thread Jeff Newmiller
For tasks like this, you will probably want to make sure to import the data as character data rather than as a factor. E.g. dat <- read.csv( "myfile.csv", header=FALSE, as.is=TRUE ) You can check what you have with the str() function. -- Sent from my phone. Please excuse my brevity. On Februa

Re: [R] R: How to prune using holdout data

2017-02-28 Thread Therneau, Terry M., Ph.D.
Let me give an outline of how to answer Alfredo's question via an example. I will split the data set "lung" into two peices. For these subjects with advanced lung cancer the physician's assessment of ECOG performance status (ph.ecog) is one of the most powerful indicators of outcome. Try to pred

Re: [R] Replace Text but not from within a word

2017-02-28 Thread Marc Schwartz
> On Feb 28, 2017, at 3:38 AM, Harshal Athawale > wrote: > > I am new in R. > > I have a file. This file contains name of the companies. > 'data.frame': 494 obs. of 1 variable: > $ V1: Factor w/ 470 levels "3-d engineering corp",..: 293 134 339 359 143 > 399 122 447 398 384 ... > > Problem:

[R] Replace Text but not from within a word

2017-02-28 Thread Harshal Athawale
I am new in R. I have a file. This file contains name of the companies. 'data.frame': 494 obs. of 1 variable: $ V1: Factor w/ 470 levels "3-d engineering corp",..: 293 134 339 359 143 399 122 447 398 384 ... Problem: I would like to remove "CO" (As it is the most frequent word). I would like "C

Re: [R] Σχετ: Σχετ: plotting dates in x axis

2017-02-28 Thread PIKAL Petr
Hi better to send us your data by copying result of dput() Based on Jims toy data, do you want something like that? plot(aa$sdate,aa$var1,xaxt="n") sel <- seq(1,15, 2) axis(1, at=axis.dates[sel], labels=format(axis.dates, "%Y")[sel]) You can easily adopt it by managing the sequention. Cheers P

Re: [R] Metafor multilevel metaregression: total variance increases when moderator added?

2017-02-28 Thread Viechtbauer Wolfgang (SP)
Very difficult to diagnose what is going on without actually seeing the data. But as I said on CV: Depending on the data, the variance components may not be estimated precisely, so negative values for those kinds of pseudo-R^2 statistics are quite possible. In fact, if a particular moderator is

[R] Σχετ: Σχετ: plotting dates in x axis

2017-02-28 Thread Maria Lathouri via R-help
Dear Jim Many thanks for this. I tried and it somehow worked. I removed the nlines=3 from your script so I can have the years in one line, but still the problem is that while trying to show all the years, there are years in the first line and then other years in a second line.  I was wondering i

[R] Σχετ: plotting dates in x axis

2017-02-28 Thread Maria Lathouri via R-help
Dear all, Sorry about that. My mistake. Here is an example of my data > head(aa)       SDATE  var11 1998-01-29 0.7282 1998-02-17 1.0803 1998-03-20 > 0.6374 1998-05-07 1.1205 1998-05-26 0.9036 1998-06-05 > 1.210.178 2012-10-4  0.71179 2012-11-4  0.663180 > 2012-12-10 0.484