Re: [R] probability or a quantile from various distributions for multiple comparisons of means

2016-01-26 Thread David L Carlson
-project.org/web/packages/multcomp/vignettes/multcomp-examples.pdf There is also a function, p.adjust(), that adjusts p-values for multiple comparisons that is included in the stats package in R. ?p.adjust - David L Carlson Department of Anthropology Texas A&a

Re: [R] Fwd:

2016-01-21 Thread David L Carlson
Assuming Michael is correct, you can use setdiff(): > set.seed(42) > current <- sample.int(4500, 4495) # All but 5 numbers used > setdiff(1:4500, current) # Find which numbers are left [1] 905 1252 2508 3192 4484 --------- David L Carlson Department of

Re: [R] LSD value

2016-01-18 Thread David L Carlson
[4] LSD 13.4704 > out[[1]][4] LSD 13.4704 - 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 Jianling Fan Sent: Monday, January 18, 2016 10

Re: [R] Subsetting a square marix

2016-01-05 Thread David L Carlson
. But none of these are labels in your data set since R is case sensitive. Try for example: > sub <- c("Sp1", "Sp3", "Sp5") > dta[sub, sub] Sp1 Sp3 Sp5 Sp1 0 0 0 Sp3 1 0 1 Sp5 0 0 0 And definitely spend some time with the available free R

Re: [R] need for help for solving operations in a vector

2015-12-23 Thread David L Carlson
. Or try combining the results of diff(x, 1) and diff(x, 2). You should not try to program in R until you have read more about the R language. ----- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Me

Re: [R] geomorph: adding confidence ellipses

2015-12-22 Thread David L Carlson
Look at scatter3d() in the car package. It has an option to add a confidence ellipsoid to an interactive 3d plot. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-

Re: [R] Converting from Continuous 2D Points to Continuous 2D Vectors

2015-12-18 Thread David L Carlson
Look at the CRAN Task View: "Handling and Analyzing Spatio-Temporal Data," particularly the section on "Moving objects, trajectories." The tools you need are probably already available. https://cran.r-project.org/web/views/SpatioTemporal.html -----

Re: [R] Gather columns based on multiple columns using tidyr

2015-12-17 Thread David L Carlson
cotland.df) Year month rainfall_mm 67 2013 Dec 300.7 68 1986 Dec 268.5 69 1929 Dec 267.2 70 2011 Dec 265.4 71 2006 Dec 264.0 72 1912 Dec 261.0 --------- David L Carlson Department of Anthropology Texas A&M University Co

Re: [R] Applying a function to a matrix using indexes as arguments

2015-12-17 Thread David L Carlson
1-column matrix" > as.matrix(A) [,1] [1,] 100 [2,] 200 ------------- 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 Jef

Re: [R] how to plot two variables in a figure using ggplot2

2015-12-16 Thread David L Carlson
;, "8", "9")) > matplot(dat$XX, dat[, 2:3], type="l", xlab="XX", ylab="OA & KA") > legend("topleft", c("OA", "KA"), col=1:2, lty=1:2) - David L Carlson Department of Anthropo

Re: [R] adding vector values to corresponding components of a list

2015-12-15 Thread David L Carlson
E FALSE As you can see, it makes a difference. --------- 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 debra ragland via R

Re: [R] Hexbin: Counting Bins That Meet Certain Criteria

2015-12-15 Thread David L Carlson
Something like > library(hexbin) > set.seed(42) > xy <- matrix(rnorm(1000), 500) > xy.hex <- hexbin(xy) > table(xy.hex@count) 1 2 3 4 5 6 7 8 159 60 33 16 6 1 2 1 > sum(xy.hex@count >= 3) [1] 59 ------------- Da

Re: [R] Random selection of a fixed number of values by interval

2015-12-14 Thread David L Carlson
seed(42) > samples <- lapply(1:5, function(x) sample(data$id[groups==grp[x]], + size[x])) > names(samples) <- grp > samples $`[0,1)` [1] 69 68 33 63 56 46 65 12 50 58 $`[1,2)` [1] 20 34 43 8 15 52 19 $`[2,3)` [1] 7 22 62 28 2 $`[3,4)` [1] 61 53 5 25 21 $`[4,5)` [1] 59 35

