Re: [R] wilcox.test - difference between p-values of R and online calculators

2014-09-03 Thread David L Carlson
. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Tal Galili Sent: Wednesday, September 3, 2014 5:24 AM To: W Bra

Re: [R] depth of labels of axis

2014-09-02 Thread David L Carlson
labels = c(expression(E[g]), "E", expression(E[j]), "E", expression(E[t])), padj=1, mgp=c(3, .1, 0)) # Check alignment abline(h=.7, xpd=TRUE, lty=3) --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX

Re: [R] frequencies of a discrete numeric variable, including zeros

2014-09-02 Thread David L Carlson
Another approach using barplot: barplot(table(cut(art, breaks= -1:19, labels=0:19))) - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-

Re: [R] Correlation Matrix with a Covariate

2014-09-02 Thread David L Carlson
1. col 1 is perfectly correlated with col 2 col 3 is perfectly correlated with col 4 col 5 is perfectly correlated with col 6 David C From: Patzelt, Edward [mailto:patz...@g.harvard.edu] Sent: Tuesday, September 2, 2014 9:21 AM To: David L Carlson Cc: R-help@r-project.org Subject: Re:

Re: [R] Adjusted R2 for Multivariate Regression Trees (MRT) (ignore the previous message)

2014-09-02 Thread David L Carlson
probably take the mean of the 100 runs as a reasonable estimate. If the estimates are quite variable, you should probably use more than 40 runs by setting T=100 or an even larger number. Multiple runs should then be more similar to one another. - David L Carlson

Re: [R] Linear regression of 0/1 response ElemStatLearn (Fig. 2.1 the elements of statistical learning)

2014-09-01 Thread David L Carlson
]. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Denis Kazakiewicz Sent: Monday, September 1, 2014 5:27 AM To: r-he

Re: [R] Correlation Matrix with a Covariate

2014-09-01 Thread David L Carlson
r the number of observations or one of your columns is a linear combination of (can be predicted exactly from) the others. --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- Fro

Re: [R] posterior probabilities from lda.predict

2014-08-30 Thread David L Carlson
. I am not aware of a package that has a function to produce either of these. Huberty, Carl J. and Stephen Olejink. 2006. Applied Manova and Discriminant Analysis. Second Edition. Wiley-Interscience. David L. Carlson Department of Anthropology Texas A&M University -Original Mes

Re: [R] distance matrix from metaMDS

2014-08-28 Thread David L Carlson
Don't the functions metaMDSdist() and metaMDSredist() that are documented on the metaMDS manual page give you the distance matrix? If you want to compute the distances based on a single axis, you could use vegdist(). David C -Original Message- From: r-help-boun...@r-project.org [mailto

Re: [R] scatterplot using plot() function with factorial data

2014-08-27 Thread David L Carlson
, 4.5), pch=19) axis(1, 1:4, LETTERS[1:4]) --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Luigi Marongiu Sent: Wed

Re: [R] VennDiagram

2014-08-26 Thread David L Carlson
Assuming your sample data is called dta: > table(dta$Results, dta$Analysis) A B C 1-5 1 1 0 20-50 1 0 0 4-7 0 0 1 8-9 0 1 1 David L. Carlson Department of Anthropology Texas A&M University -Original Message- From: r-help-boun...@r-project.org [m

Re: [R] How to plot multiple density plot and scatter plot together

2014-08-25 Thread David L Carlson
plot&data_source=R_CC&init=true --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of ?

Re: [R] Subsetting data for split-sample validation, then repeating 1000x

2014-08-22 Thread David L Carlson
values. hist(Out) # for a histogram of the correlation values David C From: Angela Boag [mailto:angela.b...@colorado.edu] Sent: Friday, August 22, 2014 4:01 PM To: David L Carlson Subject: Re: [R] Subsetting data for split-sample validation, then repeating 1000x Hi David, Thanks for the f

Re: [R] Subsetting data for split-sample validation, then repeating 1000x

2014-08-22 Thread David L Carlson
etween predicted 30% and actual 30% cor <- cor(Atest$nat.r, predict(A.model, newdata = A[test,], type = "response")) ----- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- Fro

Re: [R] Euclidean Distance in 3 Dimensions

2014-08-21 Thread David L Carlson
rocess the matrices in each list to get what you want. David C From: Patzelt, Edward [mailto:patz...@g.harvard.edu] Sent: Thursday, August 21, 2014 2:58 PM To: David L Carlson Cc: Don McKenzie; R-help@r-project.org Subject: Re: [R] Euclidean Distance in 3 Dimensions Your first description is c

Re: [R] Euclidean Distance in 3 Dimensions

2014-08-21 Thread David L Carlson
]) - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Don McKenzie Sent: Thursday, August 21, 2014 1:44 PM To: Patzelt, Edward Cc: R-help@r-project.org Subject: Re

