[R] glm automation

ronggui ronggui.huang at gmail.com
Wed Mar 8 03:12:21 CET 2006


2006/3/8, A Mani <a.manigs at gmail.com>:
> Hello,
>         I have two problems in automating multiple glm(s) operations.
> The data file is tab delimited file with headers and two columns. like
>
> "ABC"  "EFG"
> 1  2
> 2  3
> 3  4
> dat <- read.table("FILENAME", header=TRUE, sep="\t", na.strings="NA",
> dec=".", strip.white=TRUE)
> dataf <- read.table("FILENAME", header=FALSE, sep="\t", na.strings="NA",
> dec=".", strip.white=TRUE)
> norm1 <- glm(dataf[1,1] ~ dataf[1,2], family= normal(log), data=dat)
> norm2 <- glm(dataf[1,1] ~ dataf[1,2], family= normal(identity), data=dat)
> and so on.
It should be
 norm1 <- glm(dataf[,1] ~ dataf[,2], family= normal(log), data=dat)
 norm2 <- glm(dataf[,1] ~ dataf[,2], family= normal(identity), data=dat)

you should read the document of "[" about how to use index.

> But glm does not work on the data unless I write ABC and EFG there... I want
> to automate the script for multiple files.
>
> The other problem is to write the plot(GLM) to a file without  displaying it
> at stdout.
>
> Thanks,
>
>
> A. Mani
> Member, Cal. Math. Soc
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>


--
»ÆÈÙ¹ó
Deparment of Sociology
Fudan University




More information about the R-help mailing list