Re: [R] applying wilcox.test to every combination of rows in a matrix (pairwise)

2015-12-09 Thread David L Carlson
t the errors Error in wilcox.test.formula(pc1.eigv ~ p[i, ]) : grouping factor must have exactly 2 levels AND Error in wilcox.test.formula(vals ~ tf[i, ]) : grouping factor must have exactly 2 levels On Wednesday, December 9, 2015 12:28 PM, David L Carlson wrote: If I understand correctly,

Re: [R] applying wilcox.test to every combination of rows in a matrix (pairwise)

2015-12-09 Thread David L Carlson
0.6572552 1.000 [25] 0.6572552 0.6572552 1.000 0.6572552 0.3005223 1.000 [31] 0.6572552 1.000 0.3005223 0.6572552 0.6572552 1.000 - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Origin

Re: [R] column means dropping column minimum

2015-12-08 Thread David L Carlson
333 ----- 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 Giorgio Garziano Sent: Tuesday, December 8, 2015 12:58 PM To: r-help@r-project.org Subj

Re: [R] dataframe rbind

2015-12-04 Thread David L Carlson
um -1.91926 0.00791 0.65523 0.95019 1.23822 ... $ b : num 0.344 1.281 2.057 -1.69 -0.268 ... $ ID: int 0 0 0 0 0 0 0 0 0 0 ... ----- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- F

Re: [R] fill the area outside a polygon

2015-12-02 Thread David L Carlson
lue", border=NA) --------- 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 Adrian Du?a Sent: Wednesday, December 2, 2

Re: [R] PCA plot of variable names only

2015-11-30 Thread David L Carlson
#x27;t want the symbols just the names, change the last two lines: > plot(dat.pca$rotation[, 1:2], type="n") > text(dat.pca$rotation[, 1:2], colnames(dat)) --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX

Re: [R] Conditional Random selection

2015-11-21 Thread David L Carlson
ames = c(NA, -8L)) You can just remove the lines with X1 = 0 since you don't want to use them. > tab.sub <- tab[tab$X1>0, ] Then the following gives you a sample: > tab.sub[cumsum(sample(tab.sub$X2))<=500, ] Note, that your "solution" of times 6, 7, and 8 wi

Re: [R] knn - random result although use.all=TRUE

2015-11-20 Thread David L Carlson
tied values so the algorithm probably uses a random method of selecting which 3 to use. - 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

Re: [R] Strange result when subsetting a data frame based on a character variable

2015-11-17 Thread David L Carlson
ot;100" > as.character(1000) [1] "1000" - 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 peter dalgaard Sent: Tuesd

Re: [R] Error in mkRespMod(fr, family = family) : response must be numeric

2015-11-16 Thread David L Carlson
y J H Maindonald - https://cran.r-project.org/doc/contrib/usingR.pdf R for Beginners by E Paradis - https://cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf The R Guide by W J Owen - https://cran.r-project.org/doc/contrib/Owen-TheRGuide.pdf - David L Carlson Depar

Re: [R] Clustered Standard Errors?

2015-11-16 Thread David L Carlson
an R script file. Given the cost of a single business license for STATA in the US for moderate-sized datasets of $1,195 (perpetual) versus the cost of R, $0 (perpetual), it would seem to be worth the bother. - David L Carlson Department of Anthropology Texas A

Re: [R] Ranking

2015-11-15 Thread David L Carlson
I used your code but deleted sep="\t" since there were no tabs in your email and added the fill= argument I mentioned before. David Original message From: Ashta Date: 11/14/2015 6:40 PM (GMT-06:00) To: David L Carlson Cc: R help Subject: Re: [R] Ranking Thank

Re: [R] Ranking

