Re: [R] Mantel test

2015-05-06 Thread David L Carlson
object does not contain a diagonal so your comment suggests that you did not convert the matrix to a dist object. David C From: Nick Jeffery [mailto:nick.w.jeffe...@gmail.com] Sent: Wednesday, May 6, 2015 9:34 AM To: David L Carlson Subject: Re: [R] Mantel test Hi, Thanks for the help. I get

Re: [R] Mantel test

2015-05-04 Thread David L Carlson
Assuming the 'matrix' format is a symmetrical distance 'matrix' stored as a data frame (which read.csv creates) rather a rectangular data 'matrix,' you can convert it to a dist object with as.dist(). ?dist --------- David L Carlson De

Re: [R] Results Differ in Ternary Plot Matrix of Compositional Response Variables

2015-05-01 Thread David L Carlson
nge","dark grey")[JerrittX4], plotMissings=FALSE) - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Rich Shepa

Re: [R] Missing axis labels

2015-05-01 Thread David L Carlson
when the device driver redraws the plot. There is also a third option in addition to your two to getting all of the labels: plot(0:100, 0:100, xaxp=c(0, 100, 4)) will plot at 0, 25, 50, 75, 100 which leaves room for the last label. --------- David L Carlson Department

Re: [R] Plot Title: Adjusting Position

2015-05-01 Thread David L Carlson
.main= for size. ----- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Rich Shepard Sent: Friday, May 1, 2015 10:00 A

Re: [R] Editable plot

2015-04-30 Thread David L Carlson
to get a changed plot. You cannot edit the plot by selecting an element on the plot and changing its properties in some way. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- Fro

Re: [R] Graphs for scientific publication ?

2015-04-30 Thread David L Carlson
us where you want to end up. People on the list are familiar with base graphics, lattice graphics, and ggplot2. If you list your requirements clearly, you might end up with three solutions. - David L Carlson Department of Anthropology Texas A&M Univer

Re: [R] Problem with predict.lm()

2015-04-29 Thread David L Carlson
0.31065562 -0.02091366 0.25358175 > head(predict(lm)) 1 2 3 4 5 6 0.75474817 0.06024122 -0.27221466 -0.20344713 0.20218135 -0.24045859 > - David L Carlson Department of Anthropology Texas A&M U

Re: [R] cite publications in the package help file

2015-04-28 Thread David L Carlson
a Source entry and/or References for that function or data set. For a large package such as MASS with over 150 functions/data sets, it would be unwieldy to put them all on the web page. - David L Carlson Department of Anthropology Texas A&M University Col

Re: [R] Question about base::rank results

2015-04-27 Thread David L Carlson
ut that is not its index which is 2. The value with index 4 is 77 so it shows up in the second position. --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:

Re: [R] - Obtaining superscripts to affix to means that are not significantly different from each other with R

2015-04-23 Thread David L Carlson
The function cld() in package multcomp generates compact letter displays, but does not format them as exponents of the group names. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Mes

Re: [R] Vectorizing a task

2015-04-14 Thread David L Carlson
It is not vectorized, but it is simple: EXPANDED <- unlist(mapply(":", START, END)) ----- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun

Re: [R] Extracting unique entries by a column

2015-04-14 Thread David L Carlson
"The Elements of Programming Style" by Kernighan and Plauger: 10.0 times 0.1 is hardly ever 1.0. ----- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [

Re: [R] Sum of some months totals

2015-04-14 Thread David L Carlson
nths) Group <- grps[rainfall$Month] aggregate(Rain~Year+Group, rainfall, function(x) c(sum=sum(x), days=sum(x>0))) } > rainstats(rainfall) Year Group Rain.sum Rain.days 1 1979 10 0 --------- David L Carlson Department of

Re: [R] R studio installation

2015-04-14 Thread David L Carlson
R Studio cannot fine it. --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jeff Newmiller Sent: Tuesday, April 14, 2015 7:43 AM To: John Kane; Sojood

Re: [R] Convert color hex code to color names

2015-04-13 Thread David L Carlson
rainbow(6): > for (i in 1:6) cat(i, colors()[clrs$RGB==rain[i]], "\n") 1 red red1 2 yellow yellow1 3 green green1 4 cyan cyan1 5 blue blue1 6 magenta magenta1 David C -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of David L Carlson Sent:

Re: [R] Convert color hex code to color names