Re: [R] principle component values on PCA plots do not match

2014-08-19 Thread David L Carlson
Try using scale=0 with the biplot function). David C -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jinsong Zhao Sent: Monday, August 18, 2014 7:42 PM To: r-help@r-project.org Subject: Re: [R] principle component values on PCA plo

Re: [R] Turn Rank Ordering Into Numerical Scores By Transposing A Data Frame

2014-08-18 Thread David L Carlson
(mymelt, row~color, value.var="rank", fill=0) > head(mycast) row blue green red yellow NA 1 14 0 3 2 1 2 20 2 4 1 3 3 33 2 0 1 4 4 42 4 0 3 1 5 53 4 2 0 1 6 64 3 2 0 1 Da

Re: [R] Turn Rank Ordering Into Numerical Scores By Transposing A Data Frame

2014-08-17 Thread David L Carlson
idea where those occur in the or rather which of those variables were actually missing. Have I explained this problem sufficiently? I didn't think it would cause such a problem so I didn't include it in the original problem definition. Yours, Simon On Jul 25, 2014, at 4:58 PM

Re: [R] Obtaining predicted values for glm() function

2014-08-15 Thread David L Carlson
You don't show us your function call, so it is hard to be certain what the problem is. Have you read the manual page? ?predict.glm Have you used the newdata= argument? If not, you should know that R's ability to read your mind will not be available until the 4.0 release. David Carlson -

[R] FW: color palettes

2014-08-08 Thread David L Carlson
olor palettes including RColorBrewer, colortools, colorspace, and munsell. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-pr

Re: [R] color palettes

2014-08-08 Thread David L Carlson
...@yahoo.com] Sent: Friday, August 8, 2014 9:03 AM To: David L Carlson Subject: Re: [R] color palettes Well I'm using 1000 colors in a pie chart and get the same color but different intensity. I can't fix myself as the number of colors are high. So what would you suggest? Thanks carol

Re: [R] How to avoid the three loops in R?

2014-08-01 Thread David L Carlson
201205 28 11 DE 228 201205 28 12 AE 328 201204 28 13 CN 328 201204 28 - David L Carlson Department of Anthropo

Re: [R] Multiple plots and postscripts using split function

2014-07-31 Thread David L Carlson
;YEAR','VALUE')], type='b', main = ind[[i]][1, "NAME"], . . . other commands . . . ) dev.off() } --------- David L Carlson Department of Anthropology Texas A&M University Col

Re: [R] Post hoc comparissons

2014-07-29 Thread David L Carlson
Look at package multcomp, particularly function cld(). - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org

Re: [R] outputting R loop to a csv file

2014-07-28 Thread David L Carlson
have enough data to test alternate approaches. The function dput() will convert a sample of your data to text format so that you can paste it into your email or provide it as a .txt file. David L. Carlson Department of Anthropology Texas A&M University -Original Message- From: r-help-

Re: [R] Turn Rank Ordering Into Numerical Scores By Transposing A Data Frame

2014-07-25 Thread David L Carlson
nred blue 2 green blue yellow red 3 green yellowred blue 4 yellowred green blue 5 yellowred green blue 6 yellowred blue green > head(mydf2) blue green red yellow 14 2 3 1 22 1 4 3 34 1 3 2 4 4 3 2 1 5

Re: [R] Creating Functions in R

2014-07-24 Thread David L Carlson
riting the value of "deviation" so you only get the last value recycled (page 20, "The recycling rule"). --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-he

