Displaying 5 results from an estimated 5 matches for "colname2".
Did you mean:
colnames
2011 Nov 26
2
simplify source code
Hi
I would like to shorten
mod1 <- nls(ColName2 ~ ColName1, data = table, ...)
mod2 <- nls(ColName3 ~ ColName1, data = table, ...)
mod3 <- nls(ColName4 ~ ColName1, data = table, ...)
...
is there something like
cols = c(ColName2,ColName3,ColName4,...)
for i in ...
mod[i-1] <- nls(ColName[i] ~ ColName1, data = table, ...)
I am loo...
2002 Nov 04
3
write table and dinnames
I would write in tab-text file a table like this one:
TAB colname1 TAB colname2 TAB TAB... colnameN
rowname1 # # #
rowname2 # # #
rownameM # # #
then I wrote something like:
mymatrix <- matrix(nrow=M,ncol=N,byrow=T)
rownames(mymatrix) <- chvector1
colnames(mymatrix) <- chvector2
write...
2007 Jun 06
2
lookup in CSV recipe
...l version - it''s also
only been tested for 5mins. Even so I thought it might be useful.
I thought about adding it to the wiki, but thought I should check here
first.
# lookup items from a CSV file
# v0.1 - 2007/06/06
# Adrian Bridgett, Opsera Ltd.
# file in the format of:
# colname1, colname2, colname3,... (must be first line)
# key1, value2, value3,...
# key2, value4, value5
#
# lookup_csv(filename,key1,colname3) will then return value3
#
# TODO:
# proper CSV parsing (e.g. quoting)
# regexp on the value?
# return a supplied default if row not found?
# add Excel and Openoffice support...
2008 Jun 21
1
passing arguments to a function problem
Dear R-users,
is there some way how to pass various colnames to the following code for
sorting data.frames?
mydf.ordered<-with(mydf, mydf[order(colname1,colname2, colnameX, decreasing
= TRUE), ])
I was trying something like
Afunction<-function (mydf,colnames,decreasing=T){
mydf.ordered<-with(mydf, mydf[order(colnames, decreasing = decreasing),
])
}
but it didnt work
please help
thank you
Jiri Voller
[[alternative HTML version deleted]...
2006 May 17
0
variable colnames
...t stat.math.ethz.ch
Cc?: COMTE Guillaume
Objet?: Re: [R] variable row names
Hi
I was confused by your example, too and still am a little bit
confused, so please excuse me if my example does not answer your
question:
You have a data.frame "dat"
> dat <- data.frame(colname1 = 1:4, colname2 = 5:8)
You have a vector with the colnames of "dat"
> namen <- colnames(dat)
You want to acess on the values in dat bu using the vector "namen"
> for (i in namen)
> print(dat[,i])
or
> for (i in 1:length(namen))
> print(dat[,namen[i]])
Does that answer...