2015-04-13 Thread David L Carlson
DC0B0 So most colors do not have names. In your example, none of the colors in rainbow(6) have names: > rain <- rainbow(6) > sum(clrs$RGB %in% rain) [1] 0 - David L Carlson Department of Anthropology Texas A&M University College Station, TX 7

Re: [R] how to Subset based on partial matching of columns?

2015-04-09 Thread David L Carlson
>From Sarah's data frame you can get what you want directly with the table() >function which will create a table object, mydf.tbl. If you want a data frame >you need to convert the table using as.data.frame.matrix() to make mydf.df. >Finally combine the two data frames if your x column consists

Re: [R] sort adjacency matrix

2015-04-06 Thread David L Carlson
=="1"), decreasing=TRUE),] or dat[order(rowSums(dat), decreasing=TRUE),] or dat[order(rowSums(dat, na.rm=TRUE), decreasing=TRUE),] Note that the order is not unique since there are ties in the number of 1s. ----- David L Carlson Department of Anthropolo

Re: [R] Again: A problem someone should know about

2015-03-30 Thread David L Carlson
benefit from spending a little time learning about R using a free tutorial. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Be

Re: [R] textplot() in wordcloud package

2015-03-16 Thread David L Carlson
does a better job of avoiding labels being chopped at the plot margins. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behal

Re: [R] textplot() in wordcloud package

2015-03-16 Thread David L Carlson
eliminate the warnings. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Fraser D. Neiman Sent: Friday, March 13, 2015 3:2

Re: [R] Adding Column to a Data Frame

2015-03-12 Thread David L Carlson
The merge function combines 2, not 3 files at a time. Maybe rich.stats2 = merge(rich.stats, Month, by="X.SampleID") rich.stats3 = merge(rich.stats2, Location, by="X.SampleID") Reading the manual page will help: ?merge --------- David L C

Re: [R] calculate value in dependence of target value

2015-03-09 Thread David L Carlson
6 1 1200 3 13 3 9 6 1800 4 14 2 11 9 1800 - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] Sent: Monday, March 9, 201

Re: [R] calculate value in dependence of target value

2015-03-09 Thread David L Carlson
cumulative VALUE? - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Matthias Weber Sent: Monday, March 9, 2015 7:46 A

Re: [R] subset a data frame by largest frequencies of factors

2015-03-05 Thread David L Carlson
e original data and delete the unused factor levels: sample <- merge(Dataset, g[,-3]) sample$ctry <- factor(sample$ctry) sample$member <- factor(sample$member) --------- David L Carlson Department of Anthropology Texas A&M University College Station, T

Re: [R] Using dates in R

2015-03-04 Thread David L Carlson
time(today, "%m/%d/%y") < strptime(d1, "%m/%d/%y")) [1] 0 > as.integer(strptime(today, "%m/%d/%y") < strptime(d2, "%m/%d/%y")) [1] 1 ?strptime for details - David L Carlson Department of Anthropology Texas A&M

Re: [R] sampling dataframe based upon number of record occurrences

2015-03-04 Thread David L Carlson
dframe[sample(ind, ifelse(length(ind)>2, 3, length(ind))),] } Now take the samples and combine them into a single data frame: sample <- do.call(rbind, lapply(dta.list, smp)) sample - David L Carlson Department of Anthropology Texas A&M Uni

Re: [R] 2D Timeseries trace plot

2015-03-03 Thread David L Carlson
pause(1) # Draw the curve pausing between points. for(i in 1:6) { ani.pause(diftime[i]*10) # Multiply by ten to slow things down segments(pen$x[i], pen$y[i], pen$x[i+1], pen$y[i+1]) } - David L Carlson Department of Anthropology Texas A&M Univer

Re: [R] Summing certain values within columns that satisfy a certain condition

2015-02-27 Thread David L Carlson
0 7 1 4 0 4 0 7 1 5 0 1 0 0 0 6 0 0 0 0 0 7 0 0 0 0 0 8 0 0 0 0 0 9 0 0 1 5 0 10 0 5 1 5 0 11 0 4 1 5 0 12 0 8 4 7 3 13 0 0 3 0 0 14 0 0 3 4 0 15 0 0 3 4 0 16 0 0 0 5 0 17 0 2 0 6 0 18 0 0 4 0 1 19 0 0 4 0 1 20 0 0 4 0 1 -------------

Re: [R] One column listing on wide monitors too

