Re: [R] iconv question: SQL Server 2005 to R

2013-10-10 Thread Ira Sharenow
Thanks for the suggestion. From R version 3.0.2, I tried > testDF7 =iconv(x = test07 , from = "UCS-2", to = "") > Encoding(testDF7) [1] "unknown" > testDF7[1:6] [1] NA NA NA NA NA NA So using "UCS-2" produced the same results as before. I do not think there are any NA values. I cleaned up t

Re: [R] Help with expression()

2013-10-10 Thread Sheri O'Connor
Thanks very much! bquote() did the trick! on Thu, Oct 10, 2013 at 6:19 PM, William Dunlap wrote: >> changetext = expression(paste("Change from ",mini," to ", maxi, ":", >> diff ,degree,"C",collapse="")) >> >> does not evaluate my user defined variables - mini,maxi, and diff - >> just printing the

[R] Assessing compiled code in base packages

2013-10-10 Thread Le Roux, NJ, Prof
I am updating a package that works previously under R.2.15.x on a Windows OS. When I build and run the package with R.3.0.2. I receive an error message like the following: "C_call_dqags" not available for .External() for package "stats" How can compiled C (or Fortran) routines from package "s

Re: [R] Permutation tests in {coin}

2013-10-10 Thread Henric Winell
Lars Bishop skrev 2013-10-05 22:17: Hello, I'm trying to get familiar with the coin package for doing permutation tests. I'm not sure I understand the documentation regarding the difference between distribution = "asymptotic" and "approximate" in the function independence_test. The use of "asy

Re: [R] summary and plot

2013-10-10 Thread arun
Hi, May be: dat1<- read.table(text="city year sex  obs 1  1990  M  25 1  1990  F  32 1  1991  M  15 1  1991  F  22 2  1990  M  42 2  1990  F  36 2  1991  M  12 2  1991  F  16",sep="",header=TRUE,stringsAsFactors=FALSE) library(plyr) #by city  d1 <- ddply(dat1,.(city

Re: [R] summary and plot

2013-10-10 Thread Richard M. Heiberger
This is better for plotting the percents likert(city ~ F + M | year, data=popwide, as.percent="noRightAxis", main="F M population by city within year") likert(year ~ F + M | city, data=popwide, as.percent="noRightAxis", main="F M population by year within city") We can also plot t

Re: [R] summary and plot

2013-10-10 Thread Richard M. Heiberger
## I would use the likert function in the HH package ## if necessary ## install.packages("HH") ## install.packages("reshape") library(HH) library(reshape) pop <- read.table(header=TRUE, text=" city year sex obs 1 1990 M 25 1 1990 F 32 1 1991 M 15 1 1991 F 22 2

[R] summary and plot

2013-10-10 Thread Val
Hi All, I have a huge data set with the following type; city year sex obs 1 1990 M 25 1 1990 F 32 1 1991 M 15 1 1991 F 22 2 1990 M 42 2 1990 F 36 2 1991 M 12 2 1991 F 16 I want to calculate the percentage of M and F by city, year and

Re: [R] help for compare regression coefficients across groups

2013-10-10 Thread David Winsemius
On Oct 10, 2013, at 3:44 AM, Andreia Fonseca wrote: > Dear all > > I have data related to cell count across time in 2 different types of > cells. I have transformed the count data using a log > and I want to test the H0: B cell_ttype1=Bcell_type2 across time > > for that I am fitting the follo

Re: [R] Small p from binomial probability function.

2013-10-10 Thread Rolf Turner
I've figured it out. It ***is*** "obvious" why Evert's procedure works. Once you hold your head at the correct angle, as my first year calculus lecturer used to say. The binom.test() confidence interval gives you the value of a random variable say "U" (for "upper") such that Pr(U < p)

Re: [R] Splitting times into groups based on a range of times

