similar to: how to specify modes of certain fields in read.table

Displaying 12 results from an estimated 12 matches similar to: "how to specify modes of certain fields in read.table"

2011 Apr 08
3
a strange behavior with ifelse
I have used R for years but run into a seemingly simple problem involving 'ifelse'. condensed code like this a=c(2,NA,NA,NA,2,2,NA,2,NA,2) b=c(NA,1,1,NA,2,2,2,2,2,2) #I want to combined a and b into c so that c would be a valid number either a or b is not missing c=ifelse(a==1|b==1,1,ifelse(a==2|b==2,2,NA)) cbind(a,b,c) a b c [1,] 2 NA NA [2,] NA 1 1 [3,] NA 1 1
2008 Feb 11
2
how to generate a column based on other columns in a data frame
HI, I am working on a data set with multiple collections of mosquitoes at sampling sites. Each row represents a collection of individual samples with coordinates for each collection. ... X, Y,... 1 36.435 30.118 2 36.435 30.118 3 36.435 30.118 4 35.329 29.657 5 35.329 29.657 6 36.431 30.111 7 36.431 30.111 8 35.421 29.797 9 35.421 29.797 10 35.421 29.797
2009 Feb 25
2
run latent class analysis with R
What's the best approach to running latent class analysis with R? I've downloaded both randomLCA and poLCA packages, but I am interesting in running a standard LCA with individual records (not frequency table) as input data. Wen Gu John Jay College of Criminal Justice445 West 59 StreetNew York, NY 10029 wgu@gc.cuny.edu _________________________________________________________________
2008 Feb 08
4
how to extract characters from a character string
Hi, I ran into a problem when I complied a dataset with UTM coordinates. For calculating distances between sites, I need to reformat the coordinates from, for example, 32?35.421 N, to 35.421, i.e. I need to delete all digits before symbol ? and a space and N at the end of the string. What functions I should use? Thanks in advance. Weidong Gu, Department of Medicine University of
2008 Sep 07
1
run optim() on a list
Hi, I am at the end of my wit to figure out how to run the optim function on a list. Basically, I have a data set of three columns as "Site", "Pool" and "Positivity" ( the full data set is copied at the end). I want to run the maximal likelihood estimation separately on subsets split by "Site" data<-read.table(...)
2008 Jan 07
1
How to rearrange lattice graphics output?
My question arises when I use levelplot graphics. For example, levelplot(z~x*y|fg) where fg is a factor with three levels of 'a','b','c'. The panels come out in a default order. I would like to rearrange the panels in a manner of 'c','b','a'. I used fg<-ordered(fg, levels=c('c','b','a')) But the panels are still the
2008 Mar 27
1
panel function question
I have two data sets with locations, X, Y of houses (df.house) and habitats(df.habitat), respectively. In each dataset, there are 3 replicates (Repeat). Because each replicate has different locations of houses and habitats, I would like to plot them in panels. I wrote something like this: mypanel<-function(x,y,subscripts,...){ panel.xyplot(x,y,pch=20) panel.xyplot(
2008 Jan 31
1
decrease amount of ticks on y axis in lattice levelplot
Hi all, How can I decrease the number of ticks on the y-axis in a lattice levelplot()? I have as many ticks displayed on the y-axis as I have columns of data (1000 columns), how can I decrease this amount of ticks, while still properly displaying all the data? Note that I get my data from a matrix object, in which the z-values of the levelplot are the actual values in the matrix, whereas the
2009 Mar 25
1
how to calcualte Jaccard Coefficient
Does anyone have a good method for calculating Jaccard coefficients now that the dissimilarity() function is no longer an option? Wen Gu John Jay College of Criminal Justice445 West 59 StreetNew York, NY 10029 wgu@gc.cuny.edu _________________________________________________________________ Express your personality in color! Preview and select themes for HotmailĀ®.
2009 Feb 23
1
why results from regression tree (rpart) are totally inconsistent with ordinary regression
Hi, In my analysis of impacts of insecticide-treated bednets on malaria, I look at the relationship between malaria incidence and mosquito behaviors. The condensed data set is copied here. Ordinary regression (lm) shows that Incidence was negatively related to Mortality. This makes sense because the latter reflected the strength of killing mosquitoes by insecticide-treated nets. Since the
2010 Feb 05
0
how to draw two series in bwplot
Hi, I have two numeric columns (dat1 and dat2) to bwplot data=expand.grid(dat1=rnorm(20,10,5),class=1:5,school=letters[1:3])) data$dat2=rnorm(300,13,6) What I want is to plot two boxes side by side for class, bwplot((dat1+dat2)~as.factor(class)|school,data=data) but the code does not work this way, instead it plots addtions of the two columns. I changed allow.multiple with no success. Your
2009 Feb 25
1
problems with arrangement of figures by layout function
Hi, I want to have histograms behind the regression tree figure. Since 7 leafs resulted from the tree model (rpart), it would be nice to have correspondent histograms below the tree figure. After a little study, I could generate the correspondent histogram for each leaf, but can't figure out how to arrange them in the right place. I tried something like