Re: [R] Segmented model

2015-07-27 Thread Bert Gunter
Segmented linear regression with breakpoint locations as parameters is NON-linear regression. R^2 for nonlinear regression -- and certainly R^2 for individual segments in segmented regression-- makes no (or at best very little) sense. For why this is so, post on a statistics list like stats.stacke

[R] R wont accept my zero count values in the GLM with quasi_poisson dsitribution

2015-07-27 Thread Charlotte
Hello I have count values for abundance which follow a pattern of over-dispersal with many zero values. I have read a number of documents which suggest that I don't use data transforming methods but rather than I run the GLM with the quasi poisson distribution. So I have written my script and R

Re: [R] Segmented model

2015-07-27 Thread emiP
I apologize! I mean R2 (R squared) for each of the two segments-regressions arising from the model. -- View this message in context: http://r.789695.n4.nabble.com/Segmented-model-tp4710384p4710459.html Sent from the R help mailing list archive at Nabble.com. __

[R] help_ReverseGeocoding

2015-07-27 Thread shreya ghosh
Hi, I'm trying to do reversegeocoding on a large dataset. I'm using "RJSONIO" library and using Google map API to get the location of the given lat-lon in the dataset. After 100 or 150 successful displaying location information it is showing Warning message - "In readLines(con) : cannot open: HTTP

[R] R packages(maxLik ())‏

2015-07-27 Thread Ahmed Al-deeb
Hi all.. I am currently finish recent research to study master's degree in statistics. And in fact, I faced two problems in the practical side using r packages . In the first, generation of the new distributional data( weibull-lomax dist ) and I've successfully overcame them by the following cod

Re: [R] vectorized sub, gsub, grep, etc.

