On 05/14/2010 06:35 AM, ecvet...@uwaterloo.ca wrote:
Hello,

I have a data frame with many rows, and I want to create a column with a
name only at every 12th row, starting from 97 to 278.

Hi ecvetano,
The string of names is not too hard:

blank11<-rep("",11)
one_to_fifteen<-c("one","two","three","four","five",
 "six","seven","eight","nine","ten","eleven","twelve",
 "thirteen","fourteen","fifteen")
newnames<-as.vector(sapply(one_to_fifteen,
 function(x,sep) return(c(x,sep)),blank11))

then you want to add blanks at the beginning and end:

nrows<-dim(my.data.frame)[1]
new_column<-c(rep("",97),newnames,
 rep("",nrows-(97+length(newnames)))

But I don't see the point.

Jim

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to