2015-11-14 Thread David L Carlson
margins(xtabs(~Country+STATUS, test), 2) STATUS Country L W Sum FRA 2 3 5 GER 1 3 4 SPA 2 1 3 UNK 1 2 3 USA 1 2 3 I'll let you figure out how to get the last column. David L. Carlson Department of Anthropology Texas A&M University -Original Me

Re: [R] Suprising R behaviour

2015-11-14 Thread David L Carlson
$x + z[2]) > outputs [,1] [,2] [,3] [1,] FALSE TRUE FALSE [2,] FALSE TRUE FALSE [3,] FALSE TRUE TRUE [4,] TRUE TRUE FALSE [5,] TRUE TRUE TRUE [6,] TRUE TRUE TRUE The first column is the result for the first equation (row in fin_hyp) and so on. David L. Carlson Department of Anthropol

Re: [R] Suprising R behaviour

2015-11-14 Thread David L Carlson
d circle) if above the line and # 1 (open circle) if below the line sym <- ifelse(outputs, 16, 1) plot(y~x, data, pch=sym) abline(a=fin_hyp$constant, b=fin_hyp$slope) David L. Carlson Department of Anthropology Texas A&M University -Original Message- From: R-help [mailto:r-help-boun...@

Re: [R] *.rpt data

2015-11-12 Thread David L Carlson
lways Crystal Reports format, unless the program is using the same reporting engine." If it is a Crystal Reports file, the portion needed would likely have to be converted to .csv unless ----- David L Carlson Department of Anthropology Texas A&M University C

Re: [R] calculate factor scores

2015-11-09 Thread David L Carlson
I think you can use predict.psych() in package psych. Since you analyzed a correlation matrix with fa() it does not have access to the original data. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-

Re: [R] replace NA's with row means for specific columns

2015-11-03 Thread David L Carlson
na(Zdf[, i]), arr.ind=TRUE) + Zdf[, i][miss]<- mn[miss[, 1]] + } > > Zdf ID A1 A2 A3 B1 B2 B3 C1 C2 C3 C4 1 b 4 5 4.5 2.0 3.0 4 5 1 3 3 2 c 4 5 1.0 3.5 3.0 4 5 1 3 2 3 d 3 5 1.0 1.0 2.5 4 5 1 3 2 4 e 4 5 4.0 5.0 4.5 4 5 1 3 2 -

Re: [R] Extract entries from matrix

2015-10-27 Thread David L Carlson
em out, but then we have 4th: 1, 2, 3; 5th: 1, 2, 3; 6th: 1, 2, 3, 4, etc so you must have some additional rule in mind to get your answer. --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Messa

Re: [R] Number of digits to display?

2015-10-26 Thread David L Carlson
if(x, 4) [1] 0.9148 > library(MASS) > fractions(x) [1] 7334/8017 > dput(x) # But x is still the same 0.914806043496355 David L. Carlson Department of Anthropology Texas A&M University -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf

Re: [R] y2z question (AGD)

2015-10-26 Thread David L Carlson
Thanks for this. I knew that na.exclude() existed, but never understood how to combine it with naresid(). David C -Original Message- From: William Dunlap [mailto:wdun...@tibco.com] Sent: Monday, October 26, 2015 1:46 PM To: David L Carlson Cc: Martin Canon; R help Subject: Re: [R] y2z

Re: [R] y2z question (AGD)

2015-10-25 Thread David L Carlson
9.0 12 -0.635 4 F NA 9 NA 5 M5.8 1 2.002 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 Martin Canon Sent: Sunday, October 25, 2015 7:03 AM To: R help Subject

Re: [R] elementwise matrix multiplication with a special structure

2015-10-23 Thread David L Carlson
0 [73] 21000 96000 189000 84000 24 432000 189000 432000 729000 # Or a bit more compactly > dd <- aa[x[, c(2, 1)]] * bb[x[, c(4, 2)]] * cc[x[, c(1, 3)]] - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Messa

Re: [R] Reformatting dataframe for use with icc()

