Displaying 20 results from an estimated 700 matches similar to: "sum of deviations from the weighted mean"
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
2010 Dec 10
3
(no subject)
Hi R-help,
I am trying to find a way to select five highest values in data frame
according some variable. I will demonstrate:
c
   X1 X2
1   1  1
2   1  2
3   1  3
4   1  4
5   1  5
6   1  6
7   1  7
8   1  8
9   1  9
10  1 10
11  2 11
12  2 12
13  2 13
14  2 14
15  2 15
16  2 16
17  2 17
18  2 18
19  2 19
20  2 20
21  2 21
22  2 22
23  2 23
24  2 24
25  2 25
So I
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
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
2013 Apr 23
1
Automation of R input
Hi all,
I have R script which during its run require an input like this:
choose between one of the grouping factor available :
c("Village", "Country")
can I automate this part, in other word to pass for example Village when I
am running the script.
One more thing the script is the TimeSeriesAnalysis {ndvits}.
Thanks in advance for any help or suggestion.
Regards,
 Vahe
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
2012 Apr 14
1
Error: R for Windows GUI front-end has stopped working
Hi all.
I found one situation, on my OS - Windows 7,  where R stops working
with reported error R for Windows GUI front-end has stopped working.
Here is the example:
library(plyr)
DF <- data.frame(x=c(1:3, NA, NA), y=factor(sample(1:3,5,rep=T),levels=1:5))
DF[DF$x<3, ]
#this works properly
ddply(DF, .(y), nrow, .drop=FALSE)
#this causes the problem
ddply(DF[DF$x<3, ], .(y), nrow,
2006 Apr 11
1
cph() in Design package
Hi there, I encountered a weird problem using cph()
with Design package:
I have 2 datasets, say "dat1" and "dat2", both data
frames with 3 columns "time","status" and "scores",
all numeric
If I run the following:
dd<-datadist(dat1)
options(datadist='dd')
dd
                 time status   scores 
     Low:effect  37.0      0   -6.018
 
2010 Dec 12
1
list manipulation
Hi R users!
Does anyone know command similar to cbind for adding a column to a object of
the list. For example on this list:
> c1
$`1`
x11 x22
1 1 1
2 1 2
3 1 3
4 1 4
5 1 5
$`2`
x11 x22
6 2 6
7 2 7
8 2 8
9 2 9
10 2 10
11 2 11
i would like to add column, named random created with - runif(5)-, to the
first object in order to obtain something like this:
> c1
$`1`
 x11 x22 random
1 1 1     
2013 Feb 04
6
Script for conditional sums of vectors
Hi guys,
I hope you can help me with this (probably) simple query:
I have a data frame:
--------------------------
a=c(1,1,1,1,1,1,2,2,2,2,2,2)
b=c(1,1,1,2,3,4,1,1,2,2,3,4)
c=c(400,200,300,100,500,300,200,100,500,400,200,100)
data=data.frame(a=a,b=b,c=c)
--------------------------
And I would like to get the following output:
--------------------------
	b
a	1	2	3	4
1	900	100	500	300
2
2011 Jun 11
3
rcspline.plot query
Dear all,
 As I am new to the R community - although eager to advance- I would 
 like to pose a question to the community.
 I have an SPSS file which I have imported it in R (with the read.spss 
 command) which conists of scale (continuous) variable "adiponectin" and 
 the corresponding categorical value "death" (0=No, 1=Yes). In all there 
 are 60 observations (among which
2010 Sep 17
1
how to import this kind of data?
Dear All,
I am in a trouble with reading data.
It is in txt file looking like this.
 0.00632  18.00   2.310  0  0.5380  6.5750  65.20  4.0900   1  296.0  15.30
  396.90   4.98  24.00
 0.02731   0.00   7.070  0  0.4690  6.4210  78.90  4.9671   2  242.0  17.80
  396.90   9.14  21.60
 0.02729   0.00   7.070  0  0.4690  7.1850  61.10  4.9671   2  242.0  17.80
  392.83   4.03  34.70
 0.03237   0.00