search for: pradip

Displaying 20 results from an estimated 21 matches for "pradip".

2012 Oct 10
2
svyplot
...hat are saved in four different .png files. I am looking for examples how to redraw the same four graphs within grid viewports so that they stay together on a page. The goal is to create one .png file that will include all four graphs (2 rows, 2 columns). Any help would be appreciated. Thanks, Pradip Pradip K. Muhuri, Statistician Substance Abuse & Mental Health Services Administration The Center for Behavioral Health Statistics and Quality Division of Population Surveys 1 Choke Cherry Road, Room 2-1071 Rockville, MD 20857 Tel: 240-276-1070 Fax: 240-276-1260 e-mail: Pradip.Muhuri@samhsa.h...
2012 Nov 20
4
github
Hello, I would like to learn how to set up Github/repository and upload/update files and am looking for "Github for Dummies". Any help will be appreciated. Thanks, Pradip
2012 Nov 24
5
subsetting - questions
Hello, I have two very basic questions (console attached): 1) What am I getting an error message for # 5 and # 7 ? 2) How to fix the code? I would appreciate receiving your help. Thanks, Pradip Muhuri ###### Reproducible Example ##### N <- 100 set.seed(13) df<-data.frame(matrix(sample(c(1:10),N, replace=TRUE),ncol=5)) keep_var <- c("X1", "X2") drop_var <- c("X3", "X4", "X5") df[df$X1>=8,] [,1:2] #1...
2012 Oct 02
2
svyby and make.formula
...I got the following error messages. - Error: object of type 'closure' is not subsettable # svyby () - Error in xx[[1]] : subscript out of bounds # make.formula () A reproducible example is appended below. I would appreciate if someone could help me. Thank you in advance. Pradip Muhuri ####Below is a reproducible example ########################################## setwd ("E:/RDATA") library (survey) xd1 <- "dthage ypll_ler ypll_75 xspd2 psu stratum wt8 mortstat NA NA NA 2 1 1 1683.7387 0 NA...
2011 May 24
1
R in batch mode
...C:\Program File\R\R-2.10.0\bin\Rterm.exe" --no-restore --no-save < %1 > %1.Rout 2>& 1 Could anyone tell me in which directory or subdirectory I should save the mR.bat file? I would appreciate receiving any support you could extend on this subject. Thank you in advance, Pradip Pradip K. Muhuri, PhD Statistician Substance Abuse & Mental Health Services Administration The Center for Behavioral Health Statistics and Quality Division of Population Surveys 1 Choke Cherry Road, Room 7-1023 Rockville, MD 20857 Tel: 240-276-1070 Fax: 240-276-1260 e-mail: Pradip.Muhuri@sam...
2012 Nov 22
4
Data Extraction
Hello, I would appreciate if someone could help me resolve the following: 1. df1[!is.na( X1 | X2 | X3 | X4 | X5),][,1:5] # This does not work 2. Is these message harmful? The following object(s) are masked from 'df1 (position 3)': X1, X2, X3, X4, X5 Thanks, Pradip Muhuri #Reproducible Example set.seed(5) df1<-data.frame(matrix(sample(c(1:10,NA),100,replace=TRUE),ncol=5)) attach (df1) #delete rows if any of them NA for X1 df1[!is.na( X1),][,1:5] # This works #delete rows if any of them NA for X1, X2, X3, X4 or X5 df1[!is.na( X1 | X2 | X3 | X4 | X5),][,1...
2012 Dec 31
3
cut ()
...of (42,48.7] in the ob_mrj_cat column. Is there a way to tweak the code (i.e., programmatically) to resolve the issue? I would appreciate receiving your help. Happy New Year and Best Wishes to R Expert-members, who have been so kind and helpful to beginner R users like me. Thanks and regards, Pradip Muhuri ########################## console followed the reproducible example ####### > table(p1_st_data$ob_mrj_cat) (42,48.7] (48.7,50.9] (50.9,52.8] (52.8,54.2] (54.2,58.7] 10 10 10 10 10 > p1_st_data [p1_st_data$state =="Utah",]...
2013 Jan 08
2
Applying a user-defined function
...e () on every odd-numbered columns of the "test1" data frame > newcols <- sapply(test1 [, seq (1,6,2)], CutQuintiles) Error in cut.default(test1$x, quantile(test1$x, (0:5/5)), include.lowest = TRUE) : 'x' must be numeric I would appreciate receiving your advice. Thanks, Pradip ###### The reproducible example begins here test1 <- read.table (text= "State,ObtMj_P,ObtMj_SE,ExpPrevMed_P,ExpPrevMed_SE,ParMon_P,ParMon_SE Alabama,49.60,1.37,80.00,0.91,12.10,0.68 Alaska,55.00,1.41,81.80,1.08,12.40,0.90 Arizona,52.50,1.56,79.60,1.20,15.80,1.08 Arkansas,50.50,1.22,78.00,...
2011 Jun 01
1
Contributed Packages - Hmisc & survey
Hello List, Could someone tell why I can't install the Himsc and survey packages for R version 2.13.0 (2011-04-13)? What am I doing wrong here? Thanks, Pradip > install.packages ("Hmisc", dependencies=TRUE) --- Please select a CRAN mirror for use in this session --- Warning: unable to access index for repository http://watson.nci.nih.gov/cran_mirror/bin/windows/contrib/2.13 Warning message: In getDependencies(pkgs, dependencies, available,...
2012 Oct 05
1
svyhist
...'vec' contains NAs In addition: Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) : no non-missing arguments to max; returning -Inf I would appreciate if someone could help me resolve these issues. Below is reproducible example. Thanks, Pradip Muhuri setwd ("E:/RDATA") options(width = 120) library (survey) library (KernSmooth) xd1 <- "dthage ypll_75 xspd2 psu stratum wt8 56 19 2 2 33 1512.7287 86 0 2 2 129 1830.6400 81 0 2 1 67 536.1400 47 28 2...
2012 Nov 20
2
kinitr
Hello, I am an Intro-level R and ggplot2 user and looking for resources to self teach dynamic report generation in R using knitr. Any advice would be highly appreciated. Thanks, Pradip
2012 Nov 22
1
Data Extraction - benchmark()
...attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] rbenchmark_1.0.0 loaded via a namespace (and not attached): [1] tools_2.15.1 I would appreciate receiving your help if your time permits .. Thanks and regards, Pradip Muhuri ##### Berend's code extended N <- 100000 set.seed(13) df<-data.frame(matrix(sample(c(1:10,NA),N, replace=TRUE),ncol=50)) s1 <- df[complete.cases(df),] s2 <- na.omit(df) s3 <- df[apply(df, 1, function(x)all(!is.na(x))), ] s4 <- function(df) {df[apply(df, 1, function(x)...
2012 Dec 14
1
format.pval () and printCoefmat ()
...ect is a data frame, not a matrix. Please see the first output below: contrast_level1 contrast_level2). Is there a way I could have avoid printing the NAs in the character fields when using the format.pval () and printCoefmat () on the data frame? I would appreciate receiving your help. Thanks, Pradip setwd ("F:/PR1/R_PR1") load (file = "sigtests_overall_withid.rdata") #format.pval(tt$p.value, eps=0.0001) # keep only selected columns from the above data frame keep_cols1 <- c("contrast_level1", "contrast_level2","mean_level1",...
2012 Nov 03
1
Logical vector-based extraction
...ariable does not get created although the second logical variable-based extraction works. I don't understand what I am doing wrong here. state_pflt200 <- df$p_fatal <200 df[state_pflt200, c("state.name","p_fatal")] I would appreciate receiving your help. Thanks, Pradip Muhuri ##### Below is the code that includes the reproducible example. df <- data.frame (state.name= c("Alabama","Alaska","Arizona","Arkansas","California","Colorado","Connecticut", &q...
2012 Oct 14
2
svyhist and svyboxplot
...e 4 charts. But, I only get charts 1,2 ,& 4, NOT CHART # 3. For Chart# 3, I am getting the following error message: Error in tapply(1:NROW(x), list(factor(strata)), function(index) { : arguments must have same length I would appreciate if someone could help me resolve the issue. Thanks, Pradip # BELOW IS THE REPRODUCIBLE EXAMPLE setwd ("E:/RDATA") options(width = 120) library (survey) library (KernSmooth) xd1<- "xsmoke age_p psu stratum wt8 13601 3 22 2 20 356.5600 32966 3 38 2 45 434.3562 63493 1 32 1 87 699.9...
2014 Nov 14
1
file.copy
...d toFolder) and finds the list of files (list.of.files) to be copied to the toFolder, which I have verified using the print () command. But, the issue is that the file.copy() command does not work. Both the R.script and the console are shown below. Any help/hints will be appreciated. Thanks, Pradip Muhuri ######################### R script ##################################################### #file.copy.R #identify the folders fromFolder <- "H:/R/cis_study" toFolder <- "F:/cis_study_backup" # find the list of files to copy list.of.files <- list.files(fromFol...
2014 Nov 10
2
range () does not remove NA's with complete.cases() for dates (dplyr/mutate)
...at are read from a data frame. However, the issue is that the same function does not remove NA's for the other date variable that is created using the dplyr/mutate(). The console and the reproducible example are given below. Any advice how to resolve this issue would be appreciated. Thanks, Pradip Muhuri ################# cut and pasted from the R console #################### id mrjdate cocdate inhdate haldate oiddate 1 1 2004-11-04 2008-07-18 2005-07-07 2007-11-07 2008-07-18 2 2 <NA> <NA> <NA> <NA> <NA> 3 3 20...
2014 Nov 09
4
Getting the most recent dates in a new column from dates in four columns using the dplyr package (mutate verb)
...ed into the new column (oidflag) is incorrect for 5 of the remaining 6 rows (with a non-NA value in at least 1 of the four columns). I would appreciate receiving your help toward resolving the issue. Please see the R console and the R script (reproducible example)below. Thanks in advance. Pradip ###### from the console ######## print (data2) id mrjdate cocdate inhdate haldate oidflag 1 1 2004-11-04 2008-07-18 2005-07-07 2007-11-07 2011-11-04 2 2 <NA> <NA> <NA> <NA> <NA> 3 3 2009-10-24 <NA&gt...
2012 Dec 08
4
read.table()
...more than 30 minutes, but failed to read in this file using the read.table() function. I could not figure out how to fix the following error. Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, : line 1 did not have 6 elements Any help would be be appreciated. Thanks, Pradip Muhuri ####### below is the reproducible example xd1 <- "race age percent sepercent flag_var Mexican 12-17 5.7926 0.64195 any Puerto Rican 12-17 5.1975 0.24929 any Cuban 12-17 3.7977 1.00487 any C-S American 12-17 4.3665 0.55...
2012 Oct 01
3
merge.zoo returns unmatched dates
Sorry for the lack of reproducible data, but this seems to be a problem inherent to my dataset and I can't figure out where the issue is. I have several data frames set up as a time series with identical POSIXct date formats. If I keep the original data in data frame format and merge them using base merge- everything is perfect and everyone is happy. If I transform the data frames to zoo