Displaying 20 results from an estimated 1100 matches similar to: "Contributed Packages - Hmisc & survey"
2012 Oct 10
2
svyplot
Hello,
Using the svyplot () function, I have plotted four graphs that 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,
2011 May 24
1
R in batch mode
Hi Everyone,
I am a new R user and trying to run R jobs in batch mode.
Robert Muenchen (2009), in his book "R for SAS and SPSS Users", has suggested writing a small batch file like mR.bat as shown below:
"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
2012 Dec 31
3
cut ()
Hello List,
My goal is to create a 5 category variable (p1_st_data$ob_mrj_cat), based on the p1_st_data$obt_mrj_p variable, using the following code for 50 States and District of Columbia (N=51).
p1_st_data$ob_mrj_cat <- cut (p1_st_data$obt_mrj_p, quantile (p1_st_data$obt_mrj_p, (0:5/5), include.lowest=TRUE))
The issue is that, for Utah, I am getting an <NA> instead of (42,48.7] in
2012 Oct 05
1
svyhist
Hello,
I was trying to draw histograms of age at death and got the following 2 error messages:
1) Error in tapply(1:NROW(x), list(factor(strata)), function(index) { :
arguments must have same length
2) Error in findInterval(mm[, i], gx) : 'vec' contains NAs
In addition: Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) :
2012 Oct 02
2
svyby and make.formula
Hello,
Although my R code for the svymean () and svyquantile () functions works fine, I am stuck with the svyby () and make.formula () functions. 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
2013 Jan 08
2
Applying a user-defined function
Hello List,
My goal is to apply a user-defined function on several columns of a data frame. When testing the code on a reproducible example below, I get the following error message.
> #now Write a new function using the above cut ()/quantile function to apply on different columns of the data frame
>
> CutQuintiles <- function(x) {
+ cut (test1$x,quantile (test1$x,
2012 Dec 14
1
format.pval () and printCoefmat ()
Hi List,
My goal is to force R not to print in scientific notation in the sixth column (rel_diff - for the p-value) of my data frame (not a matrix).
I have used the format.pval () and printCoefmat () functions on the data frame. The R script is appended below.
This issue is that use of the format.pval () and printCoefmat () functions on the data frame gives me the desired results, but coerces
2012 Nov 22
1
Data Extraction - benchmark()
Hi Berend,
I see you are one of the contributors to the rbecnhmark package.
I am sorry that I am bothering you again. I have tried to run your code (slightly tweaked) involving the benchmark function, and I am getting the following error message. What am I doing wrong?
Error in benchmark(d1 <- s1(df), d2 <- s2(df), d3 <- s3(df), d4 <- s4(df), :
could not find function
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
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 03
1
Logical vector-based extraction
Hello,
The most part of the program works except that the following logical variable 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
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))
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
2014 Nov 14
1
file.copy
Hello,
Here is something (file.copy) trivial but does not seem to work. I could not figure out what I am doing wrong.
The R script below creates folders (fromFolder and 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
2014 Nov 10
2
range () does not remove NA's with complete.cases() for dates (dplyr/mutate)
Hello,
The range() with complete.cases() removes NA's for the date variables that 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
2012 Oct 14
2
svyhist and svyboxplot
Hello,
The following code is expected to produce 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
2014 Nov 09
4
Getting the most recent dates in a new column from dates in four columns using the dplyr package (mutate verb)
Hello,
The example data frame in the reproducible code below has 5 columns (1 column for id and 4 columns for dates), and there are 7 observations. I would like to insert the most recent date from those 4 date columns into a new column (oiddate) using the mutate() function in the dplyr package. I am getting correct results (NA in the new column) if a given row has all NA's in the four
2012 Dec 08
4
read.table()
Hi List,
I have spent 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 <-
2011 Nov 15
1
Help with "error: no acceptable C compiler found in $PATH"
Dear all,
I am trying to install a package from bioconductor (biomaRt) for which I
need the RCurl package. I get the following main error message when I try
to install RCurl (and its dependencies).
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
ERROR: configuration failed for package ‘RCurl’
I searched for possible solutions and read in some
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