2015-10-10 Thread David L Carlson
1 6 7 0 2 4 0 6 3 0 2 4 If the 0's are a problem: > tbl[tbl==0] <- NA > print(tbl, na.print=NA) rater.id observation123 1 6 7 24 6 3 24 David L. Carlson Department of Anthropology

Re: [R] for loop not working

2015-10-10 Thread David L Carlson
9 -87.6847 > n <- nrow(Places) > distVincentyEllipsoid(Places[1:(n-1), 3:2], Places[2:n, 3:2]) [1] 1753420 3763369 1544119 2794013 > bearing(Places[1:(n-1), 3:2], Places[2:n, 3:2]) [1] -158.98140 -66.71221 -11.57217 90.36231 David L. Carlson Department of Anthropology Texas A&M Uni

Re: [R] How to remove the grid around the plot(ca(...)) function?

2015-10-08 Thread David L Carlson
d1.plt$cols, the column coordinates. --------- 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 Luca Meyer Sent: Thursday, October

Re: [R] Measure the frequencies of pairs in a matrix

2015-10-08 Thread David L Carlson
0 0.00 0.00 8 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 9 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 This puts everything on the diagonal and upper triangle. To get the lower triangle just use > tbl <- xtabs(~X2+X1, mat2) ----- David L Carlson Depa

Re: [R] Measure the frequencies of pairs in a matrix

2015-10-07 Thread David L Carlson
4 44 5 - 80 45 5 - 90 46 6 - 60 47 6 - 72 48 6 - 80 49 6 - 90 50 7 - 70 - 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 Beha

Re: [R] help with problem

2015-10-06 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 Marco Otoya Chavarria Sent: Tuesday, October 6, 2015 10:15 AM To: r-help@r-project

Re: [R] Strange Bug in R

2015-10-06 Thread David L Carlson
There is a simple way to get closer to how a floating point number is stored in R with dput(): > dput(min(dataset$gpa)) 1.8997615814 > dput(dataset$gpa[290]) 1.8997615814 So you can see, the minimum is not 1.9, just very close to 1.9. - D

Re: [R] Counting number of rain

2015-10-01 Thread David L Carlson
4 22 20 30 29 1961 26 9 10 18 18 11 18 14 24 28 30 31 1962 22 14 19 2 18 19 27 26 26 29 15 28 1963 27 17 15 4 9 23 16 24 19 28 30 22 1964 15 25 9 13 19 14 23 20 24 30 25 27 1965 13 21 12 10 21 24 22 21 28 23 28

Re: [R] na.action in xtabs - how to include NAs?

2015-09-30 Thread David L Carlson
0 10 ----- 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 Dimitri Liakhovitski Sent: Wednesday, September 30, 2015 10:22 A

Re: [R] How to get significance codes after Kruskal Wallis test

2015-09-28 Thread David L Carlson
ichael.eisenr...@gmx.ch] Sent: Monday, September 28, 2015 10:40 AM To: David L Carlson Cc: David Winsemius; 'r-help' Subject: Aw: RE: [R] How to get significance codes after Kruskal Wallis test Dear David, Thanks for your answer. Another member of the R list pointed out that one can actua

Re: [R] How to get significance codes after Kruskal Wallis test

2015-09-28 Thread David L Carlson
TRUE - 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 Winsemius Sent: Saturday, September 26, 2015 11:07 AM To: Michael Eisenring Cc: 'r-help&#

Re: [R] Sampling the Distance Matrix

2015-09-25 Thread David L Carlson
You defined x and y in your original email as: > x<-rnorm(20) > y<-rnorm(20) > > mm<-as.matrix(cbind(x,y)) > > dst<-(dist(mm)) --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352

Re: [R] Sampling the Distance Matrix

2015-09-23 Thread David L Carlson
18 19 13 18 19 > dst2[idx, idx] 13 18 19 13 NA 2.272407 3.606054 18 2.272407 NA 1.578150 19 3.606054 1.578150 NA --------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352

Re: [R] Spreadsheet math problem (exponentiation)

