An embedded and charset-unspecified text was scrubbed... Name: not available Url: https://stat.ethz.ch/pipermail/r-sig-epi/attachments/20080328/1b99b9f4/attachment.pl
import data repeadeatly
3 messages · Henrik Kallberg, BXC (Bendix Carstensen), Randy Johnson
It's not entirely clear to me what goes on, but insert some commands that tells you what kind of structures you get and the dimension of them under way. str() is a good bet. Otherwise you must tell us in mor detail what goes wrong. regards, Bendix Carstensen ______________________________________________ Bendix Carstensen Senior Statistician Steno Diabetes Center Niels Steensens Vej 2-4 DK-2820 Gentofte Denmark +45 44 43 87 38 (direct) +45 30 75 87 38 (mobile) bxc at steno.dk http://www.biostat.ku.dk/~bxc
-----Original Message-----
From: r-sig-epi-bounces at stat.math.ethz.ch
[mailto:r-sig-epi-bounces at stat.math.ethz.ch] On Behalf Of
Henrik Kallberg
Sent: 28. marts 2008 08:08
To: r-sig-epi at stat.math.ethz.ch
Subject: [R-sig-Epi] import data repeadeatly
Repeadeately
Dear All!
I'm an unexperienced user of R. I'm trying to import
varaibles in a stepwise manner from a huge data set (whole
genome scan data from a case control study). I'm not sure
that my code will work and I know that the current code is
not working the way I want it to work. I would like to import
data and do some calculations and then store the results and
then import a new variable and do the same calculations again
for the latter variable and so on. In the code below there is
no calculations yet (i'm just trying to solve the import
problem). Please.Can anyone give me som suggestions.
snpSelect<<- function(data, KIND, i){
rsp<<-cbind(subset(read.table(data, header = TRUE),
select=KIND+i)) rsp } datan<-matrix(0, nrow=1574, ncol=5)
for(i in 1:(length(q))){
datan[,i]<<-snpSelect("c:/program/R/test.txt",KIND,i)
}
Best regards Henrik K?llberg
[[alternative HTML version deleted]]
See ?read.table for some helpful options. Also, you probably don't want to use <<- so much. <- should (almost) always be sufficient and is less likely to be the cause of strange bugs.
On Mar 28, 2008, at 3:08 AM, Henrik Kallberg wrote:
Repeadeately
Dear All!
I'm an unexperienced user of R. I'm trying to import varaibles in a
stepwise manner from a huge data set (whole genome scan data from a
case control study). I'm not sure that my code will work and I know
that the current code is not working the way I want it to work. I
would like to import data and do some calculations and then store
the results and then import a new variable and do the same
calculations again for the latter variable and so on. In the code
below there is no calculations yet (i'm just trying to solve the
import problem). Please.Can anyone give me som suggestions.
snpSelect<<- function(data, KIND, i){
rsp<<-cbind(subset(read.table(data, header = TRUE), select=KIND+i))
rsp
}
datan<-matrix(0, nrow=1574, ncol=5)
for(i in 1:(length(q))){
datan[,i]<<-snpSelect("c:/program/R/test.txt",KIND,i)
}
Best regards Henrik K?llberg
[[alternative HTML version deleted]]
_______________________________________________ R-sig-Epi at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-epi
|\ _____TTT_____/| |\ () (___|||___) \| ()