Re: [R] Area Graphs

2014-07-16 Thread David L Carlson
Also look at stackpoly() in the plotrix package. The R Graphical Manual shows the example plots here http://rgm.ogalab.net/RGM/R_rdfile?f=plotrix/man/stackpoly.Rd&d=R_CC David Carlson -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf

Re: [R] Cutting hierarchical cluster tree at specific height fails

2014-07-15 Thread David L Carlson
-Original Message- From: jlh.membership [mailto:jlh.members...@gmail.com] Sent: Tuesday, July 15, 2014 10:14 AM To: 'Johannes Radinger'; David L Carlson Cc: 'R help' Subject: RE: [R] Cutting hierarchical cluster tree at specific height fails Hi Johannes, Looking at the code for cutr

Re: [R] Problems with read.table and data structure

2014-07-11 Thread David L Carlson
It is hard to diagnose without looking at the file. For example readLines("small.txt", n=5) would print out the first five lines that might show problems with wrapping the lines. What does dim(data) give you? Are you getting all 360 samples and 600 columns? You could also try using the colClass

Re: [R] Cutting hierarchical cluster tree at specific height fails

2014-07-11 Thread David L Carlson
heights. plot(hc) abline(h=c(20, 40, 60, 80, 100, 120), lty=3) David C From: Johannes Radinger [mailto:johannesradin...@gmail.com] Sent: Friday, July 11, 2014 3:24 AM To: David L Carlson; R help Subject: Re: [R] Cutting hierarchical cluster tree at specific height fails Hi, @David: Thanks for the

Re: [R] Cansisc: Error in eigen(eHe, symmetric = TRUE)

2014-07-10 Thread David L Carlson
In particular, look at the vegan Vignette, "Introduction to Ordination in vegan", particularly section 4 on constrained ordination which describes three approaches that seem relevant to your problem. http://cran.r-project.org/web/packages/vegan/vignettes/intro-vegan.pdf David Carlson -Orig

Re: [R] using match to obtain non-sorted index values from non-sorted vector

2014-07-09 Thread David L Carlson
There may be a faster way, but > sapply(Tset, function(x) which(pop.df$pop==x)) [1] 5 4 2 ----- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [m

Re: [R] Cutting hierarchical cluster tree at specific height fails

2014-07-09 Thread David L Carlson
hts)." Use a different method (but not median). --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On

Re: [R] getting numeric [0..6] day of week from POSIXct?

2014-07-07 Thread David L Carlson
?format.POSIXct Particularly %w > x <- Sys.time() > as.numeric(format(x, "%w")) [1] 1 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of John McKown Sent: Monday, July 7, 2014 10:54 AM To: r-help Subject: [R] getting numeric [0..6] d

Re: [R] Display a dataframe

2014-07-03 Thread David L Carlson
Not elegant, but it works: > term <- dimnames(dd)[[1]] > dd1 <- dd > dimnames(dd1)[[1]] <- rep("", 6) > dd2 <- capture.output(dd1) > cat(paste(dd2, " ", c("Term", term)), fill=48) # Chisq DF Pr(>Chisq) Term 153.0216306 1 7.578366e-35 # Sex 13.3696538 1 5.114571e-04 # Vo

Re: [R] Help with tables in R

2014-07-03 Thread David L Carlson
els concatenated so that the table appears to be a flat (2 way) table. That happens when converting the ftable object to a matrix since xtable handles a number of different object types, but not ftable. ----- David L Carlson Department of Anthropology

Re: [R] combining data from multiple read.delim() invocations.

2014-07-01 Thread David L Carlson
;,"POSIXct","POSIXct")) David C -Original Message- From: Bert Gunter [mailto:gunter.ber...@gene.com] Sent: Tuesday, July 1, 2014 12:33 PM To: David L Carlson Cc: John McKown; r-help@r-project.org Subject: Re: [R] combining data from multiple read.delim() invocations. Maybe, Davi

Re: [R] combining data from multiple read.delim() invocations.

