Re: [R] Showing error when trying to open a netcdf file using 'ncdf' package in R

2015-01-12 Thread കുഞ്ഞായി kunjaai
On Tue, Jan 13, 2015 at 2:17 AM, David W. Pierce wrote: > Hi, > > > *>library(ncdf)* > > > > *>f<-open.ncdf('Acc.nc')* > > > > *Error in R_nc_inq_dim: NetCDF: Invalid dimension ID or nameError in > > dim.inq.ncdf(nc, i) : using ncid 65536 dimid 1* > > I've fixed this error, and put a new sourc

[R] Complex merging problems

2015-01-12 Thread npretnar
Hello, I have two data frames structured as follows: df1 v1 v2 1 83 1 83 1 84 1 84 1 85 1 85 2 90 2 91 2 91 2 91 2 92 4 89 4 89 4 90 4 90 df2 v1 v2 1 83 2 83 3

Re: [R] two-sample KS test: data becomes significantly different after normalization

2015-01-12 Thread Monnand
Thank you, Chris! I think it is exactly the problem you mentioned. I did consider 1000-point data is a large one at first. I down-sampled the data from 1000 points to 100 points and ran KS test again. It worked as expected. Is there any typical method to compare two large samples? I also tried KL

Re: [R] any r package can handle factor levels not in the test set