2015-02-24 Thread David L Carlson
6" > t(t(a)) [,1] [1,] "String 1" [2,] "String 2" . . . [15,] "String 15" [16,] "String 16" > b <- a > dim(b) <- c(16, 1) > b [,1] [1,] "String 1" [2,] "String 2" . . . [15,] "

Re: [R] How to Deploy a 'poLCA' Model?

2015-02-24 Thread David L Carlson
Looking at package poLCA I see functions poLCA.predcell() and poLCA.table(). If these do not do what you want, you will need to be clearer and provide a reproducible example. - David L Carlson Department of Anthropology Texas A&M University College Sta

Re: [R] Extracting Factor Pattern Matrix Similar to Proc Factor

2015-02-23 Thread David L Carlson
ums of the squared values in each column sum to the eigenvalue. Alternatively, you can install the "psych" package which computes the pattern (structure) matrix directly: > library(psych) > iris.pca <- principal(iris[,-5], nfactors=4, rotate="none") > print(iris.

Re: [R] Extracting Factor Pattern Matrix Similar to Proc Factor

2015-02-23 Thread David L Carlson
Function principal() in psych takes a correlation matrix so use cov2cor() to convert: library(psych) iris.pca <- principal(cov2cor(cov(iris[,-5])), nfactors=4, rotate="none") print(iris.pca$Structure, cutoff=0) David -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] O

Re: [R] Replacing 9999 and 999 values with NA

2015-02-23 Thread David L Carlson
up. ----- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Alexandra Catena Sent: Monday, February 23, 2015 11:50 AM To: Frederic Ntireng

Re: [R] Correlation question

2015-02-22 Thread David L Carlson
1] -3.281849 David L. Carlson Department of Anthropology Texas A&M University -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jonathan Thayn Sent: Sunday, February 22, 2015 12:01 AM To: Kehl Dániel Cc: r-help@r-project.org Subject: Re: [R] Correlat

Re: [R] Chi-square test

2015-02-20 Thread David L Carlson
Chi-squared test for given probabilities with simulated p-value (based on 2000 replicates) data: f X-squared = 7.6268, df = NA, p-value = 0.7996 --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -

Re: [R] subsamples and regressions for 100 times

2015-02-17 Thread David L Carlson
A BC # [1,] 1.4326103 0.2658041 1.357475 # [2,] 1.4754324 0.2658041 1.309208 # [3,] 0.9838589 0.2658041 1.408987 # [4,] 0.9993144 0.2658041 1.354297 # [5,] 1.0134187 0.2658041 1.397112 # [6,] 1.4922856 0.2658041 1.312531 > --------- David L Carl

Re: [R] Picking Best Discriminant Function Variables

2015-02-16 Thread David L Carlson
Look at the function stepclass() in package klaR. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of David Moskowitz

Re: [R] Loop over regression results

2015-02-16 Thread David L Carlson
inica 0.6314052 0.1428938 4.418702 5.647610e-05 David C -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of David L Carlson Sent: Monday, February 16, 2015 8:52 AM To: Ronald Kölpin; r-help@r-project.org Subject: Re: [R] Loop over regression results In R y

Re: [R] Loop over regression results

2015-02-16 Thread David L Carlson
-------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ronald Kölpin Sent: Monday, February 16, 2015 7:37 AM To: r-help@r-project.org Subject

Re: [R] Coordinate or top left corner + offset

2015-02-10 Thread David L Carlson
-boun...@r-project.org] On Behalf Of Ben Bolker Sent: Monday, February 9, 2015 5:43 PM To: r-h...@stat.math.ethz.ch Subject: Re: [R] Coordinate or top left corner + offset David L Carlson tamu.edu> writes: > > This is more complicated, but it could be rolled up into a function. Replace your mt

Re: [R] Variance is different in R vs. Excel?

2015-02-09 Thread David L Carlson
Time for a new version of Excel? I cannot duplicate your results in Excel 2013. R: > apply(dat, 2, var) [1] 21290.80 24748.75 Excel 2013: =VAR.S(A2:A21) =VAR.S(B2:B21) 21290.8 24748.74737 ----- David L Carlson Department of Anthropology Texas

Re: [R] Coordinate or top left corner + offset

2015-02-09 Thread David L Carlson
plot window and the size of the default character width in user coordinate units. 3) Draw a white rectangle the size of the character you are plotting (in this case cex=2.5). Shrink the left and top edge so that the box around the plot area is not obscured. 4) Plot your character in the center