2014-07-01 Thread David L Carlson
t;character","POSIXct","POSIXct")) df.all <- do.call(rbind, df.list) > str(df.all) 'data.frame': 15 obs. of 3 variables: $ lpar : chr "A" "A" "A" "A" ... $ started: POSIXct, format: "2014-07-01 11:25:05&quo

Re: [R] How to combine/join/merge etc PCA and Cluster?

2014-06-30 Thread David L Carlson
Insert data(dune) data(dune.env) after library(vegan) David C. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David L Carlson Sent: Monday, June 30, 2014 4:47 PM To: Jackson Rodrigues; r-help@r-project.org Subject: Re: [R] How

Re: [R] How to combine/join/merge etc PCA and Cluster?

2014-06-30 Thread David L Carlson
or points(sit.sc1, pch=as.numeric(gr)+20, bg=as.numeric(dune.env$Moisture)) # I'll skip the text labels The legend will be complicated since there are groups*ecosytems combinations. - David L Carlson Department of Anthropology Texas A&M University Colle

Re: [R] A Question about read.table and Data Frames in R

2014-06-30 Thread David L Carlson
You are also missing the fact that loops are often not required in R. In this case print() has a method for printing data frames and that method is automatically used when you simply type the data.frame name or if you explicitly call it with print(stockList): > stockList <- read.table(text="sym

Re: [R] subtracting degree minutes

2014-06-26 Thread David L Carlson
*60/100 So your problem would be > dd2dm(dm2dd(44.1) - dm2dd(.2)) [1] 43.5 Of course you could wrap that into a function if you are planning to do it frequently. ----- David L Carlson Department of Anthropology Texas A&M University College Stat

Re: [R] graph

2014-06-26 Thread David L Carlson
$x, xy2$x, xy3$x, xy4$x) > matplot(x, Density, type="l") > legend("topright", c("mu1", "mu2", "mu3", "mu4"), col=1:4, lty=1:4) - David L Carlson Department of Anthropology Texas A&M University Co

Re: [R] Simple permutation question

2014-06-25 Thread David L Carlson
uot; > tail(perm.ltrs) [1] "E D A B C" "E D B A C" "E D B C A" "E D A C B" "E D C A B" "E D C B A" > David C -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of David L Ca

Re: [R] Simple permutation question

2014-06-25 Thread David L Carlson
1] "E D A B C" "E D B A C" "E D B C A" "E D A C B" "E D C A B" "E D C B A" This is not the only permutation function in R, but this one has the advantage of being symmetrical. The last permutation is the reverse of the first, the pen

Re: [R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread David L Carlson
Sent: Tuesday, June 24, 2014 1:32 PM To: David L Carlson Cc: Gabor Grothendieck; Tahira Jamil; r-help@r-project.org Subject: Re: [R] Sample all possible contingency tables both margin fixed David gave a great solution. I think it is better to start from 0 to min(M) instead of from min(M[c(1,3)]) to

Re: [R] Sample all possible contingency tables both margin fixed

2014-06-24 Thread David L Carlson
] 8 0 1 8 ----- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Gabor Grothendieck Sent: Tuesday, June 24, 2014 12:07 PM To: Tahira Jamil

Re: [R] EOF error reading csv file

2014-06-22 Thread David L Carlson
The error message "EOF within quoted string" is telling you have an unbalanced " or ' in the .csv file. --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message

Re: [R] apply diff type function to matrix

2014-06-19 Thread David L Carlson
[,1:3] [,1] [,2] [,3] [1,]54 1.5 [2,]58 1.5 --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-projec

Re: [R] C: drive memory full

2014-06-18 Thread David L Carlson
ick on the Manage tab on the line just below the title bar. Click on Cleanup and that will let you select temporary files of various kinds for deletion if your drive is getting full. ----- David L Carlson Department of Anthropology Texas A&M University College Sta

Re: [R] apply switch to a table

2014-06-17 Thread David L Carlson
If you are not determined to apply switch(), you can apply apply(): Data <- data.frame(V1=c(1, 5), V2=c(3, 4)) Data ## V1 V2 ## 1 1 3 ## 2 5 4 label <- data.frame(freq=c(1:5), lbl=c("One", "Two", "Three", "Four", "Five")) label ## freq lbl ## 11 One ## 22 Two ## 33 Three #