2015-07-27 Thread Adam Erickson
I know this is an old thread, but I wrote a simple FOR loop with vectorized pattern replacement that is much faster than either of those (it can also accept outputs differing in length from the patterns): sub2 <- function(pattern, replacement, x) { len <- length(x) y <- charac

[R] Populate data frame for meta-analysis

2015-07-27 Thread Jerry
I am trying to model an existing meta-analysis to examine alternative hypotheses (e.g., doing a random-effects analysis), as well as re-sampling techniques. There are over 2,000 subjects, but the data is fairly simple: a binary outcome, success or failure, linked with a score (0-10) on a structur

[R] Error “system is exactly singular: U[6,6] = 0” when doing nested logit using mlogit package in R

2015-07-27 Thread Dera
have a problem about doing nested logit using mlogit package in R. We did a survey about asking people to choose from different insurance policies. To be specific, respondents were asked “Would you buy Policy A, Policy B, or neither?" (Each choice is defined by the deductible and premium associat

[R] Daily Category Revenue-Stacked Bar Chart in ggplot2

2015-07-27 Thread Hidden Markov Model
I am trying to use the ggplot2 to build a stacked bar chart for daily Revenue by category. The chart would look have date on the x-axis, and revenue on the y axis. The fill would be the categories themselves. I have searched a great deal and have been unable to find exactly how to do this. -- Vi

[R] setwd() command on windows vs. linux/unix

2015-07-27 Thread Chris via R-help
I have a script that runs correctly (no errors) on Windows, the first command is a "setwd(.windows directory)"I installed the script on a Linux machine and changed the windows directory reference to the correct directory on the linux machine.when I ran the script I got a message that "cannot

[R] Latest Xorg updates broke R x11()

2015-07-27 Thread Boyd, Leslie (Pete)
Hello, Have 15 RedHat EL6 workstations patched to current. Over the weekend the kernel was patched to 6.7 and the xorg-x11-server and our R-3.1.2 will not open a xterm window. It appears to select a portion of the screen and lock onto it. This section can be moved a

[R] R load error

2015-07-27 Thread Yaacov Petscher
Greetings - I'm using RStudio and recently updated both it and R. When loadings up, I'm now receiving the following error: Error: ReadItem: unknown type 63, perhaps written by later version of R I've tried using rm(list=ls()) rm(list=ls(all.names=TRUE)) and detach() but nothing works in R. Wi

Re: [R] Varying name of output tables from looped process of list of spdf objects

2015-07-27 Thread Anthoni, Peter (IMK)
Hi Cecilia, print(fnp) and print(a_10) are not exactly the same >> print(fnp) > $a_10 > class : SpatialPolygonsDataFrame vs. >> print(a_10) > class : SpatialPolygonsDataFrame Looks like mget returns a list. Can you try: fnp <- get(afiles[ifile])[1] print(fnp) #the $a_10 should b

[R] Error in dist.mat[com.names, com.names] : subscript out of bounds

2015-07-27 Thread nuria
Hi! I want to estimate the phylogenetic diversity. I use the SDMTools package. In the line 3 of the "sntd.a" function appears this error and I don't know the reason. my.phylo<-read.tree("150_BootstrapConsensusTree_Cantabrian_ML.nwk") my.sample <- read.delim("C:/Filogenia/my.sample.txt") my.sampl

Re: [R] Type of variable

2015-07-27 Thread John Kane
?str perhaps. John Kane Kingston ON Canada > -Original Message- > From: j.para.fernan...@hotmail.com > Sent: Mon, 27 Jul 2015 06:52:25 -0700 (PDT) > To: r-help@r-project.org > Subject: [R] Type of variable > > I have a dataframe like this one: > > one twothree > 3.2 2.5

[R] Minor Ticks on ggplot2

2015-07-27 Thread Eduardo M. A. M.Mendes
Hi Although I could find some answers on how to add minor ticks on a ggplot on stack overflow, I could not figure to how to add them to the following example: library(ggplot2) x <- data.frame(V1=runif(1000, -6.0, 6.0),V2=runif(1000, -6.0, 6.0)); g<-ggplot(x,aes(V1,V2))+geom_poi

Re: [R] Segmented model

2015-07-27 Thread Bert Gunter
... Presumably the length of the segment ?? I leave it to the OP or others to look up the answer in their high school math texts. -- Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Mon, Jul 27, 2015 at 3:5

Re: [R] Opposite color in R

2015-07-27 Thread Steve Taylor
I wonder if the hcl colour space is useful? Varying hue while keeping chroma and luminosity constant should give varying colours of perceptually the same "colourness" and brightness. ?hcl pie(rep(1,12),col=hcl((1:12)*30,c=70),border=NA) -Original Message- From: R-help [mailto:r-help-b

Re: [R] Segmented model

2015-07-27 Thread Rolf Turner
On 27/07/15 20:21, emiP wrote: Hi to all, I used segmented package for my analysis. All is OK, I can find the slope and the intercept of each segment but I can't find the R2 (square root) of each segment. Any idea? What *on earth* do you mean??? What is the square root of a segment??? cheers,

[R] assign optimal cut-off to variable using Epi/pROC packages

2015-07-27 Thread Luigi Marongiu
Dear all, I am calculating the optimal cut-off for a test against a gold standard measure. I can determine the cut-off (in the following example 5.905) but I would like to assign it to an atomic variable so that the cut-off is updated every time the data is changed. I am using the ROC and roc funct

Re: [R] Type of variable

2015-07-27 Thread Rolf Turner
On 28/07/15 01:55, jpara3 wrote: Ok, stupid question. is.factor is the solution. Or more generally, class(). cheers, Rolf Turner -- Technical Editor ANZJS Department of Statistics University of Auckland Phone: +64-9-373-7599 ext. 88276 __ R-help@

Re: [R] Reading Json data

2015-07-27 Thread Mayukh Dass
Thanks Mark. I made a mistake when I was coping the code on the email. I have the parentheses in my code. Best, Mayukh > On Jul 27, 2015, at 5:16 PM, Mark Sharp wrote: > > Mayukh, > > I think you are missing an argument to paste() and a right parenthesis > character. > > Try > json_dat

Re: [R] "unfurling" rankings into a matrix of preferences

2015-07-27 Thread Dimitri Liakhovitski
Yes, correct, thank you, Bert! On Mon, Jul 27, 2015 at 5:46 PM, Bert Gunter wrote: > No it wouldn't. > > Presumably you have a typo and meant > > rk <- c(2,4,3,1,NA) > > ## and set the (5,5) entry to 0 after > > -- Bert > > > Bert Gunter > > "Data is not information. Information is not knowledge.

Re: [R] Reading Json data

2015-07-27 Thread Mark Sharp
Mayukh, I think you are missing an argument to paste() and a right parenthesis character. Try json_data <- fromJSON(paste(readLines(json_file), collapse = " ")) Mark R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Jul 27, 2015, at 3:41 PM, Mayukh Dass wrote: > > Hello, > > I am trying to

Re: [R] "unfurling" rankings into a matrix of preferences

2015-07-27 Thread Bert Gunter
No it wouldn't. Presumably you have a typo and meant rk <- c(2,4,3,1,NA) ## and set the (5,5) entry to 0 after -- Bert Bert Gunter "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." -- Clifford Stoll On Mon, Jul 27, 2015 at 2:32 PM, Dimitri L

Re: [R] "unfurling" rankings into a matrix of preferences

2015-07-27 Thread Dimitri Liakhovitski
With NAs it'd be: rk <- c(2,NA,4,3,1, NA) outer(rk, rk, "<") + 0 Wow, I still can't believe it - just one line! On Mon, Jul 27, 2015 at 5:31 PM, Dimitri Liakhovitski wrote: > Wow! > > On Mon, Jul 27, 2015 at 5:28 PM, Bert Gunter wrote: >> ## I leave it to you to add the NA edges >> >>> rk <-

Re: [R] "unfurling" rankings into a matrix of preferences

2015-07-27 Thread Dimitri Liakhovitski
Wow! On Mon, Jul 27, 2015 at 5:28 PM, Bert Gunter wrote: > ## I leave it to you to add the NA edges > >> rk <- c(2,4,3,1) > >> outer(rk,rk,"<")+0 > > [,1] [,2] [,3] [,4] > [1,]0110 > [2,]0000 > [3,]0100 > [4,]1110 > > > > Cheers

Re: [R] "unfurling" rankings into a matrix of preferences

2015-07-27 Thread Bert Gunter
## I leave it to you to add the NA edges > rk <- c(2,4,3,1) > outer(rk,rk,"<")+0 [,1] [,2] [,3] [,4] [1,]0110 [2,]0000 [3,]0100 [4,]1110 Cheers, Bert Bert Gunter "Data is not information. Information is not knowledge. And

Re: [R] write.table with append=T after using cat on same file

2015-07-27 Thread William Dunlap
Missing words: Use 'TRUE' and 'FALSE' instead of 'T' and 'F' >to avoid< this sort of problem Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Jul 27, 2015 at 1:50 PM, William Dunlap wrote: > This will happen if you have redefined 'T': > > T <- 101:104 > > write.table(df, file="junk.tx

Re: [R] write.table with append=T after using cat on same file

2015-07-27 Thread William Dunlap
This will happen if you have redefined 'T': > T <- 101:104 > write.table(df, file="junk.txt", sep=",", append=T, quote=F, row.names=F, col.names=F) Error in file(file, ifelse(append, "a", "w")) : invalid 'open' argument Use 'TRUE' and 'FALSE' instead of 'T' and 'F' this sort of problem. Bil

Re: [R] write.table with append=T after using cat on same file

2015-07-27 Thread Mark Sharp
I do not get an error with R-3.2.1 on Mac OS. You may have done something prior to this code so that perhaps F is not FALSE or T is not TRUE. R. Mark Sharp, Ph.D. msh...@txbiomed.org > On Jul 27, 2015, at 3:32 PM, Waichler, Scott R > wrote: > > Hi, > > For years I've been writing text t

[R] Reading Json data

2015-07-27 Thread Mayukh Dass
Hello, I am trying to read a set of json files containing tweets using the following code: json_data <- fromJSON(paste(readLines(json_file)) Unfortunately, it only reads the first record on the file. For example, in the file below, it only reads the first record starting with "id":"tag: search.t

[R] write.table with append=T after using cat on same file

2015-07-27 Thread Waichler, Scott R
Hi, For years I've been writing text to the beginning of files with cat(append=F) , then following that text with data written by write.table(append=T). It is now giving me an error message. I'm using R-3.1.2. What gives? df <- data.frame(x = 1, y = 1:10, z = 10:1) cat(file="junk.txt", sep=

Re: [R] setwd() command on windows vs. linux/unix

2015-07-27 Thread William Dunlap
You can get a more informative error message from system("bash -c 'cd yourDirectory'"), although it will not take R to that directory if there are no problems. E.g., I did in a shell % mkdir -p dir/subdir % chmod -x dir to make an untraversable directory 'dir' and a subdirectory of it. Then

Re: [R] Element-by-element division

2015-07-27 Thread Sarah Goslee
Hi, See ?sweep For instance, to get your matrix two: > sweep(a, 2, b, "/") [,1] [,2] [1,]2 24 [2,]4 28 [3,]6 32 [4,]8 36 [5,] 10 40 Sarah On Mon, Jul 27, 2015 at 4:04 PM, Steven Yen wrote: > I need help with element-by-element division. Below, matrices a and

[R] Element-by-element division

2015-07-27 Thread Steven Yen
I need help with element-by-element division. Below, matrices a and c are both 5 x 2 and element-by-element division works as (I) expected. What if matrix is 1 by 2: to divide first column of a by b[1] and second column of a by b[2]. I had to go around (two ways) to make it work. In Gauss, these ca

Re: [R] setwd() command on windows vs. linux/unix

2015-07-27 Thread John McKown
On Mon, Jul 27, 2015 at 2:38 PM, Chris wrote: > > I have a script that runs correctly (no errors) on Windows, the first > command is a "setwd(.windows directory)"I installed the script on a > Linux machine and changed the windows directory reference to the correct > directory on the linux mac

Re: [R] setwd() command on windows vs. linux/unix

2015-07-27 Thread jim holtman
Try 'choose.dir()' to see if you can navigate to the given directory, or take baby steps by doing one directory at a time. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Mon, Jul 27, 2015 at 3:38 PM, Chri

[R] "unfurling" rankings into a matrix of preferences

2015-07-27 Thread Dimitri Liakhovitski
I have 5 items in total (1:5), but I show a person only 4 items (1:4) and ask this person to rank items 1:4 in terms of preferences (1 is best, 2 is second best, 4 is worst), and I get a vector of ranks: ranks <- c(2,4,3,1) # That means that this person liked item 4 best and item 2 worst. I would

[R] setwd() command on windows vs. linux/unix

2015-07-27 Thread Chris
I have a script that runs correctly (no errors) on Windows, the first command is a "setwd(.windows directory)"I installed the script on a Linux machine and changed the windows directory reference to the correct directory on the linux machine.when I ran the script I got a message that "canno

Re: [R] VIF threshold implying multicollinearity

2015-07-27 Thread Collin Lynch
No actually it is a quiet good paper! :) On Mon, Jul 27, 2015 at 8:14 AM, John Kane wrote: > +1 > I, originally, read it as a stringent criticism of the first paper. > > John Kane > Kingston ON Canada > > > > -Original Message- > > From: r.tur...@auckland.ac.nz > > Sent: Mon, 27 Jul 201

Re: [R] R package with Fortran module on Windows? undefined reference to `__stack_chk_fail'

2015-07-27 Thread Ignacio Martinez
:( I sent this to R-package... I hope people are not hating me for spamming the lists... I will email R-devel Thanks! On Mon, Jul 27, 2015 at 1:55 PM peter dalgaard wrote: > You went through the trouble to chastise a beginner and failed to spot the > difference between R-packages and R-package-

Re: [R] Varying name of output tables from looped process of list of spdf objects

2015-07-27 Thread Sarah Goslee
Ah, but they don't look exactly the same. Look closer at the first line of the print() output. You might also look at class(fnp) class(a_10) for a clue. What happens if you run: distance.matrix<- gDistance(fnp[[1]], spgeom2= NULL, byid=T) Sarah On Mon, Jul 27, 2015 at 12:33 PM, SisoL wrote:

Re: [R] R package with Fortran module on Windows? undefined reference to `__stack_chk_fail'

2015-07-27 Thread peter dalgaard
You went through the trouble to chastise a beginner and failed to spot the difference between R-packages and R-package-devel? (I think R-devel is better for now. R-package-devel is more for people trying to make CRAN happy.) -pd PS: The by-hand example suggests that there is a 32/64 bit mixup.

Re: [R] Reading some csv files from different folders and add the name of each files to the first column of files

2015-07-27 Thread Lida Zeighami
Dear Arnaud, Thank you so much for your reply! It works great! On Sun, Jul 26, 2015 at 6:04 PM, Arnaud Mosnier wrote: > Hi Lida, > > You can try this: > > d<- choose.dir() # choose the folder with the subdirectories containing > the csv files > f <- list.files(d, full.names = TRUE, recursive =

Re: [R] Varying name of output tables from looped process of list of spdf objects

2015-07-27 Thread SisoL
Hi Jim, I've tried your suggestion but it just prints "fnp" and not the iterating names (a_1, a_10, etc). Any other suggestions? Thank you very much Siso -- View this message in context: http://r.789695.n4.nabble.com/Varying-name-of-output-tables-from-looped-process-of-list-of-spdf-objects-t

Re: [R] Varying name of output tables from looped process of list of spdf objects

2015-07-27 Thread SisoL
Hi Peter, Thank you for your reply. The method for looping seems to work, but gDistance will not recognise the input. I am puzzled because when I print(fnp), and print (a_10) they look exactly the same, but when I try to run gDistance{rgeos} with a_10 it works, but with fnp it throws an error. Ple

Re: [R] Type of variable

2015-07-27 Thread PIKAL Petr
Hi sapply(yourdata, class) would be probably quicker then to ask all variables one by one. Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of jpara3 > Sent: Monday, July 27, 2015 3:55 PM > To: r-help@r-project.org > Subject: Re: [R] Type

Re: [R] R package with Fortran module on Windows? undefined reference to `__stack_chk_fail'

2015-07-27 Thread Jeff Newmiller
You went to all that trouble to find a mailing list to ask your question on and failed to find R-packages or R-devel? --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#.

Re: [R] Sample Weights

2015-07-27 Thread PIKAL Petr
Hi > wrote: > >Dear Sir, > > > >I do appreciate your views. Yes even I was also aware about the non > >clarity in the question. Actaully, I have a large data having lots of > >data of low magnitude and few of very high magnitude. In order to can you explain what is low or high magnitude? Or be

[R] R package with Fortran module on Windows? undefined reference to `__stack_chk_fail'

2015-07-27 Thread Ignacio Martinez
Hi, I created a R library that uses a Fortran module. Everything works like a charm on linux. Now I'm trying to make it work on Windows. I cloned my git repository on a windows computer, and when I press the build and reload button on Rstudio I get these errors

Re: [R] Generating Progressively censored samples

2015-07-27 Thread LiuNing
try these: dweibull(x, shape, scale = 1, log = FALSE) pweibull(q, shape, scale = 1, lower.tail = TRUE, log.p = FALSE) qweibull(p, shape, scale = 1, lower.tail = TRUE, log.p = FALSE) rweibull(n, shape, scale = 1) -- Original -- From: "Maram SAlem";; Date: Mon

[R] Multilevel mediated moderation

2015-07-27 Thread Sally Chan
Dear All, I want to test a multilevel/cross-level mediated moderation model (Level 1: IV, DV; and Level 2: Mod, Med). The dataset can be grouped by firm_id and I use mediate{mediation} with lmer class to do it... Can anyone suggest if the following models are specified correctly? I don't know whe

[R] Generating Progressively censored samples

2015-07-27 Thread Maram SAlem
Dear All, Is there some built-in function in R that can be used to generate progressively censored sample from a certain distribution, for example, the Weibull distribution? OR Do I have to write the code of the algorithm myself? Thanks for helping. Maram Salem [[alternative HTML version

Re: [R] Type of variable

2015-07-27 Thread jpara3
Ok, stupid question. is.factor is the solution. Thanks! -- View this message in context: http://r.789695.n4.nabble.com/Type-of-variable-tp4710395p4710396.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

[R] Type of variable

2015-07-27 Thread jpara3
I have a dataframe like this one: one twothree 3.2 2.5 a 3.5 2.3 a 3.7 2.2 b How can I implment and If that detects the type of data that the variables one, two and three has? Thanks!!! -- View this message in context: http://r.789695.n4.nabble.com/Type-of-

[R] Segmented model

2015-07-27 Thread emiP
Hi to all, I used segmented package for my analysis. All is OK, I can find the slope and the intercept of each segment but I can't find the R2 (square root) of each segment. Any idea? Thank you in advance, Emilia -- View this message in context: http://r.789695.n4.nabble.com/Segmented-model-tp4

Re: [R] Varying name of output tables from looped process of list of spdf objects

2015-07-27 Thread Anthoni, Peter (IMK)
Hi Cecilia, Alternative solution #... afiles <- ls(pattern= "a_") for (ifile in 1:length(afiles)) { fnp = mget(afiles[ifile]) #... do something with fnp outfile <- file.path("/Users/sisolarrosa/Documents/PhD/R_work/AF/IIC/conefor_inputs/", paste0("distances_", afiles[ifile], ".txt")); #..

Re: [R] VIF threshold implying multicollinearity

2015-07-27 Thread John Kane
+1 I, originally, read it as a stringent criticism of the first paper. John Kane Kingston ON Canada > -Original Message- > From: r.tur...@auckland.ac.nz > Sent: Mon, 27 Jul 2015 15:12:43 +1200 > To: cfly...@ncsu.edu > Subject: Re: [R] VIF threshold implying multicollinearity > > > On

Re: [R] A strange problem using pls package

2015-07-27 Thread Bjørn-Helge Mevik
"PO SU" writes: >  suppose data has 20 columns >   traindata <- data[ 1:10, 1:10] >  testdata <- data[11:15,1:10] >   pls.fit <- plsr(y~x, ncomp = 5, data = traindata, method= "simpls", scale = > FALSE, model = TRUE, validation = "CV") > ok, i get some result, the srange thing happens when i red

Re: [R] Varying name of output tables from looped process of list of spdf objects

2015-07-27 Thread Jim Lemon
Hi Cecilia, I _think_ that the error is occurring in the call to paste0. You may be able to get what you want like this: paste0("distances_",deparse(substitute(fnp)),".txt") Jim On Mon, Jul 27, 2015 at 5:06 AM, Larrosa, Cecilia wrote: > Hi, > > This is a repost from here > (http://r.789695.n4

Re: [R] force values for elements of a dataframe below cut-off

2015-07-27 Thread Jim Lemon
Hi Luigi, First, the way you have combined the two vectors coerces df$value to factor. I think you want: df<-data.frame(value,sample) If you just want to change df$value, it's simple: df$value[df$value<8.5]<-0 If you also want to change df$sample, you will probably want to add another factor le

[R] force values for elements of a dataframe below cut-off

2015-07-27 Thread Luigi Marongiu
Dear all, I would like to clip the data of a dataframe by forcing the value of the elements below a cut-off to 0. I believe that the function to be used is sapply but I could not have the call working properly. Would you have any tip? Best regards Luigi >>> value <- c(5.43, 6.63, 0, 6.2, 5.61, 0,

Re: [R] Judging if a matrix contains any NA

2015-07-27 Thread peter dalgaard
> On 27 Jul 2015, at 03:18 , LiuNing wrote: > >> all(is.na(a)) [1] FALSE > > Bzzt! Try !all(is.finite(a)) -pd > > -- Original -- > From: "Steven Yen";; > Date: Mon, Jul 27, 2015 09:10 AM > To: "r-help mailing list"; > > Subject: [R] Judging if a matri

Re: [R] Sample Weights

2015-07-27 Thread Jeff Newmiller
R is a computing tool, and each package has implemented algorithms that have history and books and papers that allow those algorithms to be used in a variety if computing environments... from Fortran to Excel to Java to ... R, and probably beyond. >From your description I am going to hazard a g

Re: [R] R GUI plot by color

2015-07-27 Thread jpara3
Ok, I will take it into account in the future. Thanks!! -- View this message in context: http://r.789695.n4.nabble.com/R-GUI-plot-by-color-tp4710297p4710382.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mail