Re: [R] Still trying to avoid loops

2015-02-04 Thread David L Carlson
How about? > ave(dat$D, dat$S, FUN=order) [1] 2 1 1 1 2 3 > ave(dat_2$D, dat_2$S, FUN=order) [1] 2 2 1 1 1 3 Note, your answer for the second example is incorrect since row 2 (c, 3) and row 5 (c, 2) are both assigned 2. - David L Carlson Departm

Re: [R] naming rows/columns in 'array of matrices' | solved

2015-01-31 Thread David L Carlson
ve 1 2 dead 3 4 , , 2 age status old young live 5 6 dead 7 8 David L. Carlson Department of Anthropology Texas A&M University -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of peter dalgaard Sent: Saturday, January

Re: [R] Your personal email on the R-help mail list

2015-01-29 Thread David L Carlson
Yes. I thought I was replying to a different message. Sorry. David -Original Message- From: Chel Hee Lee [mailto:chl...@mail.usask.ca] Sent: Thursday, January 29, 2015 11:33 AM To: David L Carlson Subject: Your personal email on the R-help mail list Hi David, I am not sure if you

Re: [R] Passing a Data Frame Name as a Variable in a Function

2015-01-29 Thread David L Carlson
That's fine, but I'm here in town if you want me to pick her up at the airport. David -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Chel Hee Lee Sent: Thursday, January 29, 2015 9:18 AM To: Jeff Newmiller; Alan Yong; r-help@r-project.org Subject: Re: [

Re: [R] Working with < and > is data sets

2015-01-26 Thread David L Carlson
.3",..: 1 1 1 1 2 2 2 2 3 3 ... $ value : num 1160 27.3 1.2 0.03 1870 45.7 0.85 0.025 695 31.9 ... $ note : chr "Measured" "Measured" "Limit" "Limit" ... > head(zp) variable value note 1 ZP.1 1160.00 Measured 2 ZP.1 27.30 Measur

Re: [R] Complex merging problems

2015-01-13 Thread David L Carlson
I think the OP does not want to list duplicate records. Perhaps > merge(unique(df1), df2, all.y=TRUE) v1 v2 ind 1 1 83 1 2 1 84 1 3 2 83 NA 4 2 84 NA 5 3 83 NA 6 3 84 NA 7 4 83 NA 8 4 84 NA ----- David L Carlson Department of Anthropology Te

Re: [R] number of individuals where X=0 during all periods (longitudinal data)

2014-12-22 Thread David L Carlson
Spend a little time with aggregate() ?aggregate - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of najuzz Sent: Mo

Re: [R] combinations between two vectors

2014-12-18 Thread David L Carlson
included > pairs2 <- pairs1[pairs1[,1] <= pairs1[,2],] > nrow(pairs2) [1] 21 # Same as pairs2 but (1, 1), etc are not included > pairs3 <- pairs1[pairs1[,1] < pairs1[,2],] > nrow(pairs3) [1] 15 --------- David L Carlson Department of Anthropo

Re: [R] Extract values from multiple lists

2014-12-16 Thread David L Carlson
Something like scens <- paste0("scen", 1:N) new.df <- data.frame(sapply(scens, function(x) get(x)[["pop.inf.r"]])) --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Orig

Re: [R] dotplot axes labelling

2014-12-15 Thread David L Carlson
You are very close. The argument scales(list(y=list())) supports multiple arguments for the y axis so you need to tell lattice how to use testylabels: dotplot(testmatrix, scales=list(y=list(labels=testylabels), xlab=NULL)) - David L Carlson Department of

Re: [R] create matrices with constraint

2014-12-15 Thread David L Carlson
ould not necessarily produce the maximum number of matrices possible. --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of J

Re: [R] if else for cumulative sum error

2014-12-02 Thread David L Carlson
<- sapply(1:150, function(x) sum(dadosmax$above[x:(x+44)])) > dadosmax$enchday <- ifelse(sums >= 45, 1, 0) But it won't be as fast if you have a large data set. - David L Carlson Department of Anthropology Texas A&M University Coll

Re: [R] Creating submatrices from a dataframe, depending on factors in sample names

2014-12-01 Thread David L Carlson
94462_3 EU686593_2 94.4 95.6 94.8 JN166322_2 95.3 96.5 95.9 EU491340_2 96.5 97.7 96.0 - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- Fro

Re: [R] Converting list to character

2014-11-25 Thread David L Carlson
15 1251 2011 GR.3.1, GR.3.8 16 1801 2011 GR.3.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

Re: [R] Rose Diagrams for Geology

2014-11-21 Thread David L Carlson
No. Just use the circular() function to specify that your data are in degrees and clockwise and the graph will be labeled that way. David C (I was beginning to think that this thread was only for Davids). -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-proj

Re: [R] Rose Diagrams for Geology

2014-11-18 Thread David L Carlson
Look at circular more carefully. It accepts both degrees and radians, but you have to create a circular object with circular() to specify what kind of circular data you have. Then you can plot and get circular statistics on your data. - David L Carlson

Re: [R] Help for x axis

2014-11-18 Thread David L Carlson
ou will need to read the manual pages for barplot() and axis() and the page on graphical parameters par(). In particular, you will have to allocate more space at the bottom of the plot if you want to add more lines. - David L Carlson Department of Anthropo

Re: [R] Help for x axis

2014-11-18 Thread David L Carlson
=TRUE) axis(1, 0:4, c("Smoke", "-", "+", "-", "+"), line=2, lwd=0, cex.axis=1.25, xpd=TRUE) David -Original Message- From: Olivier [mailto:olivier.lerou...@ymail.com] Sent: Monday, November 17, 2014 4:39 PM To: David L Carlson Subje

