Re: [R] Splitting columns and forming new data files in R

2014-04-11 Thread Zilefac Elvis
Great. Thanks AK. On Thursday, April 10, 2014 11:14 PM, arun smartpink...@yahoo.com wrote: Hi, Ok, In that case, change `lst1New`.  Also, in your files, there was no Sim column.  So, I changed the name. lst1New - lapply(lst1,function(x) {lst2 - setNames(lapply(x,function(y) {dat -

Re: [R] print(cenfit object) to a data.frame

2014-04-11 Thread Massimo Bressan
thanks rui, it helps indeed.. at first, I've been trying to data.frame the output of mean (mycenfit) by the following: my.df-as.data.frame(do.call(rbind, mean(mycenfit))) and it worked out correctly! ...but because I also needed the information about n and n.cen, which are not provided by

Re: [R] Mean of values in different files

2014-04-11 Thread arun
Hi, Try: dir.create(final) lst1 - split(list.files(pattern=.csv),gsub(\\_.*,,list.files(pattern=.csv))) lst2 - lapply(lst1,function(x1) lapply(x1, function(x2) {lines1 - readLines(x2); header1 - lines1[1:2]; dat1 - read.table(text=lines1,header=FALSE,sep=,,stringsAsFactors=FALSE, skip=2);

[R] General Copula theory

2014-04-11 Thread Chris89
Hi everyone! Firstly, let me specify that I an new to copula theory, so be gentle! I have two data sets containing wind data for 14 years, and I am to use Gumbel marginals and a Gumbel copula. The question is, how will I generate data from the marginals? I have 14 years of data (4

[R] Variable names in plotCI

2014-04-11 Thread Mª Teresa Martinez Soriano
Hello to everyone, I would like to put the variable names in the x-axis of this plot instead of number 1:63: plotCI(1:num_col_comp,med,2.06*des/sqrt(n),lwd=1,col=red,scol=seashell4,main=Intervalo de confianza,xlab=Variables clínicas,ylab=Intervalo de confianza)abline(h=0,

Re: [R] how to select an element from a vector based on a probability

2014-04-11 Thread Simone Gabbriellini
Dear Frede, the initial question was to find probability proportional to the values, so Rui, Dan and Boris are right... I think I will go for Boris' solution... best regards, Simone 2014-04-11 7:29 GMT+02:00 Frede Aakmann Tøgersen fr...@vestas.com: I think you have calculated the wrong

Re: [R] Variable names in plotCI

2014-04-11 Thread Pascal Oettli
Hello, When posting, you are asked to provide a reproducible code (including packages you are using) and to not post in HTML. The following might help: library(plotrix) y-runif(10) err-runif(10) plotCI(1:10,y,err,main=Basic plotCI,xaxt='n',xlab='') axis(1,1:10,LETTERS[1:10]) Regards, Pascal

Re: [R] Variable names in plotCI

2014-04-11 Thread Jim Lemon
On 04/11/2014 07:59 PM, Mª Teresa Martinez Soriano wrote: Hello to everyone, I would like to put the variable names in the x-axis of this plot instead of number 1:63: plotCI(1:num_col_comp,med,2.06*des/sqrt(n),lwd=1,col=red,scol=seashell4,main=Intervalo de confianza,xlab=Variables

Re: [R] Meta-analysis of prevalence at the country level with mgcv/gamm4

2014-04-11 Thread Michael Dewey
At 13:17 10/04/2014, Julien Riou wrote: Message: 11 Date: Wed, 09 Apr 2014 18:39:30 +0100 From: Michael Dewey i...@aghmed.fsnet.co.uk To: Julien Riou julien.rio...@gmail.com, r-help@r-project.org Subject: Re: [R] Meta-analysis of prevalence at the country level with mgcv/gamm4

[R] weights error in svyglm

2014-04-11 Thread Lee, Laura
Hi! I am just learning the 'svyglm' package and have run into an error for which I have not found a solution. My data have been collected from a stratified random survey. Here is the code: NB3-glm.nb(COLNUM~Year+Depth+MESH+offset(LogEffort),data=data) dstrat - svydesign(id=~1, strata=~STRATA,

[R] grabbing GIS data from www

2014-04-11 Thread Milan Cisty
Dear list, When I have this WWW page: http://194.160.88.35:8008/geoexplorer/composer/#maps/1 in which you can select button Identify and then when you click on some color dot in map, you see data for that point. Is it possible by means of R to grab that data together with points coordinates by

Re: [R] Concave hull

2014-04-11 Thread davide.viggiano
Hi, I just want to add a possible solution to the problem in the special case all the points must stay on the edge of the outline. THis is sometimes the case when doing image analysis and you want to order the points along a closed path. In this specific case, you can use some algorithm like the

[R] operating website through R

2014-04-11 Thread eliza botto
Dear Users of R, I wanted to operate certain slots of this website (http://disc2.nascom.nasa.gov/Giovanni/tovas/TRMM_V7.3B42_daily.2.shtml) through R. I wanted to operate Latitude, longitude section, plot type, begin and end year and ASCII Output Resolution. The filling of these slot will

Re: [R] operating website through R

2014-04-11 Thread Suzen, Mehmet
You just need to pass the parameters on Giovanni_cgi.pl with action=ASCII+Output On 11 April 2014 17:19, eliza botto eliza_bo...@hotmail.com wrote: Dear Users of R, I wanted to operate certain slots of this website (http://disc2.nascom.nasa.gov/Giovanni/tovas/TRMM_V7.3B42_daily.2.shtml)

Re: [R] weights error in svyglm

2014-04-11 Thread Milan Bouchet-Valat
Le vendredi 11 avril 2014 à 13:38 +, Lee, Laura a écrit : Hi! I am just learning the 'svyglm' package and have run into an error for which I have not found a solution. My data have been collected from a stratified random survey. Here is the code:

[R] StatET and R 3.1.0

2014-04-11 Thread Jonathan Greenberg
R-helpers: I posted a message to the statet listserv, but I thought I'd ask here as well since it is one of the major R developer environments-- has anyone gotten the StatET plugin for Eclipse working with R 3.1.0 yet? Any tricks? I did manage to get rj updated to 2.0 via:

Re: [R] operating website through R

2014-04-11 Thread eliza botto
Dear Suzen, I couldn't understand. Could you please elaborate it with a small example? :( Thanks in advance. Eliza Date: Fri, 11 Apr 2014 17:31:18 +0200 Subject: Re: [R] operating website through R From: msu...@gmail.com To: eliza_bo...@hotmail.com CC: r-help@r-project.org You just need

[R] sink() and UTF-8 on non-UTF-8 systems

2014-04-11 Thread Milan Bouchet-Valat
Hi! In the series dealing with encoding madness on hostile systems, I'm looking for help as regards capturing R UTF-8 output on a system where the locale is not using UTF-8, and where some characters cannot even be represented using the locale encoding. The case I have in mind is printing a

Re: [R] weights error in svyglm

2014-04-11 Thread Lee, Laura
Thanks! That worked. However, what error distribution is assumed? I was hoping to use a negative binomial. -Original Message- From: Milan Bouchet-Valat [mailto:nalimi...@club.fr] Sent: Friday, April 11, 2014 11:37 AM To: Lee, Laura Cc: r-help@r-project.org Subject: Re: [R] weights error

Re: [R] Mean not working in function

2014-04-11 Thread arun
Hi, Try: mysummary - function(dataf){ for(name in names(dataf)){ cat (Variable name: , name, : Mean=, mean(dataf[,name],na.rm=TRUE),\n) } }  ##Using some example data: set.seed(48) dat1 - as.data.frame(matrix(sample(c(NA,1:20),4*20,replace=TRUE),ncol=4)) mysummary(dat1) #Variable name: V1 :

[R] R 3.0.3, Windows 7: Problem installing XML package

2014-04-11 Thread Alpesh Pandya
Using install.package('XML') command produces this error: trying URL ' http://watson.nci.nih.gov/cran_mirror/bin/windows/contrib/3.0/XML_3.98-1.1.zip ' Content type 'application/zip' length 4288136 bytes (4.1 Mb) opened URL downloaded 4.1 Mb Error in read.dcf(file.path(pkgname, DESCRIPTION),

Re: [R] weights error in svyglm

2014-04-11 Thread Milan Bouchet-Valat
Le vendredi 11 avril 2014 à 15:54 +, Lee, Laura a écrit : Thanks! That worked. However, what error distribution is assumed? I was hoping to use a negative binomial. Since svyglm() computes designed-based standard errors, you should be able to simply pass family=poisson instead. See

[R] calling in inverted commas

2014-04-11 Thread eliza botto
Dear useRs, Here are three steps for downloading a file from a certain website in R. Here you see that in URL command (west=68.25north=24.75east=68.25south=24.75) are actually the first and second column values of 1st row of a matrix called df2 (300 rows and 2 columns). more precisely,

[R] partitioning around medoids

2014-04-11 Thread Tomassini, Letizia
Hello I am running some k-medoids analysis to see if that algorithm will work better on my dataset compared to the k-means I have been using so far. When running k-means I used to specify the nstart option, equal to a certain number, depending on how many random sets of clusters I wanted. Could

[R] Save file as Fixed Width using sprintf()

2014-04-11 Thread Doran, Harold
I have working code to write a file out as fwf as shown below. I have one question to try and automate this I cannot get to work. I am generating thousands of data files for a simulation to be run outside of R and each file varies in its dimensions. So I am trying to write code that can write

Re: [R] Save file as Fixed Width using sprintf()

2014-04-11 Thread arun
Hi, May be this helps: xx - paste(aa, collapse=' ') set.seed(14) myMat - matrix(rnorm(9), 3,3) sprintf(xx,myMat[,1],myMat[,2],myMat[,3]) # [1] -0.661850 1.497154 -0.064881 # 1.718954 -0.036141 1.068994 # [3] 2.121667 1.231945 -0.376965 do.call(sprintf,c(xx,split(myMat,col(myMat #[1]

Re: [R] Save file as Fixed Width using sprintf()

2014-04-11 Thread jim holtman
Try this. It creates a 'list' that are the parameters for sprintf. It writes out the file that I attach as the dump: ### Create a sample data matrix myMat - matrix(rnorm(9), 3,3) # create the format required -- make sure it is wide enough # for 'fixed' width xx - paste(rep(%8.2f, ncol(myMat)),

[R] adding a frequency variable to a data frame

2014-04-11 Thread Michael Friendly
I'm sure this is pretty simple, but it's Friday afternoon, and I just don't see it... In a data frame with a categorical/character factor, I want to add another column giving, for each observation, the frequency of that factor level. An example, where the variable of interest is family:

Re: [R] adding a frequency variable to a data frame

2014-04-11 Thread Andrija Djurovic
Hi. Here is one solution: table(Donner$family)[Donner$family] Andrija On Fri, Apr 11, 2014 at 10:40 PM, Michael Friendly frien...@yorku.cawrote: I'm sure this is pretty simple, but it's Friday afternoon, and I just don't see it... In a data frame with a categorical/character factor, I

Re: [R] adding a frequency variable to a data frame

2014-04-11 Thread Andrija Djurovic
another: ave(as.numeric(Donner$family), Donner$family, FUN=length) On Fri, Apr 11, 2014 at 10:51 PM, Andrija Djurovic djandr...@gmail.comwrote: Hi. Here is one solution: table(Donner$family)[Donner$family] Andrija On Fri, Apr 11, 2014 at 10:40 PM, Michael Friendly

[R] R, RStudio, and a server for my iPad.

2014-04-11 Thread John Sorkin
I bemoan the fact that I can not run R or Rstudio on my iPad. A possible work around would be to set up a server (probably under Linux), and get the server to present a web page that to would allow me to run R on the server. I have searched the web for a clear, simple answer on how to do this

Re: [R] R, RStudio, and a server for my iPad.

2014-04-11 Thread Steve Lianoglou
Hi, On Fri, Apr 11, 2014 at 2:00 PM, John Sorkin jsor...@grecc.umaryland.edu wrote: I bemoan the fact that I can not run R or Rstudio on my iPad. I feel like this is something I'm not missing much, at all, but different strokes ... :-) A possible work around would be to set up a server

Re: [R] adding a frequency variable to a data frame

2014-04-11 Thread Michael Friendly
Bingo! That's exactly the idiom I was looking for. Thanks, Andrija. -Michael On 4/11/2014 4:57 PM, Andrija Djurovic wrote: another: ave(as.numeric(Donner$family), Donner$family, FUN=length) -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. Chair,

Re: [R] R, RStudio, and a server for my iPad.

2014-04-11 Thread John Sorkin
Steve, Thank you for your help. I have seen the material you have sent me to, but do not fully understand it. Do I have to build a linux server first? If so does it have to run Apache or some other web server? Is RStudio server run under Apache, if so how? On the other hand, do I simply need a

Re: [R] R, RStudio, and a server for my iPad.

2014-04-11 Thread Steve Lianoglou
I see. You might indeed be over thinking it ... since everything is installable by the package manager for the flavor of linux you choose, it should actually be relatively straightfoward (although if this is your first time setting up a linux box, it can take a few tries). I'll assume you are

Re: [R] R, RStudio, and a server for my iPad.

2014-04-11 Thread Hadley Wickham
Even if you do get Rstudio running on a server, unfortunately it won't help. The ipad doesn't support quite enough html to get a fully functional Rstudio interface - almost everything works but you can't type anything :/ It would be possible to fix this, but fundamentally we don't believe that

Re: [R] R, RStudio, and a server for my iPad.

2014-04-11 Thread John Sorkin
Steve, Are you suggesting that all I need to is build a Linux box (easily done, I have done many) and them simply use the package manager to install RStudio server? This would mean I don't need to build an Apache Server with a LAMP stack, hooray! John John David Sorkin M.D., Ph.D. Professor of

Re: [R] Label axis tick marks with a simple function of axis value

2014-04-11 Thread MacQueen, Don
You're on the right track, I think. Try this example: plot(21:30, xaxt='n') labs - paste(1:10,'units',sep='\n') axis(1, at=1:10, labels=labs, mgp=c(3, 1.75, 0) ) Documentation for the mgp option is found in ?par and it's not something that I would expect someone new to R to find easily. In

Re: [R] R, RStudio, and a server for my iPad.

2014-04-11 Thread John Sorkin
Hadley, First, thank you for replying to my question. Are you saying that the iPad browser will not allow me to type the character string :/ into a browser window? I am not sure exactly what you are trying to tell me. Please forgive my lack of insight! Can you explain a but further? Do you have

Re: [R] R, RStudio, and a server for my iPad.

2014-04-11 Thread Hadley Wickham
You can not type _anything_ into Rstudio if you connect to it on the ipad. In other words, Rstudio is not currently usable on the ipad. Hadley On Fri, Apr 11, 2014 at 6:08 PM, John Sorkin jsor...@grecc.umaryland.edu wrote: Hadley, First, thank you for replying to my question. Are you saying

Re: [R] R, RStudio, and a server for my iPad.

2014-04-11 Thread John Sorkin
Hadley, Thank you for the clarification! This is too bad as I had thought that given that RStudio server followed a web-based rather than a client-server paradigm that I could use my iPad to access an RStudio server and thus have access to R. Perhaps I wasted a loot of on my iPad . . .

Re: [R] R 3.0.3, Windows 7: Problem installing XML package

2014-04-11 Thread Uwe Ligges
Works for me. Best, Uwe Ligges On 11.04.2014 17:10, Alpesh Pandya wrote: Using install.package('XML') command produces this error: trying URL ' http://watson.nci.nih.gov/cran_mirror/bin/windows/contrib/3.0/XML_3.98-1.1.zip ' Content type 'application/zip' length 4288136 bytes (4.1 Mb)

[R] invalid multibyte string at 'b0C'

2014-04-11 Thread Fisher Dennis
R 3.0.2 OS X Mavericks Colleagues I have a file that I converted from SAS (sas7bdat) to CSV (filename: ORIGINAL.csv). I try to read it with read.csv and I receive the error message: Error in type.convert(data[[i]], as.is = as.is[i], dec = dec, na.strings = character(0L)) :

Re: [R] R, RStudio, and a server for my iPad.

2014-04-11 Thread David Winsemius
On Apr 11, 2014, at 2:00 PM, John Sorkin wrote: I bemoan the fact that I can not run R or Rstudio on my iPad. A possible work around would be to set up a server (probably under Linux), and get the server to present a web page that to would allow me to run R on the server. I fear that the

Re: [R] R, RStudio, and a server for my iPad.

2014-04-11 Thread John Sorkin
David, Thank you for your assistance. I have, in fact been able to get things to work, at least when my iPad is on my local network. I had to do the following: (1) install Linux (I used linux Mint) on a computer on my LAN (2) install R on the linux box (accomplished using the Mint package

Re: [R] R, RStudio, and a server for my iPad.

2014-04-11 Thread Roy Mendelssohn
GIYF - Google VPN and iPad. -Roy On Apr 11, 2014, at 6:34 PM, John Sorkin jsor...@grecc.umaryland.edu wrote: David, Thank you for your assistance. I have, in fact been able to get things to work, at least when my iPad is on my local network. I had to do the following: (1) install Linux

Re: [R] calling in inverted commas

2014-04-11 Thread arun
HI, Not sure if this helps: df2 - data.frame(Col1=c(68.25, 68.75, 69.25), Col2=c(24.75, 25.25, 25.75)) Url1 -

Re: [R] calling in inverted commas

2014-04-11 Thread arun
Hi, I noticed some special characters after sending. It should be: toreplace - gsub(.*\\.pl\\?(west\\=.*south=.*)\\params.*,\\1,Url1) end - gsub(.*south=.*(\\params.*),\\1,Url1) A.K. On Saturday, April 12, 2014 1:06 AM, arun smartpink...@yahoo.com wrote: HI, Not sure if this helps: df2 -