2013-10-10 Thread arun
Hi Ben, I would look into ?findInterval() or ?cut() for an easier solution. indx<- match(df[,1],as.POSIXct(dt))  indx2<- unique(df[,2]) lst1<- lapply(split(indx,((seq_along(indx)-1)%/%2)+1),function(x) seq(x[1], x[2]))  res <- unlist(lapply(seq_along(lst1),function(i) {                           

Re: [R] Small p from binomial probability function.

2013-10-10 Thread Rolf Turner
It is mysterious to me why the procedure proposed by Stefan Evert works. It appears to work --- once you modify the call to binom.test() to have the correct syntax. In a sequence of 1000 trials with random values of N, x, and p0, the answers from Evert's procedure agreed with the answer given

Re: [R] Gaussian Quadrature for arbitrary PDF

2013-10-10 Thread Marino David
Thanks so much for your response. BTW, do you know any Gauss quadrature R package can deal with the arbitary PDF? Thank you! David 2013/10/11 Spencer Graves > p.s. Orthogonal polynomials can be defined for any probability > distribution on the real line, discrete, continuous, or otherwise,

Re: [R] Gaussian Quadrature for arbitrary PDF

2013-10-10 Thread Spencer Graves
p.s. Orthogonal polynomials can be defined for any probability distribution on the real line, discrete, continuous, or otherwise, as described in the Wikipedia article on "orthogonal polynomials". On 10/10/2013 5:02 PM, Marino David wrote: > Hi all, > > We know that Hermite polynomial is for >

Re: [R] Gaussian Quadrature for arbitrary PDF

2013-10-10 Thread Spencer Graves
On 10/10/2013 5:02 PM, Marino David wrote: > Hi all, > > We know that Hermite polynomial is for > Gaussian, Laguerre polynomial for Exponential > distribution, Legendre polynomial for uniform > distribution, Jacobi polynomial for Beta distribution. Does anyone know > which kind of polynomial deals

[R] Gaussian Quadrature for arbitrary PDF

2013-10-10 Thread Marino David
Hi all, We know that Hermite polynomial is for Gaussian, Laguerre polynomial for Exponential distribution, Legendre polynomial for uniform distribution, Jacobi polynomial for Beta distribution. Does anyone know which kind of polynomial deals with the log-normal, Student’s t, Inverse gamma and Fis

Re: [R] Bootstrap (bootSem) causes R to crash

2013-10-10 Thread Eric Green
Hi, I solved the crashing issue by removing references to tclck. Here is a gist that shows the edits: https://gist.github.com/ericpgreen/6926595 However, I am getting an error about convergence failures: Error in bootSem2(sem.cnes, R = 100, Cov = hcor, data = CNES) : more than 10 consecuti

[R] Splitting times into groups based on a range of times

2013-10-10 Thread Benjamin Gillespie
Hi all, I hope you can help with this one! I have a dataframe: 'df' that consists of a vector of times: 'dt2' and a vector of group id's: 'group': dates2=rep("01/02/13",times=8) times2=c("12:00:00","12:30:00","12:45:00","13:15:00","13:30:00","14:00:00","14:45:00","17:30:00") y =paste(dates2, ti

Re: [R] Problems with R

2013-10-10 Thread Jeff Newmiller
Wow, that really sounds terrible. Is someone making you use R? For my tasks it is generally an improvement over other tools. Sometimes it can be a bit puzzling, but often the result works more reliably and it gives me warnings when my data are messed up. If you have a better tool for your work,

Re: [R] Help with expression()

2013-10-10 Thread William Dunlap
> changetext = expression(paste("Change from ",mini," to ", maxi, ":", > diff ,degree,"C",collapse="")) > > does not evaluate my user defined variables - mini,maxi, and diff - > just printing them out as words bquote() can do it: put the variables which should be evaluated in .(). E.g., mini

Re: [R] Possible loop/ if statement query

2013-10-10 Thread Benjamin Gillespie
Fantastic - once again, thanks Arun - your knowledge is very impressive! Ben Gillespie, Research Postgraduate o---o School of Geography, University of Leeds, Leeds, LS2 9JT o

Re: [R] pairs plot

2013-10-10 Thread Jim Lemon
On 10/11/2013 02:01 AM, Witold E Wolski wrote: my data are matrix with 3 numeric columns. would like to have pairs plot with scatterplots in the upper with hist at the diag and with correlation at the lower. actually default pairs does almost what I want but looks semi awesome. Especially, i di

[R] Error while running MR using rmr2

2013-10-10 Thread Praveen Sripati
Hi, > I have trying to run a simple MR program using rmr2 in a single node > Hadoop cluster. Here is the environment for the setup > > Ubuntu 12.04 (32 bit) > R (Ubuntu comes with 2.14.1, so updated to 3.0.2) > Installed the latest rmr2 and rhdfs from > here

[R] Help with expression()

2013-10-10 Thread Sheri O'Connor
Hi everyone, I am hoping someone can help with my attempted use of the expression function. I have a long series of text and variable to paste together including a degree symbol. The text is to be placed on my scatter plot using the mtext function. Using expression like this: changetext = expres

[R] Revolutions Blog: September roundup

2013-10-10 Thread David Smith
Revolution Analytics staff write about R every weekday at the Revolutions blog: http://blog.revolutionanalytics.com and every month I post a summary of articles from the previous month of particular interest to readers of r-help. In case you missed them, here are some articles related to R from t

Re: [R] installing package gstat

2013-10-10 Thread Thomas Adams
Simona, You need to install the dependencies: install.packages("gstat",dependencies=T) Tom On Thu, Oct 10, 2013 at 11:58 AM, Simona Augyte wrote: > Hello, > # I am able to > install.packages("gstat") > #but when I try to upload I get an error message > library(gstat) > #Error in loadNamespace

[R] Help with expression()

2013-10-10 Thread Sheri
Hi everyone, I am hoping someone can help with my attempted use of the expression function. I have a long series of text and variable to paste together including a degree symbol. The text is to be placed on my scatter plot using the mtext function. Using expression like this: changetext = expres

Re: [R] Looking for package to solve for exponent using newton's method

2013-10-10 Thread Jeff Newmiller
?uniroot --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engine

Re: [R] Bootstrap (bootSem) causes R to crash

2013-10-10 Thread Eric Green
Hi everyone, I'd like to report a similar experience. When I attempt to run the first CFA example in bootSem(), specifically the line: system.time(boot.cnes <- bootSem(sem.cnes, R=100, Cov=hcor, data=CNES)) R crashes and I get a notice about X11. I copied my sessionInfo() below. Any ideas f

Re: [R] Looking for package to solve for exponent using newton's method

2013-10-10 Thread Ken Takagi
Thanks! That's just what I needed. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducibl

Re: [R] Looking for package to solve for exponent using newton's method

2013-10-10 Thread Berend Hasselman
On 10-10-2013, at 20:39, Ken Takagi wrote: > Hi, > I'm looking for an R function/package that will let me solve problems of the > type: > > 13 = 2^x + 3^x. > > The answer to this example is x = 2, but I'm looking for solutions when x > isn't so easily determined. Looking around, it seems that

Re: [R] Looking for package to solve for exponent using newton's method

2013-10-10 Thread Duncan Murdoch
On 10/10/2013 2:39 PM, Ken Takagi wrote: Hi, I'm looking for an R function/package that will let me solve problems of the type: 13 = 2^x + 3^x. The answer to this example is x = 2, but I'm looking for solutions when x isn't so easily determined. Looking around, it seems that there is no algebra

Re: [R] order() not producing results as I expect

2013-10-10 Thread Duncan Murdoch
On 10/10/2013 12:00 PM, Karl Fetter wrote: Hello, I'm using R version 3.0.0 on a mac. I'm having trouble getting order to behave as I expect it should. I'm trying to sort a data.frame according to a character vector. I'm able to sort the data.frame, but it retruns an unexpected result. I have no

[R] order() not producing results as I expect

2013-10-10 Thread Karl Fetter
Hello, I'm using R version 3.0.0 on a mac. I'm having trouble getting order to behave as I expect it should. I'm trying to sort a data.frame according to a character vector. I'm able to sort the data.frame, but it retruns an unexpected result. I have no idea where the order that is being produced

[R] installing package gstat

2013-10-10 Thread Simona Augyte
Hello, # I am able to install.packages("gstat") #but when I try to upload I get an error message library(gstat) #Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : # there is no package called ‘intervals’ #In addition: Warning message: #package ‘gstat’ was buil

[R] Looking for package to solve for exponent using newton's method

2013-10-10 Thread Ken Takagi
Hi, I'm looking for an R function/package that will let me solve problems of the type: 13 = 2^x + 3^x. The answer to this example is x = 2, but I'm looking for solutions when x isn't so easily determined. Looking around, it seems that there is no algebraic solution for x, unless I'm mistaken. Do

[R] Using calibrate for raking (survey package)

2013-10-10 Thread Michael . Laviolette
I'm studying the calibration function in the survey package in preparation for raking some survey data. Results from the rake function below agree with other sources. When I run calibrate, I get a warning message and the M and F weights seem to be reversed. Even allowing for that, the deviation bet

Re: [R] Problems with R

2013-10-10 Thread Ista Zahn
On Thu, Oct 10, 2013 at 11:09 AM, Mash Hamid wrote: > > Hi, > > I have recently installed R and am trying to do some work on it. To be honest > I'm finding it a PAIN to you. To me? > > I use Mac and I can open stata dta. files in R Great, glad to hear it's working! > > despite using the c

Re: [R] Rcpp and mclapply

2013-10-10 Thread Jeff Newmiller
I cannot imagine how the calling process will affect this. If you want further help I think you will need to provide a reproducible example and info as requested by the Posting Guide. --- Jeff Newmiller

Re: [R] Small p from binomial probability function.

2013-10-10 Thread Benjamin Ward (ENV)
Hi, Thank you for your answers, I'm not completely sure if it's to bino.test I need or the uniroot. Perhaps I should explain more the idea behind the code and the actual task I'm trying to do. The idea is to calculate a confidence interval as to the age of two DNA sequences which have diverged,

[R] Problems with R

2013-10-10 Thread Mash Hamid
Hi, I have recently installed R and am trying to do some work on it. To be honest I'm finding it a PAIN to you. I use Mac and I can open stata dta. files in R despite using the commands suggested to me and I have been trying to get figure out how to do reduced rank regression on it and the manu

Re: [R] Rcpp and mclapply

2013-10-10 Thread sophie_brugieres
Dear Jeff, I had suspected something along those lines initially, however, as I had stated, this only happens sometimes ... Here is a partial top showing two of my calls: 17404 sophie20 0 12.4g 11g 1996 R 100 4.6 5:50.11 R 17405 sophie20 0 12.4g 11g 2016 R 100 4.6 5:49.86 R

Re: [R] mixed model MANOVA? does it even exist?

2013-10-10 Thread laurie bayet
Hi, Sorry to bother you again. I tried doing regressions using lme (because i want p-values) and ran across two issues. *(1) about model specification:* this is a mixed model. i tried two model specifications: (a) specify that subjectID ("subj") is nested within the between-subject variable ("

[R] system2 commands with backslash

2013-10-10 Thread Zev Ross
Hi All, I'm trying to edit a file in place using system2 and sed from within R. I can get my command to work unless there is a backslash in the command in which case I'm warned about an "unrecognized escape". So, for example: system2("sed -i s/oldword/newword/g d:/junk/x/test.tex") # works fi

[R] pairs plot

2013-10-10 Thread Witold E Wolski
my data are matrix with 3 numeric columns. would like to have pairs plot with scatterplots in the upper with hist at the diag and with correlation at the lower. actually default pairs does almost what I want but looks semi awesome. Especially, i didn't find out how to remove the axes from the low

Re: [R] Rcpp and mclapply

2013-10-10 Thread Jeff Newmiller
I would bet that you are doing something in C++ that shares some resource between the workers and blocks all but one worker at a time. --- Jeff NewmillerThe . . Go Live... DCN:

Re: [R] Convert a factor to a numeric

2013-10-10 Thread arun
Also, BTW, dat.num() is matrix, but if you use lapply(), it is still a dataframe.  Anyway, it depends on what the OP really wants as output. dat.num <- apply(dat, 2, FUN = function(x) as.numeric(as.character(x)))  dat[] <- lapply(dat,function(x) as.numeric(as.character(x)))  str(dat) 'data.fram

[R] Error while running MR using rmr2

2013-10-10 Thread Praveen Sripati
> Hi, > > I have trying to run a simple MR program using rmr2 in a single node > Hadoop cluster. Here is the environment for the setup > > Ubuntu 12.04 (32 bit) > R (Ubuntu comes with 2.14.1, so updated to 3.0.2) > Installed the latest rmr2 and rhdfs from > here

[R] Rcpp and mclapply

2013-10-10 Thread sophie_brugieres
Dear all, I have an R script that uses Rcpp, and I have been trying to parallelize it using mclapply (I tried with the multicore and the parallel library) Sometimes (not always, interestingly), the CPU use for each core drops, usually so that the total over all cores reaches 100%, i.e., as fast a

Re: [R] Convert a factor to a numeric

2013-10-10 Thread Charles Determan Jr
Firstly, please make sure to reply-all so the r-help list also receives these emails. Second, I have just run this sequence as it provides an exact copy with each as numeric. Use the apply function, it iterates over each column and converts each to numeric. dat <- read.table(text="a

Re: [R] Convert a factor to a numeric

2013-10-10 Thread Charles Determan Jr
I'm not honestly sure why data.matrix didn't work off hand. Perhaps another user can shed some light on this. An alternative is the following: apply(dat, 2, FUN = function(x) as.numeric(as.character(x))) On Thu, Oct 10, 2013 at 8:26 AM, arun wrote: > Did you mean to apply it like this or is

Re: [R] frailtypack

2013-10-10 Thread cf2059
I wanted to provide a follow-up post regarding the question of the coxme program and nested (multilevel) frailty analysis. As it turns out, my failure to produce results was a result of my own error. The following syntax seems to successfully produce results for a model accounting for both cluster

Re: [R] Convert a factor to a numeric

2013-10-10 Thread Charles Determan Jr
data.matrix() should do the job for you Charles On Thu, Oct 10, 2013 at 8:02 AM, arun wrote: > Hi, > It is not clear whether all the variables are factor or only a few are.. > > dat<- read.table(text="acoef > coef.l coef.h > 1 1 0.005657825001254 0.00300612956

Re: [R] Convert a factor to a numeric

2013-10-10 Thread arun
Hi, It is not clear whether all the variables are factor or only a few are.. dat<- read.table(text="a    coef   coef.l  coef.h 1   1   0.005657825001254  0.00300612956318132 0.00830952043932667 2   2 0.00634505314577229  0.00334102345418614 0.00934908283735844

Re: [R] Help required graphing factors with predicted model settings

2013-10-10 Thread Michael Friendly
Perhaps you are looking for the effects package, which can plot effects (predicted values) for terms in mer objects from lme4? library(effects) ?effect library(lme4) data(cake, package="lme4") fm1 <- lmer(angle ~ recipe * temperature + (1|recipe:replicate), cake, REML = FALSE)

Re: [R] makeCluster help needed

2013-10-10 Thread Carl Witthoft
Jeffrey Flint wrote > Good news. I installed 3.0.2, and the parallel package examples ran > successfully. This time a firewall window popped up. Probably the > firewall was the problem with the snow package too, but for some reason > the > window didn't pop up with the snow package. > > Thanks f

Re: [R] vector where elements are functions evaluated at integers, but length of vector varies

2013-10-10 Thread Carl Witthoft
Hi, I have two integers a and b (with a What did you try?Further, without knowing what your function f(x) is, we can't tell you whether it accepts vector inputs. -- View this message in context: http://r.789695.n4.nabble.com/vector-where-elements-are-functions-evaluated-at-integers-bu

Re: [R] optimizing code

2013-10-10 Thread Carl Witthoft
FMRPROG wrote > I am generating random numbers from a normal distribution using > [snip] > > I need to optimize the speed WITHOUT using the rnorm function but have no > idea how to do this. I assume I should minimise what goes in the loop? > > Any help would be very much appreciated. Looks like

Re: [R] Convert a factor to a numeric

2013-10-10 Thread Carl Witthoft
foo <- as.numeric(as.character(your_factors) ). It's a common mistake to forget the first conversion, in which case you end up with an integer sequence rather than the desired values. -- View this message in context: http://r.789695.n4.nabble.com/Convert-a-factor-to-a-numeric-tp4677964p4677971

Re: [R] convert list of lists to simple list

2013-10-10 Thread Philippe Grosjean
On 10 Oct 2013, at 13:17, ivan wrote: > test <- foreach(i = 1:3) %:% > foreach (j = 1:3) %do% { > paste(i,j,sep=",") > } Not easily reproducible, unless you write #install.packages("foreach") require(foreach) in front of your code. Here is a starting

[R] convert list of lists to simple list

2013-10-10 Thread ivan
Dear R Community, I have the following Problem. I use foreach nested loops, which then return a list of lists. E.g.: [[1]] [[1]][[1]] Output [[1]][[2]] Output [[1]][[3]] Output [[2]] [[2]][[1]] Output What I want to achieve is a single layer list, i.e. a list in which [[1]][[1]] becomes [[1

[R] help for compare regression coefficients across groups

2013-10-10 Thread Andreia Fonseca
Dear all I have data related to cell count across time in 2 different types of cells. I have transformed the count data using a log and I want to test the H0: B cell_ttype1=Bcell_type2 across time for that I am fitting the following model fit_all<-lm(data$count~data$cell_type+data$time+data$cel

Re: [R] makeCluster help needed

2013-10-10 Thread Uwe Ligges
On 10.10.2013 04:04, Jeffrey Flint wrote: Uwe, Good news. I installed 3.0.2, and the parallel package examples ran successfully. This time a firewall window popped up. Probably the firewall was the problem with the snow package too, but for some reason the window didn't pop up with the snow

Re: [R] R function for Bisecting K-means algorithm

2013-10-10 Thread Vivek Singh
On Wed, Oct 9, 2013 at 12:37 PM, Bert Gunter wrote: > Probably not. I would guess that most (or all) of us have no clue what > "bisecting" a k-means algorithm means. You might have more luck if you > explain yourself more clearly (but probably not from me in any case). > > Is this an R question,

Re: [R] Using "cpquery" function from bnlearn package inside loop

2013-10-10 Thread Marco Scutari
Dear Ryan, On 9 October 2013 21:26, Ryan Morrison wrote: > I'm attempting to use the bnlearn package to calculate conditional > probabilities, and > I'm running into a problem when the "cpquery" function is used within a loop. > I've > created an example, shown below, using data included with t

Re: [R] Small p from binomial probability function.

2013-10-10 Thread Stefan Evert
Sounds like you want a 95% binomial confidence interval: binom.test(N, P) will compute this for you, and you can get the bounds directly with binom.test(N, P)$conf.int Actually, binom.test computes a two-sided confidence interval, which corresponds roughly to 2.5 and 97.5 perce