2015-09-18 Thread David L Carlson
t you want. - 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 John McKown Sent: Friday, September 18, 2015 9:31 AM To:

Re: [R] generate ordered categorical variable in R

2015-09-16 Thread David L Carlson
There is a version of sample especially for integers: > Q1 <- matrix(sample.int(4, 200, replace=TRUE), 200) > str(Q1) int [1:200, 1] 1 4 4 2 3 3 4 4 2 3 ... ----- David L Carlson Department of Anthropology Texas A&M University College Station,

Re: [R] by Function Result Factor Levels

2015-09-16 Thread David L Carlson
"Med" "Max" > tbl wool tension breaks.Min breaks.Med breaks.Max 1A L 25 51 70 2B L 14 29 44 3A M 12 21 36 4B M 16 28 42 5A H

Re: [R] Multiple if function

2015-09-15 Thread David L Carlson
quot; , "'+'(5,", "sqrt(") > sapply(parse(text=paste0(mult[match(dat$ASB, cat)], dat$Flow, ")")), eval) [1] 23.02000 14.2 3.24037 David -Original Message- From: Bert Gunter [mailto:bgunter.4...@gmail.com] Sent: Tuesday, September 15, 2015 4

Re: [R] Multiple if function

2015-09-15 Thread David L Carlson
You could use match() and avoid ifelse(): > dat <- data.frame(ASB = c(LETTERS[1:3]), Flow=c(11.51, 9.2, 10.5), > stringsAsFactors=FALSE) > cat <- LETTERS[1:3] > mult <- c(.1, .15, .2) > dat$Flow * mult[match(dat$ASB, cat)] [1] 1.151 1.380 2.100 -----

Re: [R] Beta distribution approximate to Normal distribution

2015-09-15 Thread David L Carlson
hist(x) - 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 Rui Barradas Sent: Tuesday, September 15, 2015 12:41 PM To: ted.hard...@wl

Re: [R] Error in principal component loadings calculation

2015-09-14 Thread David L Carlson
726 Cumulative Proportion 0.2872414 0.5301425 0.7115137 0.8778274 1.000 David -Original Message- From: Marcelo Kittlein [mailto:kittl...@mdp.edu.ar] Sent: Monday, September 14, 2015 1:28 PM To: David L Carlson Subject: Re: [R] Error in principal component loadings calculation Thanks David

Re: [R] Error in principal component loadings calculation

2015-09-14 Thread David L Carlson
e Var 0.287 0.530 0.712 0.878 1.000 > pc$sdev^2 Comp.1Comp.2Comp.3Comp.4Comp.5 1.4362072 1.2145055 0.9068555 0.8315685 0.6108632 > # Now the sum of the squared loadings equals the > # squared standard deviation (aka the eigenvalues) ---

Re: [R] kendall tau distance

2015-09-13 Thread David L Carlson
= .4. $pi.c and $pi.d are used to compute C and D as follows: > sum((xy * cd$pi.c))/2 [1] 6 > sum((xy * cd$pi.d))/2 [1] 4 David L. Carlson Department of Anthropology Texas A&M University -Original Message- From: Ragia Ibrahim [mailto:ragi...@hotmail.com] Sent: Saturday, Septe

Re: [R] kendall tau distance

2015-09-11 Thread David L Carlson
The Wikipedia article gives a simple formula based on the number of discordant pairs. You can get that from the ConDisPairs() function in package DescTools. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-

Re: [R] help with reshape

2015-09-08 Thread David L Carlson
pagne-Ardenne GEGENAA - EA 3795 CREA - 2 esplanade Roland Garros 51100 Reims, France +33(0)3 26 77 36 89 ivan.calan...@univ-reims.fr https://www.researchgate.net/profile/Ivan_Calandra Le 08/09/15 16:23, David L Carlson a écrit : > I have not followed this thread closely, but this seems to work: &g

Re: [R] help with reshape

2015-09-08 Thread David L Carlson
("ID","Nom_ech")) If this is the expected outcome, the problem is the NA values in repet. I changed them to 0 since you did not have any 0 entries in the data (otherwise you could use 999 or some other value that does not occur in the data). Change them back after running resha

