Displaying 3 results from an estimated 3 matches for "obsnum".
2009 Feb 18
2
understanding how R determines numbers and characters when creating a data frame
...n for loops that can contain both numeric and
character data.
********Question for example 1.
Why does the cbind command convert the numeric data to character data? Why
can't the character data be converted to numeric data using the fix command?
### Example 1 #############
data(iris)
obsnum<-NULL
results<-NULL
for(s in unique(as.character(iris$Species))){
temp1<-iris[iris$Species==s,]
obsnum<-length(unique(temp1$Sepal.Length)) # a number
out1<-cbind(species=as.character(paste(s)),obsnum) # number converted to
character
results<-rbind(out1,results)
}
results...
2006 Oct 17
1
looking for a cleaner way to do something
I have two numeric vectors each of length 17 and each is named the exact
same way.
so
obsnum ppppp ppppm pppmp . dot dot dot......
temp1 is 1417 52 63 85
obsnum ppppp ppppm pppmp . dot dot dot......
temp2 is 1213 41 50 97
what i want to have is a resultant matrix with 2 rows and 16 columns
where the 16 columns are the 2...
2004 Sep 09
2
Skipping panels in Lattice
...t(lattice) help page, and merrily
reproduced examples of using skip from a couple of previous r-help queries
and the example given in Pinheiro & Bates. But I must be missing something...
Here's an example (running R 1.9.1 on Win2k):
# generate some data
df1 <- data.frame(expand.grid(obsnum=seq(1, 15, 1), faca=c("A1", "A2", "A3"),
facb=c("B1","B2", "B3", "B4"), facc=c("C1","C2")), dv=rpois(15*3*4*2,10))
# now get rid of the cell B4 & C1 to simulate a missing treatment combination
df2 &...