Re: [R] Help with ddply/summarize

2014-11-14 Thread David L Carlson
ing NA > mean(get(txt)) [1] 5.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-project.org] On Behalf Of John Posner Sent: Thursday, November 13,

Re: [R] factor levels > numeric values

2014-11-12 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 Gerrit Eichner Sent: Wednesday, November 12, 2014 8:06 AM To: David Studer C

Re: [R] Counting within groups / means by groups

2014-11-10 Thread David L Carlson
$ group: Factor w/ 3 levels "A","B","C": 1 1 1 2 2 2 2 3 $ value: num 1 3 2 2 2 4 4 1 I changed df to dfa since df() is the density function for the f distribution. R is not likely to get confused, but you might. Then read the manual page on ave() to see why these wo

Re: [R] limit of cmdscale function

2014-11-06 Thread David L Carlson
You avoid the call to cmdscale() by supplying your own starting configuration (see the manual page for the y= argument). You could still hit other barriers within isoMDS() or insufficient memory on your computer. - David L Carlson Department of Anthropology

Re: [R] reading data from a web

2014-10-29 Thread David L Carlson
. $ V19: num 0 7 2 27 2 0 0 80 30 0 ... $ V20: num 0 0 0 0 0 0 0 0 0 0 ... $ V21: num NA NA NA NA NA NA NA NA NA NA ... $ V22: num NA NA NA NA NA NA NA NA NA NA ... $ V23: num NA NA NA NA NA NA NA NA NA NA ... $ V24: num NA NA NA NA NA NA NA NA NA NA ... $ V25: num NA NA NA NA NA NA NA NA NA

Re: [R] "inahull? from package alphahull not working when used with lapply

2014-10-27 Thread David L Carlson
Why not just > library (alphahull) > DT=data.frame(x=c(0.25,0.25,0.75,0.75),y=c(0.25,0.75,0.75,0.25)) > Hull <- ahull(DT, alpha = 0.5) > TEST<- data.frame(x=c(0.25,0.5),y=c(0.5,0.5)) > apply(TEST, 1, function(x) inahull(Hull, x)) [1] FALSE TRUE ----

Re: [R] Selecting rows/columns of a matrix

2014-10-26 Thread David L Carlson
Note that you do not have to create the vector of 1's (TRUE) and 0's (FALSE) if you know the index values: > j <- c(2, 4, 6) > a[j, j] [,1] [,2] [,3] [1,]8 20 32 [2,] 10 22 34 [3,] 12 24 36 ========== David L. Carlson Department of

Re: [R] how to calculate a numeric's digits count?

2014-10-24 Thread David L Carlson
presented in the file, analyze them as character strings. ------------- 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] assigning letter to a column

2014-10-17 Thread David L Carlson
ct.org] On Behalf Of David L Carlson Sent: Friday, October 17, 2014 9:15 AM To: Monaly Mistry; r-help@r-project.org Subject: Re: [R] assigning letter to a column I think it is doing exactly what you have told it to do, but that is probably not what you want it to do. First, you do not need a loop

Re: [R] assigning letter to a column