Re: [R] abline; setting plot limits

2014-06-15 Thread David L Carlson
You can also use clip() before abline(): > x <- rnorm(25) > y <- rnorm(25) > plot(y~x) > clip(min(x), max(x), min(y), max(y)) > abline(lm(y~x)) But the clipping region will affect anything else you add to the plot after the clip command. In package plotrix, ablineclip() sets and resets the clipp

Re: [R] Forst Plot: Multipage Output

2014-06-10 Thread David L Carlson
izontally. Now open Test.pdf in Acrobat Reader and print to CutePDF using the poster mode. ------------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [

Re: [R] distance by sea

2014-06-05 Thread David L Carlson
Package geosphere has functions to compute the great circle distance between any two points given the latitude and longitude. It does not care if they are at sea, but does not take topography into account. - David L Carlson Department of Anthropology Texas A

Re: [R] How to draw a transparent polygon

2014-05-21 Thread David L Carlson
rgb("red", alpha=TRUE) [,1] red255 green0 blue 0 alpha 255 > redtrans <- rgb(255, 0, 0, 127, maxColorValue=255) > polygon(c(2, 5, 8), c(2, 10, 2), col=redtrans) --------- David L Carlson Department of Anthropology Texas A&

Re: [R] \ escape sequence and windows path

2014-05-20 Thread David L Carlson
That's the solution I was working on. Design the function (the foo() in your example) to read the clipboard so you do not need to paste anything. That greatly reduces how generally the function can be used since it will fail if there is not a path in the clipboard, but it solves (ameliorates?) t

Re: [R] \ escape sequence and windows path

2014-05-20 Thread David L Carlson
Now I understand. Not really a solution, but you can instruct students to use only forward slashes in their paths since R will convert to backslash on Windows systems automatically. After a couple of broken commands, they should get the hang of it. David C -Original Message- From: r-he

Re: [R] \ escape sequence and windows path

2014-05-20 Thread David L Carlson
Annoying but easy. Would this work for you? y <- gsub("", "/", readline()) C:\foo1\foo2\ > y [1] "C:/foo1/foo2/" --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352

Re: [R] dist like function but where you can configure the method

2014-05-17 Thread David L Carlson
Function designdist() in package vegan lets you define your own distance measure, but it does not let you simply provide a function as your original request indicated. Function distance() in package ecodist() indicates that it is written to make it simple to add new distance functions, but warns

Re: [R] Using centers of hierarchical clustering for k-means

2014-05-16 Thread David L Carlson
er x.g4 1 2 3 4 1 10 0 1 0 2 0 12 2 0 3 0 2 10 0 4 0 0 0 3 --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-h

Re: [R] Second axis on bottom of graph

2014-05-16 Thread David L Carlson
?title Used for main titles, subtitles, and x/y labels. David C -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Hurr Sent: Friday, May 16, 2014 10:59 AM To: r-help@r-project.org Subject: Re: [R] Second axis on bottom of graph Sor

Re: [R] Retrieving the matched data frame from Matching?

2014-05-16 Thread David L Carlson
The str() function will show you what is contained in m8. If you look at the manual page for Match: > ?Match the section labeled "Value" gives more details on what results are returned by the Match() function. The print() and summary() functions usually show abbreviated results. In this case a

Re: [R] create new rows with 0, if nessecary

2014-05-16 Thread David L Carlson
A bit simpler is to add the Hours column when creating the dd data.frame: dd <- data.frame(Cat=min(aa[,1],bb[,1]):max(aa[,1],bb[,1]), Hours=0) Then just gg1 <- merge(aa,dd,all=TRUE) gg2 <- merge(bb,dd,all=TRUE) David Carlson -Original Message- From: r-help-boun...@r-project.org [mailto

Re: [R] data presentation -curve

2014-05-14 Thread David L Carlson
1. data.frame 2. yes Read the posting guide and work through a free tutorial or manual on R: http://cran.r-project.org/other-docs.html David C -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Ragia Ibrahim Sent: Wednesday, May 14,

Re: [R] matrix column division by vector

2014-05-14 Thread David L Carlson
Bert wins the race: > system.time(replicate(1e5, m/rep(v,e=2))) user system elapsed 0.250.000.25 > system.time(replicate(1e5, m/matrix( v, ncol=ncol(m), nrow=nrow(m), > byrow=TRUE))) user system elapsed 0.420.000.42 > system.time(replicate(1e5, t(t(m)/v))) use

Re: [R] matrix column division by vector

2014-05-14 Thread David L Carlson
You don't need do.call: > t(t(m)/v) [,1] [,2] [,3] [1,]222 [2,]111 > t(apply(m, 1, function(x) x/v)) [,1] [,2] [,3] [1,]222 [2,]111 --------- David L Carlson Department of Anthropology Texas A&a

Re: [R] Convert to integers all entries of a table (for DESeq2)

2014-05-12 Thread David L Carlson
tx[,-1], as.integer), stringsAsFactors=FALSE) ------------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf O