Re: [R] extracting every nth character from a string...

2015-09-07 Thread David L Carlson
No rex, but not much less complicated, than your original but a different approach: > i <- seq(1, nchar(str), 2) > paste0(mapply(substr, str, i, i), collapse="") [1] "ACEG" --------- David L Carlson Department of Anthropology Texas A&

Re: [R] Choosing columns by number

2015-08-25 Thread David L Carlson
rsicolor",..: 1 1 1 1 1 1 1 1 1 1 ... --------- 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 Sam Albers Sent: Tuesday, August 25, 20

Re: [R] Plot z=f(x,y) analytically

2015-08-19 Thread David L Carlson
You probably want function persp3d() in package rgl. You have to define the formula as a function and specify the limits correctly, but you were close: > library(rgl) > persp3d(function(x, y) x^2+y^2, xlim=c(-3, 3), ylim=c(-3, 3)) - David L Carlson Depa

Re: [R] data format

2015-08-19 Thread David L Carlson
42 72 44 90 43 3 37 32 44 48 71 46 89 42 - 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 Beh

Re: [R] Confussion matrix in tree clasiffication

2015-08-19 Thread David L Carlson
Use predict.tree() with type="class" on the object returned by tree(). Then use that to construct a cross tabulation against the original data. If you provide a reproducible example with data, I could be more specific. ----- David L Carlson Dep

Re: [R] write.csv file= question

2015-08-04 Thread David L Carlson
size isdir mode mtime ctime Test.csv 600 FALSE 666 2015-08-04 10:13:23 2015-08-04 10:11:56 atime exe Test.csv 2015-08-04 10:11:56 no - David L Carlson Department of Anthropology Texas A&M Un

Re: [R] Using R to fit a curve to a dataset using a specific equation

2015-08-03 Thread David L Carlson
AM To: David L Carlson Cc: r-help Subject: Aw: RE: RE: [R] Using R to fit a curve to a dataset using a specific equation Hi David, thank you for your help. It makes sense to me that the R2 is very misleading in an non-linear regression. the same is true for the p-values. My question then is: how

Re: [R] Using R to fit a curve to a dataset using a specific equation

2015-08-03 Thread David L Carlson
h.out=200) yval <- predict(dta.nls, data.frame(Damage_cm=xval)) ggplot() + geom_point(data=dta, aes(x=Damage_cm, y=Gossypol)) + geom_line(aes(x=xval, y=yval)) David Carlson From: Michael Eisenring [mailto:michael.eisenr...@gmx.ch] Sent: Saturday, August 1, 2015 5:33 PM To: David L Carlson

Re: [R] Using R to fit a curve to a dataset using a specific equation

2015-08-01 Thread David L Carlson
I can get you started, but you should really read up on non-linear least squares. Calling your data frame dta (since data is a function): plot(Gossypol~Damage_cm, dta) # Looking at the plot, 0 is a plausible estimate for y0: # a+y0 is the asymptote, so estimate about 4000; # b is between 0 and 1,

Re: [R] Element-by-element division

2015-07-28 Thread David L Carlson
apply() will also get you there with almost the same arguments in different order (plus t()): > t(apply(a, 1, "/", b)) [,1] [,2] [1,]2 24 [2,]4 28 [3,]6 32 [4,]8 36 [5,] 10 40 ----- David L Carlson Department of Anthr

Re: [R] Plot in Rcmdr

2015-07-14 Thread David L Carlson
but can be accessed simply by editing the command that R Commander creates. To see these options type ?scatterplot On an empty line in the R Script window, put the cursor on the line and click Submit. This will open your web browser with the manual page for scatterplot. -

Re: [R] Leave one out procedure - R

2015-07-07 Thread David L Carlson
Max. : 1.9160 Max. :1.0245 ------------- 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 John Kane Sent: Monday, July 6, 2015 6:53 PM To: Vyshnn

Re: [R] Greek letters in column titles.