2014-10-17 Thread David L Carlson
5.40, Inf), labels=c("S", "I1", "I2", "F"), right=FALSE) No loops, no ifelse's. Anything below 3 will - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -

Re: [R] Ternary Plots Do Not Display Ellipses in PDF

2014-10-15 Thread David L Carlson
("winters-pdf.pdf") > ellipses(mean=mn, var=vr, r=r, steps=72, thinRatio=NULL, aspanel=FALSE, + col='red', lwd=2) > dev.off() - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -

Re: [R] Storing vectors as vectors in a list without losing each individual vector

2014-10-14 Thread David L Carlson
ain=paste("Plot of", x[1], "with", x[2]))) NULL - 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 Beh

Re: [R] cbind in a loop...better way? | summary

2014-10-09 Thread David L Carlson
Actually Jeff Laake's can be made even shorter with sapply(mat_list, as.vector) David C -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Evan Cooch Sent: Thursday, October 9, 2014 7:37 AM To: Evan Cooch; r-help@r-project.org Subjec

Re: [R] cbind in a loop...better way?

2014-10-08 Thread David L Carlson
How about > do.call(cbind, lapply(env, as.vector)) [,1] [,2] [1,] 0.00 0.00 [2,] 0.05 0.15 [3,] 0.00 0.00 [4,] 20.00 15.00 [5,] 0.00 0.00 [6,] 0.10 0.20 [7,] 50.00 45.00 [8,] 0.00 0.00 [9,] 0.00 0.00 ----- David L Carlson Departm

Re: [R] Conditional Data Manipulation -Cumulative Product

2014-10-07 Thread David L Carlson
0.00 0.00 10 2014-01-10 0.00 0.00 1.68 0.98 0.00 11 2014-01-11 0.43 0.00 1.98 1.46 0.00 12 2014-01-12 1.51 0.78 1.63 0.46 1.84 13 2014-01-13 0.26 0.34 0.34 0.97 1.13 David C -Original Message- From: Pooya Lalehzari [mailto:plalehz...@platinumlp.com] Sent: Tuesday, October 7, 2014 8:06 PM To

Re: [R] Conditional Data Manipulation -Cumulative Product