2015-01-12 Thread Richard M. Heiberger
You need to define the levels of the training set to include all levels that you might see. Something like this > A <- factor(letters[1:5]) > B <- factor(letters[c(1,3,5,7,9)]) > A [1] a b c d e Levels: a b c d e > B [1] a c e g i Levels: a c e g i > training <- factor(A, levels=unique(c(levels(A)

[R] any r package can handle factor levels not in the test set

2015-01-12 Thread HelponR
It looks like gbm, glm all has this issue I wonder if any R package is immune of this? In reality, it is very normal that test data has data unseen in training data. It looks like I have to give up R? Thanks! [[alternative HTML version deleted]]

Re: [R] Saving an edited function in R Studio

2015-01-12 Thread Jeff Newmiller
The usual answer is "don't do that." Always use a text editor to change your code on disk and re-load it by sourcing it or building it into a package. This makes sure your changes make it back to the hard disk where they came from to begin with, since the edit function only "saves" them back in

Re: [R] Suggestions for workaround for R Markdown problem with data() ?

2015-01-12 Thread Molly Elliott
My apologies to everyone who offered assistance here. I broke my code chunks up some more, and further isolated the problem line to a different function. Yihui, Thank you for the information for running the .Rmd file within R itself, rather than RStudio. I have installed pandoc and like that

[R] Saving an edited function in R Studio

2015-01-12 Thread Tae J. Kwon
Hello, I am trying to modify a few functions in a specific R package that I installed. I am using a simple "edit" function to edit the function and override the exisiting using the same function name. For instance, if the function is named as "aaaMap" then I do: aaaMap = edit(aaaMap) so other func

Re: [R] global environment

2015-01-12 Thread Matt Warpinski
Rewrite it with spaces between your assigns and numbers. This line is unclear to me: if(rst[i]<-3 & rst[i]>=-3) Is it supposed to be rst[i] <- 3, or rst[i] < -3? R might be misinterpreting what you're trying to get it to do. On Mon, Jan 12, 2015 at 1:18 AM, Methekar, Pushpa (GE Transportation, N

Re: [R] R vs. RStudio?

2015-01-12 Thread C W
Thanks, Duncan and Richard. This graphing being cut off problem is very subtle, I can live with it. It is usually the white spaces that's cut off. Thanks for addressing this. Please continue with your original discussion, didn't mean to divert your attention. On Mon, Jan 12, 2015 at 5:08 PM, R

Re: [R] R vs. RStudio?

2015-01-12 Thread Richard M. Heiberger
I have this in my .Rprofile setHook(packageEvent("grDevices", "onLoad"), function(...) grDevices::quartz.options(height=6.7)) ## for the MacBook Air, the default height=7 puts the legend below the bottom of the screen On Mon, Jan 12, 2015 at 4:31 PM, Duncan Murdoch wrote: > On 12/01/2015

Re: [R] R vs. RStudio?

2015-01-12 Thread Duncan Murdoch
On 12/01/2015 12:00 PM, C W wrote: > I use R on Mac, and I use RStudio on Windows. That's my opinion. > > I have one problem. > > When I use R on Mac. The function plot() gives a graph that's cut off. > > For example, try > > plot(rnorm(100) > > I believe there should be space below "index" o

Re: [R] Showing error when trying to open a netcdf file using 'ncdf' package in R

2015-01-12 Thread David W. Pierce
Hi, > *>library(ncdf)* > > *>f<-open.ncdf('Acc.nc')* > > *Error in R_nc_inq_dim: NetCDF: Invalid dimension ID or nameError in > dim.inq.ncdf(nc, i) : using ncid 65536 dimid 1* I've fixed this error, and put a new source package (version 1.8.6) up on ncdf's home page at: http://cirrus.ucsd.edu

[R] Tomorrow Webinar: Enter a KDD Cup or Kaggle Competition without being an expert!

2015-01-12 Thread Lisa Solomon
Webinar: Enter a KDD Cup or Kaggle Competition, You don't need to be an expert! Tomorrow, January 13, 2015 from 10am-11am PDT * If inconvenient time, please register and we will send you a recording. Click to Register: http://hubs.ly/y0q_jf0 Abstract: * Quickly achieve a place

Re: [R] R vs. RStudio?

2015-01-12 Thread C W
I use R on Mac, and I use RStudio on Windows. That's my opinion. I have one problem. When I use R on Mac. The function plot() gives a graph that's cut off. For example, try plot(rnorm(100) I believe there should be space below "index" on x-axis. Why is that? Thanks, Mike On Mon, Jan 12, 2

Re: [R] regular expression question

2015-01-12 Thread John McKown
No HTML please. it makes me itchy! > s <- c("lngimbintrhofixed","lngimbnointnorhofixed","test") > sub('(no)?rhofixed$','',s) [1] "lngimbint" "lngimbnoint" "test" > On Mon, Jan 12, 2015 at 1:37 PM, Mark Leeds wrote: > Hi All: I have a regular expression problem. If a character string ends >

[R] regular expression question

2015-01-12 Thread Mark Leeds
Hi All: I have a regular expression problem. If a character string ends with "rhofixed" or "norhofixed", I want that part of the string to be removed. If it doesn't end with either of those two endings, then the result should be the same as the original. Below doesn't work for the second case. I kn

Re: [R] R console colours (R profile)

2015-01-12 Thread Sarah Goslee
I think you're setting the colors incorrectly. My understanding from reading the package docs is that you use setOutputColors to do so, and not the options() approach. There are no options for background etc that I'm aware of. Does that work if you run it in an interactive session instead? See ?se

Re: [R] R vs. RStudio?

2015-01-12 Thread Fraser D. Neiman
In my experience, another negative to RStudio is its performance when trying to access code or data files on a remote server over a VPN connection -- even modest files can take minutes to load and sometimes crash the session. The native R GUI seems to handle this better and I often am forced

[R] R console colours (R profile)

2015-01-12 Thread Ingrid Charvet
Hello R users, I would like to set defaults text and background colours of my R console using R profile (to load automatically each time I start a new session) So far my R profile is set up like this: if(interactive()) { suppressWarnings(require(colorout,quietly=T)) message("successfully loaded

Re: [R] Reading large data matrix in R

2015-01-12 Thread Sarah Goslee
I'm not at all clear on what you want your plots to look like, but I would recommend reading the help for xyplot and trying out the examples. In general, you need to pass xyplot() a formula that describes what you want your plots to contain, and then a data argument with the data for doing so. ?xy

Re: [R] nonmonotonic glm?

2015-01-12 Thread Bert Gunter
... but do realize that after you have looked at the data to determine the appropriate modeling approach, no statistical inference (significance tests, confidence intervals, etc.) should be done on the model used. Or more precisely, any that is done is wrong. Cheers, Bert Bert Gunter Genentech No

Re: [R] overlapping coefficient bidimensional distribution

2015-01-12 Thread Bert Gunter
?intersect or, more generally, ?match Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." Clifford Stoll On Mon, Jan 12, 2015 at 5:09 AM, Meli Massimiliano wrote: > Hell

[R] Showing error when trying to open a netcdf file using 'ncdf' package in R

2015-01-12 Thread കുഞ്ഞായി kunjaai
Dear all, I am tried to open an netcdf file in R, *>library(ncdf)* *>f<-open.ncdf('Acc.nc')* *Error in R_nc_inq_dim: NetCDF: Invalid dimension ID or nameError in dim.inq.ncdf(nc, i) : using ncid 65536 dimid 1* But I can open this same nc file using other software tool like UVCDAT. I have

Re: [R] Reading large data matrix in R

2015-01-12 Thread Bert Gunter
You really need to read ?xyplot and probaby also an R tutorial such as cran.r-project.org/doc/manuals/R-intro.pdf (which also ships with R) to learn about S3 methods. R is a language that requires an investment in time and effort to learn. If you are unwilling to make that investment, use other

Re: [R] R vs. RStudio?

2015-01-12 Thread John Fox
Dear Hadley, On Mon, 12 Jan 2015 10:24:35 -0600 Hadley Wickham wrote: > Is there a reason you don't just click the zoom button? > Hadley Yes: To have enough room for the console and script panes, I often have to make the graphics pane too small to display a graph in the first place. John >

[R] overlapping coefficient bidimensional distribution

2015-01-12 Thread Meli Massimiliano
Hello All, I have two set of data (A and B) and i would calculate the percentage of superimposition of these two set. Or the number of point that belong to the intersection A ∩ B of these two sets. How i can measure it ? thanks a lot, max __ R-help

Re: [R] ggplot barchart: bars don't stock on breaks

2015-01-12 Thread Jeff Newmiller
> xx<-as.vector(xx) Error in as.vector(xx) : object 'xx' not found > I do not think as.vector does what you think it does... all data in R is some kind of vector. > xx<-rep(0,5941) # make the whole vector > xx[4853:5941]<-1 # change part of it > table(xx) # review the data xx 01 4852 108

Re: [R] rename columns with pattern

2015-01-12 Thread Alain Guillet
Dear Raj, names(dff)[1:6] <- paste("bp",1:6,sep="_") Alain On 2015-01-12 15:17, Kuma Raj wrote: > I want to rename columns 1 to 6 in the sample data set as bp_1 to > bp_6. How could I do that in R? > > Thanks > >> dput(dff) > structure(list(one = c(1.00027378507871, 0.982313483915127, 1.153127

[R] Help reading multiple ts objects

2015-01-12 Thread stamos
Hello R team, I am currently exploring the R functionality for time series forecasting. My set of data consists of 4y monthly data sales per sku. Each sku spans across 4 lines - one for each year - and the respective periods of time are in columns P1 to P12. The .txt file (assume tab sep) containi

Re: [R] R package creation: Confused about how to handle text data

2015-01-12 Thread Marine Rohmer
Hi Uwe and Hadley, Thank you a lot for your answer. The ./inst/extdata folder seems to work fine, accessing my text files in this way : myFile=system.file("extdata", "myFile.csv", package="MyPackage") I've read the Writing R Extension so many times without understanding well the 1.1.6 section,

[R] global environment

2015-01-12 Thread Methekar, Pushpa (GE Transportation, Non-GE)
Hi I am trying to make some changes in data frame and return it to function .this is my function rm.outliers = function(model,xsys) { rst = rstudent(model) outliers<<-vector("numeric",10) xsys<<-xsys for(i in 1:length(rst)) { if(rst[i]<-3 & rst[i]>=-3) { #print("this is n

Re: [R] R vs. RStudio?

2015-01-12 Thread peter dalgaard
On 12 Jan 2015, at 17:24 , Hadley Wickham wrote: > Is there a reason you don't just click the zoom button? > Hadley Two, I think. One may be a version issue. 1. Some plots will fail if done on the unzoomed device. 2. The zoom featur has a bug (at least on OSX) where it generates a plot that

Re: [R] Suggestions for workaround for R Markdown problem with data() ?

2015-01-12 Thread Yihui Xie
Can you try to compile your .Rmd file in the R console (instead of clicking the button in RStudio)? rmarkdown::render('your.Rmd') If it gives the same error, please post the traceback() information. I just tried the following minimal example, and I was unable to reproduce your problem. You may

Re: [R] R vs. RStudio?

2015-01-12 Thread Hadley Wickham
Is there a reason you don't just click the zoom button? Hadley On Mon, Jan 12, 2015 at 8:22 AM, John Fox wrote: > Dear Peter and Jeff, > > I've used RStudio in teaching for quite some time now. For displaying > graphics, I open a windows() graphics device on a Windows PC or a quartz() > device on

Re: [R] Question about package "principal"

2015-01-12 Thread William Revelle
As David suggests, look at your data. For instance, there seems to be only 1 case (#2) for seat.width.club with non-zero data. I find it hard to believe that the other planes have seat.widths of 0! I think you probably want to code the 0s as missing, rather than 0. You also want to rethink the

Re: [R] Change of locale

2015-01-12 Thread Chel Hee Lee
Thank you so much. Your explanation is very clear and helpful to understand. Thank you, again. Chel Hee Lee On 1/12/2015 5:56 AM, Prof Brian Ripley wrote: You don't want to change the locale, rather the message language. That is not a locale, and e.g. LANGUAGE=en is the correct form. See

Re: [R] nonmonotonic glm?

2015-01-12 Thread Michael Dewey
Comments in line On 12/01/2015 13:13, Vito M. R. Muggeo wrote: dear Stanislav, Your data show two slopes with a kink at around 0. Thus, yet another approach would be to use segmented regression to fit a piecewise linear relationship with unknown breakpoint (being estimated as part of model fitti

Re: [R] R vs. RStudio?

2015-01-12 Thread John Fox
Dear Peter and Jeff, I've used RStudio in teaching for quite some time now. For displaying graphics, I open a windows() graphics device on a Windows PC or a quartz() device on a Mac. I explain to the students that they don't have to do this, but I'm doing it so that I can make the graphs larger. T

Re: [R] rename columns with pattern

2015-01-12 Thread Jeff Newmiller
Read the help page for the names function: ?names ... note particularly the examples section. You might also find the fact that the paste0 function works on vectors to be helpful: paste0( "bp_", 1:6 ) --- Jeff Newmiller

Re: [R] R vs. RStudio?

2015-01-12 Thread Hadley Wickham
On Mon, Jan 12, 2015 at 2:01 AM, peter dalgaard wrote: > >> On 11 Jan 2015, at 11:30 , Duncan Murdoch wrote: >> >> >> - I don't like the tiled display. I find it doesn't give me enough space. >> > > This is a mixed blessing. For teaching purposes, it helps avoid shuffling > windows to uncover t

Re: [R] two-sample KS test: data becomes significantly different after normalization

2015-01-12 Thread Andrews, Chris
The main issue is that the original distributions are the same, you shift the two samples *by different amounts* (about 0.01 SD), and you have a large (n=1000) sample size. Thus the new distributions are not the same. This is a problem with testing for equality of distributions. With large s

Re: [R] rename columns with pattern

2015-01-12 Thread Ivan Calandra
Hi! Nice example! You just need to learn about the functions names() and paste(): names(dff)[1:6] <- paste("bp", 1:6, sep="_") HTH, Ivan -- Ivan Calandra, ATER University of Reims Champagne-Ardenne GEGENAA - EA 3795 CREA - 2 esplanade Roland Garros 51100 Reims, France +33(0)3 26 77 36 89 ivan.

[R] rename columns with pattern

2015-01-12 Thread Kuma Raj
I want to rename columns 1 to 6 in the sample data set as bp_1 to bp_6. How could I do that in R? Thanks > dput(dff) structure(list(one = c(1.00027378507871, 0.982313483915127, 1.1531279945243, 1.07400410677618, 1.22710472279261, 1.19762271047046, 1.10904859685147, 1.32060232717317), two = c(1.0

Re: [R] ggplot barchart: bars don't stock on breaks

2015-01-12 Thread Boris Steipe
Barcharts are for categorical data, the axis only serves to organize the category labels. From the sound of it, you are looking for a histogram. Hope this helps, Boris On Jan 12, 2015, at 8:31 AM, najuzz wrote: > Hi guys, I have the following weired problem. I just want a simple barchart, > b

Re: [R] R vs. RStudio?

2015-01-12 Thread peter dalgaard
On 12 Jan 2015, at 09:28 , Jeff Newmiller wrote: > If you have two screens the "zoom" plot window can fill the second screen. > Some laptops can handle a second external screen if you use a docking station. Unfortunately, such luxury is not available in the classroom. All too often, the proje

[R] ggplot barchart: bars don't stock on breaks

2015-01-12 Thread najuzz
Hi guys, I have the following weired problem. I just want a simple barchart, but the visuals are different from what I expect. xx<-as.vector(xx) xx[1:4852]<-0 xx[4853:5941]<-1 table(xx) x<-data.frame(xx) ggplot(x,aes(xx))+geom_bar(binwidth = 0.5)

Re: [R] nonmonotonic glm?

2015-01-12 Thread Vito M. R. Muggeo
dear Stanislav, Your data show two slopes with a kink at around 0. Thus, yet another approach would be to use segmented regression to fit a piecewise linear relationship with unknown breakpoint (being estimated as part of model fitting). While the resulting fitting is likely to be (slightly) wo

Re: [R] nonmonotonic glm?

2015-01-12 Thread Stanislav Aggerwal
Thanks very much Marc and Ben for the helpful suggestions Stan On Sun, Jan 11, 2015 at 10:28 PM, Ben Bolker wrote: > If you're going to use splines, another possibility is mgcv::gam (also > part of standard R installation) > > require(mgcv) > gam(DV ~ s(IV), data= YourDataFrame, family=bino

Re: [R] Change of locale

2015-01-12 Thread Prof Brian Ripley
You don't want to change the locale, rather the message language. That is not a locale, and e.g. LANGUAGE=en is the correct form. See http://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Localization-of-messages for what may be possible during a session: nothing is guaranteed. Docu

Re: [R] Calculate the median age interval

2015-01-12 Thread Ted Harding
Sorry, a typo in my reply below. See at "###". On 12-Jan-2015 11:12:43 Ted Harding wrote: > On 12-Jan-2015 10:32:41 Erik B Svensson wrote: >> Hello >> I've got a problem I don't know how to solve. I have got a dataset that >> contains age intervals (age groups) of people and the number of pers

Re: [R] Calculate the median age interval

2015-01-12 Thread Ted Harding
On 12-Jan-2015 10:32:41 Erik B Svensson wrote: > Hello > I've got a problem I don't know how to solve. I have got a dataset that > contains age intervals (age groups) of people and the number of persons in > each age group each year (y1994-y1996). The number of persons varies each > year. I only ha

Re: [R] Calculate the median age interval

2015-01-12 Thread Jose Iparraguirre
Dear Erik, There may be more elegant solutions, but try this: a. Create a data frame with your data, for example data <- data.frame(agegrp, y1994, y1995, y1996) b. Then use the which function: as.character(aa$agegrp[which(aa$y1994==23)]) Hope it helps, José Prof. José Iparraguirre Chief Ec

[R] Calculate the median age interval

2015-01-12 Thread Erik B Svensson
Hello I've got a problem I don't know how to solve. I have got a dataset that contains age intervals (age groups) of people and the number of persons in each age group each year (y1994-y1996). The number of persons varies each year. I only have access to the age intervals, not the age of each perso

Re: [R] Suggestions for workaround for R Markdown problem with data() ?

2015-01-12 Thread Jeff Newmiller
When you start off by saying it works fine in the console, it starts sounding like not a question that belongs here. It actually is possible to run knitr/rmarkdown in the console without RStudio, so you could try that but to me it sounds suspiciously like a bug in RStudio. Ask on their support f

Re: [R] R vs. RStudio?

2015-01-12 Thread Jeff Newmiller
If you have two screens the "zoom" plot window can fill the second screen. Some laptops can handle a second external screen if you use a docking station. --- Jeff NewmillerThe . . Go

Re: [R] Suggestions for workaround for R Markdown problem with data() ?

2015-01-12 Thread ONKELINX, Thierry
Dear Molly, Is the package in which the data is stored loaded in the Rmd? If not try library(yourPackage) data(yourData) or data(yourData, package = "yourPackage") If this doesn't solve your problem, please provide a minimal reproducible example of the problem. Best regards, Thierry ir. Th

[R] Suggestions for workaround for R Markdown problem with data() ?

2015-01-12 Thread Molly Elliott
R version: 3.1.2 (2014-10-31) RStudio version: 0.98.1091 MacOS X Yosemite v. 10.10.1 When I run the following in the console, all is well: data(IlluminaHumanMethylation450kanno.ilmn12.hg19) Yet, when I compile in my .Rmd file, in RStudio (knit to PDF), I get the following error: Error in file(fi

[R] Need help on Support. CEs

2015-01-12 Thread 朴美艳
Hi, I am a student from Korea. Currently I use Support. CEs package to conduct a choice-based conjoint analysis, but encounter some problems.I hope I can get a solution here. Here's my problem.I 've done the design matrix data set, and have a respondent data set. But when I try to use the "make.

Re: [R] list of vectors which are part of an initial vector

2015-01-12 Thread Jeff Newmiller
library(gtools) running(1:5, fun=I, align="center", width=3, allow.fewer=TRUE)[c(-1,-7)] Clue found at http://stackoverflow.com/questions/1311920/lagging-variables-in-r --- Jeff NewmillerThe .

Re: [R] R vs. RStudio?

2015-01-12 Thread peter dalgaard
> On 11 Jan 2015, at 11:30 , Duncan Murdoch wrote: > > > - I don't like the tiled display. I find it doesn't give me enough space. > This is a mixed blessing. For teaching purposes, it helps avoid shuffling windows to uncover the editor, graph window, and terminal in order to demonstrate v