Re: [R] Removing NAs from dataframe (for use in Vioplot)

2016-04-30 Thread Jeff Newmiller
But require() should not be used interchangeably with library()... the return value from require() should always be tested. -- Sent from my phone. Please excuse my brevity. On May 1, 2016 3:03:59 AM GMT+01:00, Tom Wright wrote: >Never let it be said there's only one way to

Re: [R] how to use AND in grepl

2016-04-30 Thread Tom Wright
Actually not sure my previous answer does what you wanted. Using your approach: t2pd=subset(df,grepl("t2",df$Command) & grepl("pd",df$Command)) Should work. I think the regex pattern you are looking for is: Subset(df,grepl("(.* t2.*pd.* )|(.* pd.* t2.*)",df$Command) On Sat, Apr 30, 2016,

Re: [R] how to use AND in grepl

2016-04-30 Thread Tom Wright
subset(df,grepl("t2|pd",x$Command)) On Sat, Apr 30, 2016 at 2:38 PM, ch.elahe via R-help wrote: > Hi all, > > I have one factor variable in my df and I want to extract the names from > it which contain both "t2" and "pd": > > 'data.frame': 36919 obs. of 162 variables >

Re: [R] Removing NAs from dataframe (for use in Vioplot)

2016-04-30 Thread Tom Wright
Never let it be said there's only one way to do a thing: require(ggplot2) require(dplyr) #create a sample dataset dat <- data.frame(y1=sample(c(1:10,NA),20,replace=TRUE), y2=sample(c(1:10,NA),20,replace=TRUE),

Re: [R] How to print the frequency table (produced by the command "table" to Excel

2016-04-30 Thread jpm miao
Thanks. Could we print the row/column names, "alpha1" and "alpha2" to the csv file? 2016-04-30 17:06 GMT-07:00 Jim Lemon : > Hi jpm miao, > I think you can get what you want like this: > > alpha1<-sample(LETTERS[1:3],50,TRUE) > alpha2<-sample(LETTERS[1:2],50,TRUE) >

Re: [R] Could not find function "pointsToRaster"

2016-04-30 Thread Ben Tupper
Hi, I think you need to check the order of your arguments to rasterize(). See the documentation with ?rasterize and compare to what you did below. Cheers, Ben > On Apr 30, 2016, at 9:55 AM, Ogbos Okike wrote: > > Dear All, > Thanks for your inputs. I did replace

Re: [R] Issue installing packages - Linux

2016-04-30 Thread Jim Lemon
Hi Lars, A mystery, but for the bodgy characters in your error message. Perhaps there is a problem with R trying to read a different character set from that used in the package. Jim On Sat, Apr 30, 2016 at 8:22 PM, Lars Bishop wrote: > Hello, > > I can’t seem to be able to

Re: [R] How to print the frequency table (produced by the command "table" to Excel

2016-04-30 Thread Jim Lemon
Hi jpm miao, I think you can get what you want like this: alpha1<-sample(LETTERS[1:3],50,TRUE) alpha2<-sample(LETTERS[1:2],50,TRUE) alphas<-data.frame(alpha1,alpha2) library(prettyR) alphatab<-xtab(alpha1~alpha2,alphas) sink("temp_table3.csv",append=TRUE) delim.xtab(alphatab,pct=NA,delim=",")

Re: [R] Removing NAs from dataframe (for use in Vioplot)

2016-04-30 Thread David Winsemius
> On Apr 30, 2016, at 4:16 PM, David Winsemius wrote: > > >> On Apr 30, 2016, at 12:58 PM, Mike Smith wrote: >> >> Hi >> >> First post and a relative R newbie >> >> I am using the vioplot library to produce some violin plots. It's a package,

Re: [R] Removing NAs from dataframe (for use in Vioplot)

2016-04-30 Thread David Winsemius
> On Apr 30, 2016, at 12:58 PM, Mike Smith wrote: > > Hi > > First post and a relative R newbie > > I am using the vioplot library to produce some violin plots. I have an input > CSV with columns off irregular length that contain NAs. I want to strip the > NAs out and

[R] CTree to obtain segmented data

2016-04-30 Thread Preetam Pal
Hi guys, I have a dataset obtained as: mydata <- read.csv("data.csv", header = TRUE) which contains the variable 'y' (y is binary 0 or 1) and some regressor variables. I want to apply the ctree technique on this data with the following requirements: 1> Of course I would need the tree plot (which

[R] Install R (version 3.2.5) in CentOS platform

2016-04-30 Thread wenbo
Hi, I want to install the latest R in CentOS. Below is the command line: ./configure --prefix=/home/fino/R/3.2.5/ --with-tcl-config=/home/fino/software/tcl8.6.1/lib/tclConfig.sh --with-tk-config= /home/fino /software/tk8.6.1/lib/tkConfig.sh --with-readline=yes --with-cairo=yes --without-x Below

[R] Removing NAs from dataframe (for use in Vioplot)

2016-04-30 Thread Mike Smith
Hi First post and a relative R newbie I am using the vioplot library to produce some violin plots. I have an input CSV with columns off irregular length that contain NAs. I want to strip the NAs out and produce a multiple violin plot automatically labelled using the headers. At the moment

[R] Data Issues with ctree/glm and controlling classification parameters

2016-04-30 Thread Preetam Pal
Hi, I have a dataset obtained as: mydata <- read.csv("data.csv", header = TRUE) which contains the variable 'y' (y is binary 0 or 1) and also another variable 'weight' (weight is a numerical variable - taking fractional values between 0 and 1). 1> I want to first apply ctree() on mydata, but

Re: [R] how to use AND in grepl

2016-04-30 Thread William Dunlap via R-help
Your code looks fine to me. What did t2pd look like? I tried reproducing the problem in R-3.2.4(Revised) and everything worked (although the output of str() looked a bit different - perhaps you have an old version of R) > df <- data.frame(TE=1:10, TR=101:110,

[R] how to use AND in grepl

2016-04-30 Thread ch.elahe via R-help
Hi all, I have one factor variable in my df and I want to extract the names from it which contain both "t2" and "pd": 'data.frame': 36919 obs. of 162 variables $TE:int 38,41,11,52,48,75,. $TR:int 100,210,548,546,. $Command :factor

Re: [R] How to print the frequency table (produced by the command "table" to Excel

2016-04-30 Thread jpm miao
Jim, Thanks for creating such a fantastic package "prettyR". I want to print the pretty frequency table (with row total and column total) to an excel (or csv ) file. Is it possible? >alphatab A B Total A 8 10 18 B 7 5 12 C 9 11 20 Total 24 26 50 Two issues I encountered (See the

Re: [R] 3D surface plot

2016-04-30 Thread Bert Gunter
There are several packages and functions that can do this (e.g. search on "3d surface plots" at rseek.org or internet search engine). You are much more likely to get a helpful answer if you provide a minimal data set (e.g. via dput() ) and code from any function(s) and package(s) that you tried.

[R] 3D surface plot

2016-04-30 Thread T.Riedle
Dear R users, I am trying to generate a 3D surface plot given the inflator formula in the attached file. Now, I want to create a 3D plot showing how Delta changes with the values of Abs(B) and sigma. The other variables in the formula are constant. Delta is calculated daily therefore the

Re: [R] selection columns by type, ie, numeric

2016-04-30 Thread Ranjan Maitra
It would have been more useful to the list and to posterity if you had summarized whatever it was that worked or solved your problem. This note is not very meaningful otherwise. On Sat, 30 Apr 2016 16:00:10 + (UTC) Carl Sutton via R-help wrote: > My  thanks to Bill

[R] selection columns by type, ie, numeric

2016-04-30 Thread Carl Sutton via R-help
My  thanks to Bill Dunlap and  Giorgio Garziano for  their help.   It is greatly appreciated.  I works so well, wow. Carl Sutton CPA [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

[R] Graphlet degree distribution agreement in

2016-04-30 Thread seema aswani
Hi all, I have created my network using igraph package. It provides graphlet function to calculate number of graphltes. I want to find graphlet degree distribution agreement of a graph. How can i achieve that..?? The package ergm.graphlets is there in r but there isn't any examples available for

Re: [R] Could not find function "pointsToRaster"

2016-04-30 Thread Ogbos Okike
Dear All, Thanks for your inputs. I did replace pointsToRaster () with raster::rasterize(). Below is part of my script. But I got another error: Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘rasterize’ for signature ‘"RasterLayer", "matrix"’

Re: [R] tcltk: click and return table cell index

2016-04-30 Thread Fox, John
Dear Daniel, Try tkbind(table1, "", function(){ res <- try(tclvalue(tkindex(table1, "active")), silent=TRUE) if (inherits(res, "try-error")) print (NULL) else print(res) }) I put in the calls to print() so that you could see how it works. I hope this helps, John

Re: [R] Package to work with weight based data

2016-04-30 Thread Joao Sollari Lopes
Hi Biswajit Kar, Take a look at this CRAN Task: https://cran.r-project.org/web/views/OfficialStatistics.html Also, I've been re-writing functions of package "ineq" so that they accept weights. I can provide those if you find them useful. Finally, there are a bunch of packages in CRAN that

Re: [R] Declaring All Variables as Factors in GLM()

2016-04-30 Thread Leonardo Ferreira Fontenelle
This should do the trick: history2 <- as.data.frame(lapply(history, as.factor)) Mind you that read.csv() by default reads string vectors as factors, so that declaring the variables as factors should only be necessary for the numeric ones, like income. Using as.factor() in factor variables may

[R] Unexpected scores from weighted PCA with svyprcomp()

2016-04-30 Thread Leonardo Ferreira Fontenelle
Hello! I'd like to create an assets-based economic indicator using data from a national household survey. The economic indicator is to be the first principal component from a principal components analysis, which (given the source of the data) I believe should take in consideration the sampling

Re: [R] Could not find function "pointsToRaster"

2016-04-30 Thread Leonardo Ferreira Fontenelle
Dear Ogbos Okike, I can't know how your script depends on pointsToRaster(), but googling around I found that the function seems to have been marked as obsolete: http://www.inside-r.org/packages/cran/raster/docs/linesToRaste Hope that helps, Leonardo Ferreira Fontenelle

Re: [R] Could not find function "pointsToRaster"

2016-04-30 Thread Ben Tupper
Hi, A terrific resource for this type of issue (and pretty much anything related to R) is http://rseek.org/ I'm sure I use it at least daily. Check out ... http://rseek.org/?q=pointsToRaster The first hit is about pointsToRaster() - it has been replaced by raster::rasterize() Cheers, Ben

[R-es] Mapas de vitoriaen R

2016-04-30 Thread Jesús Para Fernández
Buenas, �Qu� paquete de todos los que hay para graficar sobre mapas me recomendais para graficar sobre los codigos postales de la ciudad de Vitoria Gasteiz? GraciasJes�s [[alternative HTML version deleted]]

[R] Issue installing packages - Linux

2016-04-30 Thread Lars Bishop
Hello, I can’t seem to be able to install packages on a redhat-linux-gnu. For instance, this is what happens when I try to install “bitops”. Any hint on what might be the issue would be much appreciated. > sessionInfo() R version 3.2.3 (2015-12-10) Platform: x86_64-redhat-linux-gnu (64-bit)

[R] Could not find function "pointsToRaster"

2016-04-30 Thread Ogbos Okike
Dear All, I have a script that draws longitude and latitude of lightning occurrence. This script was running fine before. But when I changed my system and do a fresh install on another laptop, this error persist. source("script") Error in eval(expr, envir, enclos) : could not find function

[R] Declaring All Variables as Factors in GLM()

2016-04-30 Thread Preetam Pal
Hi guys, I am running glm(y~., data = history,family=binomial)-essentially, logistic regression for credit scoring (y = 0 or 1). The dataset 'history' has 14 variables, a few examples: history <- read.csv("history.csv". header = TRUE) 1> 'income = 100,200,300 (these are numbers in my dataset;