2014-10-07 Thread David L Carlson
o for X1 "2014-01-05" is both a start and stop date (value 1.04) and the second start/end would be "2014-01-11" to "2014-01-13" (values .43, 1.51, .26). What do you mean by compounding? David C -Original Message- From: Pooya Lalehzari [mailto:plalehz...@plati

Re: [R] Conditional Data Manipulation -Cumulative Product

2014-10-07 Thread David L Carlson
You need to use plain text, not html in your email. Your data are scrambled (see below). It is better to send your data using the R dput() function: dput(StartSignals) dput(MainData) dput(StopSignals) - David L Carlson Department of Anthropology Texas A&a

Re: [R] How to extract table results from survival summary object

2014-10-07 Thread David L Carlson
869 0.0097 0.01142 0.01219 ... $ upper : num 1 1 0.997 0.992 0.989 ... $ lower : num 0.987 0.966 0.959 0.947 0.941 ... Since res is a list containing the columns you want plus other information, we need to extract the needed columns from res and then combine those columns into a dat

Re: [R] Using PCA to filter a series

2014-10-03 Thread David L Carlson
7 Since you want a single variable to stand for all four, you could scale new to the mean: > newd <- new*mean(d.svd$v[,1]) > head(newd) [1] 130.9300 114.3972 120.3884 119.9340 116.1588 122.3983 ----- David L Carlson Department of Anthropology Texa

Re: [R] Using PCA to filter a series

2014-10-02 Thread David L Carlson
iginal four variables > new2 <- predict(lm(rowMeans(cbind(d1, d2, d3, d4))~pca$scores[,1])) > lines(new2, col="red") --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 From: r-help-b

Re: [R] Converting factor data into Date-time format

2014-09-30 Thread David L Carlson
First, use stringsAsFactors=FALSE with the read.csv() function. That will prevent the conversion to factors. Then try to convert date and time to datetime objects. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 7

Re: [R] adding rows

2014-09-25 Thread David L Carlson
Another approach fun <- function(i, dat=x) { grp <- rep(1:(nrow(dat)/i), each=i) aggregate(dat[1:length(grp),]~grp, FUN=sum) } lapply(2:6, fun, dat=TT) - David L Carlson Department of Anthropology Texas A&M University College Station, TX

Re: [R] Cluster -- Agnes function

2014-09-24 Thread David L Carlson
Read the documentation for cutree(). You will have to decide how many clusters you want to use since agnes() provides results for everything from n clusters (where n is the number of observations) to 1 cluster. ?cutree - David L Carlson Department of

Re: [R] Copying tables from R to Excel

2014-09-23 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 Ivan Calandra Sent: Tuesday, September 23, 2014 8:12 AM To: r-help@r

Re: [R] Pseudo R squared for quantile regression with replicates

2014-09-18 Thread David L Carlson
(... which is what fit is. --------- 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 Donia Smaali Bouhlila Sent: Thursday, September 18, 201

Re: [R] column names to row names

2014-09-17 Thread David L Carlson
Factor w/ 36 levels "1","10","11",..: 1 12 23 31 32 33 34 35 36 2 ... $ station : chr "A" "A" "A" "A" ... It seems strange that the discharge and year would be factors and station would be character. -

Re: [R] chi-square test

2014-09-15 Thread David L Carlson
ith simulated p-value (based on 2000 replicates) data: TT X-squared = 7919.632, df = NA, p-value = 0.0004998 ----- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From:

Re: [R] apply block of if statements with menu function

2014-09-15 Thread David L Carlson
just index the return value: > let <- letters[1:4] > let[menu(let)] 1: a 2: b 3: c 4: d Selection: 3 [1] "c" Or a bit more polished: > cat("Choice: ", let[menu(let)], "\n") 1: a 2: b 3: c 4: d Selection: 4 Choice: d ---------

Re: [R] mice - undefined columns selected

2014-09-12 Thread David L Carlson
mpler imputation methods. Package VIM has a number of options of which nearest neighbor and hot deck might work well with your data. --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message---

Re: [R] Margins to fill matrix

2014-09-11 Thread David L Carlson
2 18042 46 [10,] 19220 17550 50 [11,] 107 23 24 19 112 19 25 20 349 --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- F

Re: [R] incorrect number of dimensions

2014-09-11 Thread David L Carlson
frame (or matrix) with at least 4 columns. --------- 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 Mar

Re: [R] create new column by replacing multiple unique values in existing column

2014-09-11 Thread David L Carlson
at1$b) > table(dat1$new) > table(dat1$new) 1 2 3 5 5 5 > table(dat1$b) A1 A2 B1 5 5 5 If b is not a factor in your table, make it one ?factor - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352

Re: [R] KDE routines for data that is aggregated

2014-09-09 Thread David L Carlson
contour, etc. - 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 Saptarshi Guha Sent: Mo

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

2014-09-05 Thread David L Carlson
on Kiss [mailto:sjk...@gmail.com] Sent: Friday, September 5, 2014 10:22 AM To: David L Carlson Cc: r-help@r-project.org Subject: Re: [R] Turn Rank Ordering Into Numerical Scores By Transposing A Data Frame HI, of course. The a mini-version of my data-set is below, stored in d2. Then the code I'

Re: [R] calculate Euclidean distances between populations in R with this data structure

2014-09-05 Thread David L Carlson
There may be a specialized package for this in bioconductor, but it seems that you could just use aggregate() to calculate the means for each population and then use the results of that in dist(). ?aggregate - David L Carlson Department of Anthropology Texas

Re: [R] depth of labels of axis

2014-09-04 Thread David L Carlson
help@r-project.org Subject: Re: [R] depth of labels of axis On Sep 3, 2014, at 10:05 PM, Jinsong Zhao wrote: > On 2014/9/3 21:33, Jinsong Zhao wrote: >> On 2014/9/2 11:50, David L Carlson wrote: >>> The bottom of the expression is set by the lowest character (which can >>

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

2014-09-04 Thread David L Carlson
egating function is not working properly with mine. Any other thoughts? Simon On Aug 18, 2014, at 10:44 AM, David L Carlson wrote: > Another approach using reshape2: > >> library(reshape2) >> # Construct data/ add column of row numbers >> set.seed(42) >> mydf

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

2014-09-03 Thread David L Carlson
/questions/6127/which-permutation-test-implementation-in-r-to-use-instead-of-t-tests-paired-and David C From: wbradleyk...@gmail.com [mailto:wbradleyk...@gmail.com] On Behalf Of W Bradley Knox Sent: Wednesday, September 3, 2014 9:20 AM To: David L Carlson Cc: Tal Galili; r-help@r-project.org Subject: Re

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