Re: [R] conversion error from numeric to factor in raster: Error in 1:ncol(r) : argument of length 0, r command: as.factor()

2014-05-06 Thread David L Carlson
Does values(r) <- as.factor(1:ncell(r)) do what you want? ----- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.

Re: [R] Converting matrix to data frame without losing an assigned dimname

2013-04-10 Thread David L Carlson
139 3100 4862 2 Pennsylvania 126 11860 44966 3 Maryland 101 4122 9891 4 Virginia85 4981 39780 > ------ David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 &g

Re: [R] Boxplot Labels

2013-04-09 Thread David L Carlson
120 121 122 123 124 125 > If you wanted the numbers from 1 to 26, num <- 1:26 would be more compact. ---------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message-

Re: [R] Reshaping a table

2013-04-08 Thread David L Carlson
t4 <- data.frame(sapply(dat4, as.character), stringsAsFactors=FALSE) -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org

Re: [R] help with kriging interpolation

2013-04-04 Thread David L Carlson
Take a look at package geoR. -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.o

Re: [R] a question about clustering

2013-04-04 Thread David L Carlson
find groups within the known groups, you could cluster the groups separately. -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun..

Re: [R] scanning data in R

2013-04-03 Thread David L Carlson
You can certainly do it after scanning all the numbers in with b <- scan("F:\\stop.txt", what=integer()) b <- b[b!=21] ---------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 >

Re: [R] changing y-axis intervals in a boxplot

2013-03-29 Thread David L Carlson
col = "lightgray") ---------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf

Re: [R] barplot colors

2013-03-26 Thread David L Carlson
You will have to trick barplot into thinking you have four groups: > wmod <- cbind(c(w[,1], 0, 0), c(0, 0, w[,2])) > barplot(wmod, main="2012", col=c("red", "green", "blue", "pink")) ------ Da

Re: [R] contourplot

2013-03-22 Thread David L Carlson
prgrid$y <- predict(lmmodel, prgrid) > # Draw contour plot > contourplot(y~x1+x2, prgrid) -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto

Re: [R] boxplot

2013-03-21 Thread David L Carlson
Your variable loc_type combines information from two variables (loc and type). Since you are subsetting on loc, why not just plot by type? boxplot(var1~type, data[data$loc=="nice",]) ------ David L Carlson Associate Professor of Anthropology

Re: [R] data.frame with NA

2013-03-19 Thread David L Carlson
(but I haven't checked the source code). The first column (the Date variable) is treated as character. As a result, everything gets converted to character. This will skip the first column which does not have any missing values. ---------- David L Carlson A

Re: [R] data.frame with NA

2013-03-18 Thread David L Carlson
David > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of David L Carlson > Sent: Monday, March 18, 2013 3:22 PM > To: 'Pietro'; 'Berend Hasselman' > Cc: r-h...@stat.math.ethz.ch > Subject: R

Re: [R] data.frame with NA

2013-03-18 Thread David L Carlson
m : num 128 127 126 129 130 ... $ n : num NA NA NA NA NA NA NA NA NA NA ... $ o : num 133 133 133 133 133 ... $ p : num 107 107 107 107 107 ... -- David L Carlson Associate Professor of Anthropology Texas A&M University College Stat

Re: [R] help with PCA

2013-03-16 Thread David L Carlson
?predict.prcomp -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Be

Re: [R] Reassign values based on multiple conditions

2013-03-15 Thread David L Carlson
collar[i] & : replacement has length zero > > AC [1] 1 2 NA NA NA AC is the vector of animal numbers that has the same length as the Collars data.frame. In this case only the first two rows in Collars match anything in Animals so the rest are NA and R prints an error message.

Re: [R] Data manipulation

2013-03-15 Thread David L Carlson
98 7 1 0.30 8 2 0.30 9 3 0.3 114 ------ David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Da

Re: [R] Data manipulation

2013-03-15 Thread David L Carlson
Wouldn't this do the same thing? xtabs(Count~Class+X, D) -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org

Re: [R] plotting

2013-03-14 Thread David L Carlson
character(1:5), pch=21:25, col="gray", inset=c(.1, 0), bty="n", title="ID") -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message-