2015-07-06 Thread David L Carlson
4 5 6 7 8 9 > plot(0:9, 0:9, typ="n") > text(0:9, 0:9, names(a)) You just have to figure out the utf8 code for the symbol you want. Windows Character Map works for this and lets you insert the code directly as Ista did, or any of the various web pages listing the codes. ---

Re: [R] question

2015-06-26 Thread David L Carlson
are possible you need to modify the colnames() statement accordingly. David From: Lida Zeighami [mailto:lid.z...@gmail.com] Sent: Friday, June 26, 2015 2:36 PM To: David L Carlson Subject: Re: [R] question David, Thank you so much for your help. just when I inter this line :    > colnames(

Re: [R] question

2015-06-26 Thread David L Carlson
re0 fre1 fre2 A 0 1 1 0 2 2 222 3 B 1 1 1 2 0 0 2232 C 2 1 1 0 0 0 2322 D 1 1 0 0 0 2 2322 E 0 2 1 1 2 2 2124 - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -

Re: [R] Extracting data from a file containing data

2015-06-25 Thread David L Carlson
First, create a variable (a factor) for your categories (did you really intend to exclude September?). Then use the aggregate function. ?factor ?aggregate - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-

Re: [R] quantile of a discrete random variable

2015-06-25 Thread David L Carlson
There is a function called quantile() that provides 9 methods of computing quantiles, three of which are appropriate for discontinuous data. Type ?quantile at the command prompt for details. - David L Carlson Department of Anthropology Texas A&M Univer

Re: [R] create a dummy variables for companies with complete history.

2015-06-24 Thread David L Carlson
1101 J0110 1 > dummy <- as.integer(apply(tbl, 1, all)) > dummy [1] 1 1 1 0 0 1 1 1 0 0 - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message---

Re: [R] Omitting NA's using dcast (reshape2 package)

2015-06-22 Thread David L Carlson
9 ----- 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 michael.laviole...@dhhs.state.nh.us Sent: Monday, June 22, 2015 8:47 AM To: r-help@r-project.org Subj

Re: [R] help for lay person assisting R user with disability

2015-06-18 Thread David L Carlson
are saved, they should be preserved when the program is restarted. There are also some graphical user interfaces for R that may be easier to use such as R Commander. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 7

Re: [R] Cross tabulation with top one variable and side as multiple variables

2015-06-18 Thread David L Carlson
lst <- lapply(rowvars, function(x) xtabs(~x+TREND)) That would give you a list containing a crosstabulation table between each of the variables and TREND. A spreadsheet with 2000 tables seems a bit unwieldy so you might want to give some thought to what you really want as output. ---

Re: [R] dplyr - counting a number of specific values in each column - for all columns at once

2015-06-16 Thread David L Carlson
Not in base, but in stats: > aggregate(md[,-4]==5, list(device=md$device), sum, na.rm=TRUE) device a b c 1 1 1 2 0 2 2 0 1 0 3 3 1 0 2 ----- David L Carlson Department of Anthropology Texas A&M University College Station, TX 778

Re: [R] Summarizing data based on Date

2015-06-09 Thread David L Carlson
What does the following command print out? str(test) The error message indicates that test$CHG_WT is not numeric. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: R-

Re: [R] Blank spaces are replaced by period in read.csv, I want to replace blacks with an underline

2015-06-08 Thread David L Carlson
5 510 David C From: John Sorkin [mailto:jsor...@grecc.umaryland.edu] Sent: Monday, June 8, 2015 9:25 AM To: David L Carlson Cc: r-help@r-project.org Subject: RE: [R] Blank spaces are replaced by period in read.csv, I want to replace blacks with an underline David, I appreciate you sugge

Re: [R] Blank spaces are replaced by period in read.csv, I want to replace blacks with an underline

2015-06-08 Thread David L Carlson
gsub("\\.", "_", names(dat)) > dat Var_1Var_2 1 9.627122 14.15376 2 10.741617 16.92937 3 8.492926 15.23767 4 12.226146 15.19834 5 8.829982 14.46957 - David L Carlson Department of Anthropology Texas A&M University College Sta

Re: [R] Matrix of indexes to extract sparse data in dataframe

2015-06-05 Thread David L Carlson
-3 12 2 -23 17 See the help page for [ ?'[' --------- 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 Sergio Fo

Re: [R] reshape a data frame

2015-06-04 Thread David L Carlson
B 12 B_2 314.02 2 B To get bc1, bc2 instead of 1, 2 in the col field: > exnew2 <- reshape(ex, varying=2:3, v.names="bcX", timevar="col", + times=colnames(ex)[2:3], direction="long") - David L Carlson Department of

Re: [R] Colour gradient is not working.

2015-06-01 Thread David L Carlson
not more, you may have overloaded the plot device. - 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 sreenath

Re: [R] Problem with comparing multiple data sets

2015-05-27 Thread David L Carlson
cat(paste0("[", 1:length(Out), "] #dac ", Out), sep="\n") David From: Mohammad Alimohammadi [mailto:mxalimoha...@ualr.edu] Sent: Wednesday, May 27, 2015 2:29 PM To: David L Carlson; r-help@r-project.org Subject: Re: [R] Problem with comparing multiple data sets

Re: [R] Problem with comparing multiple data sets

2015-05-27 Thread David L Carlson
Save the result of the apply() function: Out <- apply(df[ ,2:length(df)], 1, mfv) Then there are several options: Approximately what you asked for data.frame(Out) t(t(Out)) More typing but exactly what you asked for cat(paste0("[", 1:length(Out), "] ", Out), sep=&

Re: [R] information_request

2015-05-27 Thread David L Carlson
Start R and then type: > summary.lm 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 Carmine Apice Sent: Wednesday, May 27, 2015 11:24 AM To: r-help@r-project.org Subj

Re: [R] Identifying peak periods of observations in circular yearly data

2015-05-27 Thread David L Carlson
days 10% 90% 60 228 > # Plot the results > plot(circ, stack=TRUE, axes=FALSE) > axis <- circular(c(0, 90, 180, 270), units="degrees", template="geographics") > axis.circular(at=axis, labels=c("Jan", "April", "July", "October"

Re: [R] Error after performing anosim function with vegan

2015-05-20 Thread David L Carlson
frame or matrix." If you just want to look at the data use, View() not fix(). --------- 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-pro

Re: [R] Count number in r

2015-05-19 Thread David L Carlson
Here's an approach using xtabs() if you want the output as a table: > flag <- as.integer(d$Rain>=.1) > xtabs(flag~Year+Month, d) Month Year1 2 1971 12 0 --------- David L Carlson Department of Anthropology Texas A&M University Coll

Re: [R] Error in dimnames(phi) <- list(rn, dims) : length of 'dimnames' [2] not equal to array extent

2015-05-18 Thread David L Carlson
up to 11) from "author". I am certain I have used ca() in the past and extracted more than two dimensions from similar tables. - David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Me

Re: [R] create a vector from several data frames

2015-05-14 Thread David L Carlson
get, "tmax"]) will return a named vector of the tmax values. ----- 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 St

Re: [R] Drawing the regression line and the 95% confidence intervals

2015-05-06 Thread David L Carlson
del.1)~GDP.per.head) abline(devlm1) conflm1<-confint(devlm1) abline(coef=conflm1[,1],lty=2) abline(coef=conflm1[,2],lty=2) # Plot the prediction limits segments(GDP.per.head, plim[ , 2], GDP.per.head, plim[ , 3], col="gray") --------- David L Carlson

Re: [R] Special character is graph label

2015-05-06 Thread David L Carlson
You do this with plotmath (see the manual page, ?plotmath): > plot(rnorm(10), rnorm(10), xlab=expression(bar(X))) ----- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From:

Re: [R] lm model exported from R to excel

2015-05-06 Thread David L Carlson
xcel, copy the table in Excel, and then paste into Word. ----- 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 Livia Mar

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