similar to: (no subject)

Displaying 20 results from an estimated 20000 matches similar to: "(no subject)"

2011 Dec 04
3
RODBC connect to Excel (64-bit Windows 7)
Hi to all. I have a problem to connect to an Excel database using RODBC. Namely, I am using 64-bit R 2.14.0, under Windows 7 and I tried following: library(RODBC) > channel <- odbcConnectExcel("results.xlsx") Error in odbcConnectExcel("results.xlsx") : odbcConnectExcel is only usable with 32-bit Windows # ok this is clear why it doesn't work > channel
2011 Mar 14
2
data.frame transformation
Hi R users, I have following data frame df<-data.frame(q1=c(0,0,33.33,"check"),q2=c(0,33.33,"check",9.156), q3=c("check","check",25,100),q4=c(7.123,35,100,"check")) and i would like to replace every element that is less then 10 with . (dot) in order to obtain this: q1 q2 q3 q4 1 . . check . 2 . 33.33 check 35
2013 Mar 20
3
highlight overlapping region of two densities
Hi all. I would like to highlight overlapping regions of two densities and I could not find a way to do it. Here is the sample code: myd <- c(2,4,5, 4,3,2,2,3,3,3,2,3,3,4,2,4,3,3,3,2,2.5, 2, 3,3, 2.3, 3, 3, 2, 3) myd1 <- myd-2 plot(range(density(myd)$x, density(myd1)$x), range(density(myd)$y, density(myd1)$y), type = "n") lines(density(myd), col=1, lwd=4)
2011 Mar 16
2
export list to csv
Hi everybody. I have list like this: l<-list(data.frame(q1=c(1,2,"check"),q2=c(3,"check",5)), data.frame(q1=c("check",1),q2=c(4,5))) names(l)<-c("A","B") rownames(l[[1]])<-c("aa","bb","cc") rownames(l[[2]])<-c("aa","bb") Every object has the same number of columns but different number
2011 Apr 12
2
Converting a categorical variable to multiple dichotemous variables
I have a categorical variable in a dataframe similar to the following... cat 1 1 3 2 4 I need to convert it to 4 dichotemous variables for each observations like... cat1 cat2 cat3 cat4 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 Thanks in advance! Shane
2011 Dec 08
1
sum of deviations from the weighted mean
Hi all. I tried to calculate sum of deviations from the weighted mean and i didn't get what i expected - 0. Here is an example: > wt <- c(10,25,38,22,5) > x <- 6:10 > wm <- weighted.mean(x,wt) > (x-wm)*wt [1] -18.70 -21.75 4.94 24.86 10.65 > sum((x-wm)*wt) [1] -1.24345e-14 With simple mean I got 0: > sum(x-mean(x)) [1] 0 Could someone explain me why we
2013 Apr 02
2
speedometer charts in R
Hi useRs. Does anybody know if there is some function that creates speedometer chart in R? Or if anybody has proposals where to start looking and which functions I can modify in order to create this kind of chart? Thanks for any help Andrija [[alternative HTML version deleted]]
2011 Dec 04
4
equating approximate values
Hello List, I am having trouble finding the command for my problem. I have two arrays x and y. now i would like to compare the values of x and y and then get the index of x which is exactly or approximately equal(+/- some value ) to the values in y. x <- runif(100,min=0,max=5) y <- runif(10,min=0,max=5) the threshold value(+/-) value can vary. for this example lets take it to be .5
2011 Jan 25
1
NA replacing
Hello R user, I have following data frame: df=data.frame(id=c(1:10),strata=rep(c(1,2),c(5,5)),y=c( 10,12,10,NA,15,70,NA,NA,55,100),x=c(3,4,5,7,4,10,12,8,3,15)) and I would like to replace NA's with: instead of first NA tapply(na.exclude(df)$y,na.exclude(df)$strata,sum)[1]* *7 */tapply(na.exclude(df)$x,na.exclude(df)$strata,sum)[1] where 7 is the value of x (id=4) in strata 1 where y=NA
2012 Apr 03
5
R equivalent for SQL query
Hi, I have a query which I would like to translate into R, but I do not know how to do it in an easy way. Assume a data frame has columns A, B and C: A B C 1 1 3 1 1 4 1 1 5 1 2 6 1 2 7 1 3 8 The query is as follows: select A, B, count(*) from data.frame group by A, B order by count(*) desc How do I translate this into R statements in such way that the result is a data frame structured as
2009 Jun 17
2
Re gression by groups questions
I have a large dataset grouped by a factor and I want to perform a regression on each data subset based on this factor. There are many ways to do this, posted here and elsewhere. I have tried several. However I found one method posted on the R wiki which works exactly as I want, and I like the elegance and simplicity of the solution, but I don't understand how it works. Its all in the formula
2009 Jun 23
1
How to exclude insignificant intercepts using "step" function
I posted this question way down at teh end of another thread realted to an error in step, but that was stupid since it really is another matter altogether. I should have posted it separately, as I have now done. The code below creates a data.frame comprising three marginally noisy surfaces. The code below (including a fix courtesy of David Winsemius that avoids a step function error through use
2003 May 19
1
plotting a simple graph
I am having great difficulty plotting what should be a simple graph. I have measured 1 'y' and 5 'x' variables in each of two groups. Linear regression shows significant differences in the slopes of the regression for each 'x' variable between the two groups. All that I want to do is to plot one graph that shows the scatterplot for the three groups (each group represented
2005 May 25
4
mixed model
Hello all, I have problem with setting up random effects. I have a model: y=x1+x2+x1*x2+z1+z1*x2 where x1, x2, x1*x2 are fixed effects and z1, z1*x2 are random effects (crossed effects) I use library(nlme) 'lme' function. My question is: how I should set up random effects? I did lme(y~x1+x2+x1:x2, data=DATA, random=~z1+z1:x2, na.action='na.omit') but it did not work.
2010 Mar 04
4
Analogue to SPSS regression commands ENTER and REMOVE in R?
I am not sure if this question has been asked before - but is there a procedure in R (in lm or glm?) that is equivalent to ENTER and REMOVE regression commands in SPSS? Thanks a lot! -- Dimitri Liakhovitski Ninah.com Dimitri.Liakhovitski at ninah.com
2011 Oct 31
3
How to get Quartiles when data contains both numeric variables and factors
When data contains both factor and numeric variables, how to get quartiles for all numeric variables? n <- 100 x1 <- runif(n) x2 <- runif(n) x3 <- x1 + x2 + runif(n)/10 x4 <- x1 + x2 + x3 + runif(n)/10 x5 <- factor(sample(c('a','b','c'),n,replace=TRUE)) x6 <- factor(1*(x5=='a' | x5=='c')) data1 <- cbind(x1,x2,x3,x4,x5,x6) data
2017 Oct 27
2
Bug in model.matrix.default for higher-order interaction encoding when specific model terms are missing
Hello Tyler, I want to bring to your attention the following document: "What happens if you omit the main effect in a regression model with an interaction?" (https://stats.idre.ucla.edu/stata/faq/what-happens-if-you-omit-the-main-effect-in-a-regression-model-with-an-interaction). This gives a useful review of the problem. Your example is Case 2: a continuous and a categorical regressor.
2011 Aug 10
1
subqueries in sqlQuery function (package RODBC)
Hi R users. sorry for missing example and if question is to general but I am wondering if it is possible to execute subqueries in function sqlQuery (package RODBC) with opened connection with Excel or SQL server 2000. I couldn't find any example of this. And if it is possible what should be a correct syntax for this query: SELECT ct,COUNT(*) as n FROM (SELECT COUNT(*) AS ct FROM children
2010 Dec 11
2
package sampling
Hi R users. I have a problem with function strata in sampling packages. > st0 = strata(dom, stratanames="stratas", size=sample.size, method="systematic",pik, FALSE) Error in sort.list(y) : 'x' must be atomic for 'sort.list' Have you called 'sort' on a list? In previous version of R 2.9.1 and previous version of package sampling this code worked
2010 Dec 19
1
package survey
Hi R users, could someone help me to find out which formulas, for standard error calculation, are used in following example: a=data.frame(weights=rep(c(10,1),c(4,1)),fpc=rep(41,5),uk=rep(1,5)) srs<-svydesign(id=~1, weights=~weights, data=a) srs1<-svydesign(id=~1, weights=~weights,fpc=~fpc, data=a) svytotal(~uk,srs) total SE uk 41 9 svytotal(~uk,srs1) total SE uk 41