Re: [R] Export R generated tables and figures to MS Word

2013-03-13 Thread David L Carlson
u are making more than a few tables. There is also an R2wd package, but I haven't tried it. ------ David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > Fr

Re: [R] different color indicates difference magnitude

2013-03-13 Thread David L Carlson
If you are just looking for a range of colors that communicate low to high values, try package RColorBrewer and look at the sequential palettes. -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-

Re: [R] extract values

2013-03-12 Thread David L Carlson
Look at your data. You do not want values greater than 1820. There are none. You want values with NAMES greater than 1820. > x1 <- x[as.numeric(names(x)) >1820] > x1 ---------- David L Carlson Associate Professor of Anthropology Texas A&M Un

Re: [R] chi square exact test

2013-03-06 Thread David L Carlson
stats, the dmultinom() function can be used to accomplish this. The last example on the help page shows the steps. -- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original

Re: [R] Hidden information in an object

2013-02-28 Thread David L Carlson
ot;F","M": 1 1 1 1 1 1 1 1 1 1 ... $ Bwt : num 2 2 2 2.1 2.1 2.1 2.1 2.1 2.1 2.1 ... $ Hwt : num 7 7.4 9.5 7.2 7.3 7.6 8.1 8.2 8.3 8.5 ... $ ratio: num 3.5 3.7 4.75 3.43 3.48 ... -- David L Carlson Associate Professor of An

Re: [R] PCA with spearman and kendall correlations

2013-02-28 Thread David L Carlson
5181 X2 -0.03135181 1. ---------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of

Re: [R] best ordination method for binary variables

2013-02-28 Thread David L Carlson
,]10 [5,]10 [6,]11 [7,]11 [8,]00 [9,]10 [10,]11 > unique(x) [,1] [,2] [1,]10 [2,]11 [3,]01 [4,]00 ------ David L Carlson Associate Professor of Anthrop

Re: [R] merging or joining 2 dataframes: merge, rbind.fill, etc.?

2013-02-26 Thread David L Carlson
Clumsy but it doesn't require any packages: merge2 <- function(x, y) { if(all(union(names(x), names(y)) == intersect(names(x), names(y{ rbind(x, y) } else merge(x, y, all=TRUE) } merge2(df1, df2) df3 <- df1 merge2(df1, df3) ---

Re: [R] cut a vector in equal parts

2013-02-26 Thread David L Carlson
Insert "include.lowest=TRUE" or the lowest value will get dropped (assigned NA): split(x, cut(x, quantile(x, probs = seq(0, 1, by = 0.2)), include.lowest=TRUE)) ------ David L Carlson Associate Professor of Anthropology Texas A&M University C

Re: [R] help with population matrix

2013-02-18 Thread David L Carlson
to modify it for the bigger version. ---------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of John

Re: [R] Correlation with p value

2013-02-13 Thread David L Carlson
Minor edit > dta2 <- unstack(dta, score~Name) is simpler. --- David C > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of David L Carlson > Sent: Wednesday, February 13, 2013 9:40 AM > To: 'Jorge

Re: [R] Correlation with p value

2013-02-13 Thread David L Carlson
0.6277 TTK 0.0152 0.6277 ---------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.

<    1   2   3   4   5   6   7   8   9   10   >