Displaying 20 results from an estimated 300 matches similar to: "svyhist"
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
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
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
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,
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
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 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 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
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 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()
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 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
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
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 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 <-
2009 Feb 07
0
Problems with svyhist
I have two problems with svyhist. I hope this is easy, and it may be
that "simple R syntax" will do what I need.
1) I'm able to get a single plot out, but I need to put two
distributions in the same graphic to visually compare them.
2) I get uniform breaks at intervals of 10. I can plot the unweighted
data using MyBreaks with hist as shown in the second code snippet
2003 Feb 12
2
Various Errors using Survey Package
Hi,
I have been experimenting with the new Survey package. Specifically, I was
trying to use some of the functions on the public-use survey data from NHIS
(2000 Sample Adult file).
Error 1): The first error I get is when I try to specify the complex survey
design.
nhis.design<-svydesign(ids=~psu, probs=~probs, strata=~strata, data=nhis.df,
check.strata=TRUE)
Error in svydesign(ids =
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