Displaying 20 results from an estimated 20000 matches similar to: "subset select="variable with a list of names""
2012 Jun 19
2
matchit - can I weight the parameters?
This may be a really obvious question but I just can't figure out how to do it.
I have a small dataset that I am trying to compare to some controls. It is essential that the controls are matched on Cancer Stage (a numerical factor between 1 and 4), and then ideally on Age (integer), Gender (factor), Performance Status(factor).
I'm using matchit to try and do this, but it seems to give
2013 Feb 07
4
Sourcing my file does not print command outputs
I looked at the documentation of source() and summary(), and I could not
find the reason why calling something like:
> summary(resamps)
from the command line, works (it prints the summary)
whereas calling
summary(resampls)
from a file that I source with source("my_file.r") does not print anything.
How can I get summary(resamps) to print when I source a file with this
command?
2010 Oct 20
1
Problem exporting data using write.foreign
My question is about the write.foreign() command in the foreign
package. I use a command like the following to try and output data
and a code file to read my data into SAS.
write.foreign(data.frame.object, datafile="filepath",
codefile="filepath", package="SAS", dataname="myData")
With my data set, it gives the following error:
Error in
2011 Nov 16
4
Pairwise correlation
Dear All,
I am not familiar with R yet I want to use it to perform some task, hence my
posting here. I hope someone can help.
I have a set of data, genes (rows) and samples (columns). I want to do a
Pearson correlation on all the possible pairwise combinations of all the
genes (2000). Does anyone have an idea of how to execute this in R?
Thanks in advance.
--
View this message in context:
2009 Apr 15
2
problem with read.table
Hi all,
I've simple code to read a file (verify.txt in the same directory as the script file) but when I run this I get
"Error in eval(expr, envir, enclos) : object "y" not found".
data_model.df = read.table("./verify.txt", header=TRUE, nrows=10);
f <- lm(y ~ x)
Could someone pls tell me what's wrong with this code?
Sincere thanks!
2012 Jun 12
6
Attempting to update from R 2.14 to 2.15
I am very new to Linux so I probably am doing something stupid but I cannot seem to update to R 2.15
Using Ubuntu 12.02 Precise Penguin
I realise that debian packages are not updated regularly so I tried to follow the insructions at the R-site
So far, I have modified /etc/apt/sources.list to read
## R CRAN added 2012-06-12
deb http://probability.ca/cran/bin/linux/debian squeeze-cran/
Issued
2011 Mar 01
3
Difference in numeric Dates between Excel and R
Hello. I am using some dates I read in excel in R. I know the excel origin
is supposed to be 1900-1-1. But when I used as.Date with origin=1900-1-1 the
dates that R reported me where two days ahead than the ones I read from
Excel. I noticed that when I did in R the following:
> as.Date("2011-3-4")-as.Date("1900-1-1")
Time difference of 40604 days
but if I do the same
2010 Dec 06
5
How can I refer to actual (n) and previous (n-1) elements in a vector?
Hello,
How can I apply a function on a vector that refers to actual (n) and previous elements in the vector (e.g. n-1)?
For example:
I would like to calculate the sum of (n-1) + n for each element of a vector and get a vector as a result.
Besides others I tried this:
v<-c(3,6,8,1,1,3,9,5,6,3)
for (i in 1:NROW(v)){a[i]<-a[i-1]+a[i]}
I would like to get this result:
2008 Sep 10
4
re flecting a line
Suppose x and y are numeric vectors of the same length.
plot(x,y) #scatterplot
lmObj1 <- lm(y~x) # best fit line
abline(lmObj1) # good
lmObj2 <- lm(x~y) #get best fit but with axes interchanged
abline(lmObj2) # not what I want. I want the correct line, drawn on the same
graph, but with
# response and predictor variables interchanged
One way to proceed would be to
2010 Feb 25
5
Plotting 15 million points
Hi All
I have a vector of about 15 million numbers which I would like to
plot. The goal is the see the distribution. I tired the usual steps.
1. Histogram : never gets complete my window freezes w/out log base 10
2. Density : I first calculated the kernel density and then plotted
it which worked.
It would be nice to superimpose histogram with density but as of now I
am not able to get this
2010 Dec 06
3
How to this SAS transport file in R?
Dear All,
I try to read the SAS transport file in R, but it shows error. Please help!
I am using R 2.11.1
library(foreign)
download.file("http://isites.harvard.edu/fs/docs/icb.topic35387.files/demo_c.xpt","C:/Desktop/demo_c.xpt")
sasxport <- read.xport("C:/Desktop/demo_c.xpt")
Error in lookup.xport(file) : file not in SAS transfer format
--
View this
2009 Oct 20
2
Problems importing Unix SAS .ssd04 file to R (Win)
Hello,
I'm trying to import a SAS file made using SAS on Unix. Currently I'm
using SAS on Windows and I'm trying to import that .ssd04 file to R.
The file name of the file is testfile.ssd04 and it is located in
'M:\sasuser'. I'm using Windows XP and R 2.91. Basically what I'm
doing is
############ r code ##############
> library(foreign)
> sashome <-
2013 Feb 12
7
Is there a neat R trick for this?
Hello all,
given two vectors X and Y I'd like to receive a vector Z which
contains, for each element of X, the index of the corresponding
element in Y (or NA if that element isn't in Y).
Example:
x <- c(4,5,6)
y <- c(10,1,5,12,4,13,14)
z <- findIndexIn(x, y)
z
[1] 5 3 NA
1st element of z is 5, because the 1st element of x is at the 5th position in y
2nd element of z is 3,
2012 Feb 14
1
sequential sum
Dear R users,
I am trying to sum number that exist in another vector up to i, then
increment i and repeat.
Sorry. It's hard to explain but basically I am trying to do the following:
test <- c(1,2,3,4);
test2 <- c(3,5,6,7,2,8,8,4,4);
test3 <- c(10,20,30,40);
tmp <- 0;
for (i in 1:length(test)){
tmp[i] <- sum(test3[which(test[1:i] %in% test2)]);
}
so when i = 1, tmp[i] = 0
2012 Nov 15
3
Can you have a by variable in Lag function as in SAS
Hello,
I want to use lag on a time variable but I have to take date into
consideration ie I don't want days to overlap ie:
I don't want my first time of today to match my last time of yeterday.
In SAS I would use :
data x;
set y;
by date tim;
previous=lag(tim);
if first.date then
do;
previous=.;
end;
run;
How can I do something similar in R? I can't find
2011 Feb 08
1
FP growth in R?
Does anyone know of an R interface to Christian Borgelt's implementation of
the FP growth algorithm?
thanks a lot
Rob Tibshirani
--
I get so much email that I might not reply to an incoming email, just because
it got lost. So don't hesitate to email me again. The probability of a
reply should
increase.
Prof. Robert Tibshirani
?Depts of Health Research and Policy, and Statistics
2009 Apr 21
1
sas.get() exit
Hello,
I am trying to import SAS files into R using sas.get() in Hmisc. I am
running both SAS and R on a UNIX server. I've pasted my command and
ensuing errors below:
sas.get(lib="EOG", mem="eog3pub00_1")
Error in if (status != 0) { : argument is of length zero
In addition: Warning message:
In sas.get(lib = "EOG", mem = "eog3pub00_1") :
2011 Dec 14
2
Omit Inf
Hi all
> a<-c(2,Inf)
> max(a)
[1] Inf
>
How can I say...omit Inf?
I cannot find anything...
[[alternative HTML version deleted]]
2013 Jan 09
1
How to estate the correlation between two autocorrelated variables
Dear R users,
In my data, there are two variables t1 and t2. For each observation of t1
and t2, two location indicators (x, y) were provided.
The data format is
# x y t1 t2
Since the both t1 and t2 are depended on x and y, t1 and t2 are
autocorrelated variables. My question is how to calculate the correlation
between t1 and t2 by taking into account the structure of residual variance
2008 Aug 12
1
arima forecast function
hi:
I am trying to fit prediction intervals for an arima object. My search led
me to the link:
http://finzi.psych.upenn.edu/R/library/forecast/html/forecast.Arima.html
which has the function "forecast", as I wanted. However, when I try to run
it in R, I get the message:
Error in plot(forecast(fit)) : could not find function "forecast"
Even the example provided on the page