Re: [R] Fwd: Re: transpose and split dataframe

2019-05-02 Thread David L Carlson
1NA If you need a data frame instead of a table: as.data.frame.matrix(DataTable) -------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of Matthew Sent: Tue

Re: [R] Fwd: Re: transpose and split dataframe

2019-04-30 Thread David L Carlson
ectors shorter than mx DataList2 <- lapply(DataList, function(x) c(x, rep(NA, mx-length(x # Finally convert back to a data frame TF2list2 <- do.call(data.frame, DataList2) Try this on a portion of the list, say 25 lines and print each object to see what is happening. ----------

Re: [R] transpose and split dataframe

2019-04-30 Thread David L Carlson
iliar with R, it may be helpful to tell us what your overall goal is rather than an intermediate step. Very likely R can easily handle what you want by doing things a different way. -------- David L Carlson Department of Anthropology Texas A University College St

Re: [R] xtabs ignores l.h.s. rows with NA in just one column - bug or facility?

2019-04-25 Thread David L Carlson
The documentation describes how to control the behavior of missing values: > xtabs( cbind(xx,yy) ~ ff, addNA=TRUE) ff xx yy a 17 b 55 66 But of course, now you do not get 26 in the (a, yy) cell because 26 + NA = NA. ---- David L Carl

Re: [R] Why is it not possible to cut a tree returned by Agnes or Diana by height?

2019-04-15 Thread David L Carlson
2) [1] 1 2 2 > asdf.di <- diana(asdf) > cutree(asdf.di, h=2) Error in cutree(asdf.di, h = 2) : the 'height' component of 'tree' is not sorted (increasingly) > cutree(as.hclust(asdf.di), h=2) [1] 1 2 2 -------- David L Carlson Department of Anthropology Te

Re: [R] Create a sequence

2019-04-09 Thread David L Carlson
Here's another approach: > x <- c(rbind(1:100, -(1:100))) > head(x); tail(x) [1] 1 -1 2 -2 3 -3 [1] 98 -98 99 -99 100 -100 ---- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Origina

Re: [R] Pairwise testing with pairwise.prop.test

2019-04-01 Thread David L Carlson
Inline David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- > From: R-help On Behalf Of Jenny Liu > Sent: Sunday, March 31, 2019 6:10 PM > To: r-help@r-project.org > Subject:

Re: [R] Monte Carlo simulation for ratio and its CI

2019-03-26 Thread David L Carlson
as mcrat["v1", ] and 100 values of ratio2 are stored as mcrat["v2", ]. Now you can generate your summary statistics. David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Messag

Re: [R] How to create gridded data

2019-03-25 Thread David L Carlson
nt(DF2miss, na.print=NA) # Print table with for missing values: longitude latitude 110.5 111 111.5 112 45.5 3.2 5.0 2.0 46 6.17.8 5.5 ------------ David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 From: lily

Re: [R] Printing vectrix

2019-03-25 Thread David L Carlson
3 14 15 16 17 18 1920 [3,] 21 22 23 24 25 David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of K. Elo Sent: Monday, March 25, 2019 2:26 AM To: r-help@r-p

Re: [R] counting unique values (summary stats)

2019-03-22 Thread David L Carlson
360 # Rape 21.232 9.366 7.3 46.0 20.10 50 480 ---- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of David Winsemius Sent: Th

Re: [R] [R-sig-eco] AIC in Biomod 2

2019-03-10 Thread David L Carlson
I searched the manual for package biomed2 and found 6 references to "AIC". Perhaps that is your answer. David L. Carlson Department of Anthropology Texas A University -Original Message- From: R-sig-ecology [mailto:r-sig-ecology-boun...@r-project.org] On Behalf Of Lara

Re: [R] R Coding Help

2019-03-07 Thread David L Carlson
hat was not fatal because you were able to use library(vegan) to load it (i.e. you had already installed vegan). Based on these hints, the following code MIGHT work: phdDist <- as.dist(phdtext) phdMDS <- metaMDS(phdDist) -------- David L Carlson Departmen

Re: [R] Benjamini-Hochberg (BH) Q value (false discovery rate)

2019-03-06 Thread David L Carlson
the smallest by 8. Then cummin() takes the cumulative minimum so that the multiplication does not change the decreasing order of the values. In this example the last value is the same as the second to last instead of 8 times the original value (.0032). The pmin() function ensures that the adjusted value never ex

Re: [R] inverse of which()

2019-02-27 Thread David L Carlson
I'm not sure I completely understand your question. Would using grepl() instead of grep() let you do what you want? David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help

Re: [R] Problem with combining 2 data frame

2019-02-16 Thread David L Carlson
gsAsFactors =FALSE) df1$x2[match(df2$x1, df1$x1)] <- df2$x2 - David L. Carlson Department of Anthropology Texas A University -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Eric Berger Sent: Friday, February 15, 2019 11:43 PM To: javad bayat

Re: [R] Help with Cluster Tutorial Error

2019-02-15 Thread David L Carlson
I'm not getting any error on that line in Windows 10. I did not try running anything past that line. Have you tried restarting R and clearing your environment? David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352

Re: [R] Select

2019-02-11 Thread David L Carlson
10 9 5 13 3 -------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of Val Sent: Monday, February 11, 2019 4:36 PM To: r-help@R-project.org (r-help@r-project.org) Subject: [R] Sel

Re: [R] Nearest neighbors of a of 3D points

2019-02-06 Thread David L Carlson
to be specific. Nearest neighbor distances are also provided in several other packages, e.g. packages FNN, distances, and RANN. David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help

Re: [R] calculating quintile values of numeric data?

2019-01-23 Thread David L Carlson
1 2 3 4 5 20 20 20 20 20 > z <- findInterval(x, bks, all.inside=TRUE) > table(z) z 1 2 3 4 5 20 20 20 20 20 -------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-

Re: [R] Opening R

2019-01-20 Thread David L Carlson
be in Start menu, not on the desktop. --- David L. Carlson Department of Anthropology Texas A University -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Eric Berger Sent: Sunday, January 20, 2019 3:00 AM To: Sydney

Re: [R] data transformation

2019-01-20 Thread David L Carlson
of correlation coefficients? If distance has different meanings between -1 and 0 and 0 and +1, getting interpretable results from cluster analysis will be difficult, but it is not clear what you mean by that. - David L. Carlson Department

Re: [R] Banner using R

2019-01-15 Thread David L Carlson
gt; addmargins(Data.tbl, 2) ind values v1 v2 v3 Sum A 2 3 5 10 B 3 2 0 5 David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of Luca Meyer

Re: [R] Warning message: NAs introduced by coercion

2019-01-09 Thread David L Carlson
Now you have pushed a numeric matrix to the function with a column of missing values. No wonder you do not get any results. David C -Original Message- From: N Meriam [mailto:meriam@gmail.com] Sent: Tuesday, January 8, 2019 3:44 PM To: David L Carlson Cc: Michael Dewey ; r-help@r

Re: [R] Warning message: NAs introduced by coercion

2019-01-08 Thread David L Carlson
becomes NAs which is probably not what you want. The error message is because you passed genod (a data frame) to the snpgdsCreateGeno() function not genod2 (the matrix you created from genod). -------- David L. Carlson Department of Anthropology Texas A University

Re: [R] Merge the data from multiple text files

2019-01-07 Thread David L Carlson
. (A and B) and not(B). David C -Original Message- From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] Sent: Monday, January 7, 2019 11:04 AM To: Priya Arasu ; Priya Arasu via R-help ; David L Carlson ; David Winsemius ; r-help@r-project.org Subject: Re: [R] Merge the data from multiple text

Re: [R] Merge the data from multiple text files

2019-01-05 Thread David L Carlson
not(D)" $C [1] "D" > TF.and <- lapply(TF.list, paste, collapse=" and ") > TF.final <- lapply(names(TF.and), function(x) paste(x, "=", TF.and[[x]])) > TF.final <- do.call(rbind, TF.final) > TF.final [,1] [1,]

Re: [R] Glitch in Kruskal-Wallis test?

2018-12-22 Thread David L Carlson
and the degrees of freedom. You have run kruskal.test separately on each sample. The kruskal.test is designed for comparing two or more samples. David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original

Re: [R] rewrite code from Deducer to run on R-Studio

2018-12-19 Thread David L Carlson
() in package RcmdrMisc, Desc() in DescTools, describe() in Hmisc, stat.desc() in pastecs, or describe() in psych. Try several until you find one that formats the results the way you want. --- David L. Carlson Department of Anthropology Texas A University -Original

Re: [R] Trying to fix code that will find highest 5 column names and their associated values for each row in a data frame in R

2018-12-17 Thread David L Carlson
5 8 V1:9 V6:9 V4:8 V8:8 V7:7 9 V4:8 V10:6 V9:5 V3:4 V5:3 Which seems to be what you wanted. --------- David L. Carlson Department of Anthropology Texas A University -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf O

Re: [R] Dealing with special characters at end of line in file

2018-12-15 Thread David L Carlson
Each of the backslashes need to be escaped with a backslash: > ctxt <- "In Alvarez Cabral street by no. 105.\\000" > sub("000", "", ctxt) [1] "In Alvarez Cabral street by no. 105." -----------

Re: [R] [External] RE: help

2018-12-13 Thread David L Carlson
(wqn.last5yrs$DATE_COLLECTED) David C -Original Message- From: Miller, Shawn Sent: Thursday, December 13, 2018 1:42 PM To: David L Carlson Cc: R-help@r-project.org Subject: RE: [External] RE: help Yes I confirmed all the dates I need are in the test.xlsx table. The final.2.xlsx table

Re: [R] [External] RE: help

2018-12-13 Thread David L Carlson
.xlsx". Have you confirmed that all of the dates you need are present in that file? -------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: Miller, Shawn Sent: Thursday, December

Re: [R] help

2018-12-13 Thread David L Carlson
difference between R and R-Studio. -------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of Miller, Shawn Sent: Thursday, December 13, 2018 11:29 AM To: R-help@r-project.o

Re: [R] Help with K-Means output

2018-12-08 Thread David L Carlson
[[1]] ---- David L. Carlson Department of Anthropology Texas A University -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Bert Gunter Sent: Saturday, December 8, 2018 9:46 AM To: bill.pol...@zelis.com Cc: R-help Subject: Re: [R] Help with K-Means out

Re: [R] Does the correlations of component makes the correlation of one phenomena ?

2018-12-02 Thread David L Carlson
nt of the empirical values, I can't say if this approach is wise. ----------- David L. Carlson Department of Anthropology Texas A University -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Fatma Ell Sent: Sunday, December 2, 2018 4:50 AM To:

Re: [R] help with line graphs - rather lengthy to explain need

2018-11-30 Thread David L Carlson
into the script window in R Commander if you need to do something that is not available on the menus. If you want to use R, you are really going to have to invest a bit of time understanding how the program works. There are many free resources to help you learn more about R. David L. Carlson Department

Re: [R] help with line graphs - rather lengthy to explain need

2018-11-29 Thread David L Carlson
put you on the right track, give us a .csv file of a subset of the data (e.g. 10 columns and 20 rows) to play with. You can just copy/paste it into your message. If you save it as an attachment, rename the extension to .txt so the list processor does not strip it out. David L. Carlson Department

Re: [R] CenReg download

2018-11-26 Thread David L Carlson
just learning about R. You might find this list useful: https://goo.gl/huajyf -------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of Olofinsao Tosin Sent: Monda

Re: [R] How to create gridded data

2018-11-15 Thread David L Carlson
F3) <- c("latitude", "longitude", "Precip") > DF3$latitude <- as.numeric(as.character(DF3$latitude)) > DF3$longitude <- as.numeric(as.character(DF3$longitude)) David L Carlson Department of Anthropology Texas A

Re: [R] How to create gridded data

2018-11-13 Thread David L Carlson
s(DF2)), ] > DF2 longitude latitude 110.5 111 111.5 112 46 6.1 4.5 7.8 5.5 45.5 3.2 5.0 1.8 2.0 # Convert to a data frame > DF2 <- as.data.frame.matrix(DF2) > DF2 110.5 111 111.5 112 46 6.1 4.5 7.8 5.5 45.5 3.2 5.0 1.8 2.0 ---------

Re: [R] semiparametric manova

2018-11-12 Thread David L Carlson
10 10 > xtabs(~V1+V3, df) # No cells < 2 with V1, V3 V3 V1 9 16 23 200 10 10 10 350 10 10 10 500 10 10 10 > xtabs(~V2+V3, df) # No cells < 2 with V2, V3 V3 V29 16 23 8 10 10 10 16 10 10 10 24 10 10 10 David L. Carlson Department of Anthropology Texas

Re: [R] semiparametric manova

2018-11-12 Thread David L Carlson
of the categories in your predictor variables or increasing your sample size. Are your predictor variables coded as factors? David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R

Re: [R] Problem with the matrix() function.

2018-11-07 Thread David L Carlson
(x, 9) Error in seq.default(x, 9) : 'from' must be of length 1 > rep(1, x) Error in rep(1, x) : invalid 'times' argument -------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On

Re: [R] Plotting error:

2018-11-01 Thread David L Carlson
You should probably contact the packages maintainer about this. maintainer("WaveletComp") # Notice capitalization [1] Angi Roesch -------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Origin

Re: [R] Plot a matrix

2018-11-01 Thread David L Carlson
# 5 283 381 224 114 # 6 266 364 207 97 17 # 7 297 395 238 128 14 31 # 8 358 456 299 189 75 92 61 # 9 308 406 249 139 25 42 11 50 Now we can plot. I've attached a copy: plot(daydiff, mcdf2) You need to read the following manual pages to u

Re: [R] Polygon

2018-10-22 Thread David L Carlson
d.y, 0), col="skyblue") axis(1,at=c(-5,z1,0,z2,5),lab=c(-5,z1,0,z2,5)) abline(v=c(z1,z2)) axis(1, at=c(-5, z1, 0, z2, 5), lab=(c(-5,z1,0,z2,5) + 5)*2, line=2) segments(.5, .1, 3, .2, lwd=2) lbl <- paste0("Area = ", round(pnorm(2) - pnorm(-1), 4)) text(3, .2, lbl, pos=4, offset=.2

Re: [R] Different stack barplots - same color legends

2018-10-22 Thread David L Carlson
adjust the xlim= argument so that the legend does not print on top of the bars. David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of P. Roberto Bakker Sent: Monday,

Re: [R] Polygon

2018-10-22 Thread David L Carlson
dnorm(x,0,1), xlim=c(-5, 5), frame=F) -------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 From: Steven Yen Sent: Sunday, October 21, 2018 9:54 PM To: David L Carlson Subject: Re: [R] Polygon Thank you David.

Re: [R] Polygon

2018-10-21 Thread David L Carlson
() to close the space between the tickmarks and their values. -- David L. Carlson Department of Anthropology Texas A University -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Steven Yen Sent: Sunday, October 21, 2018 1:47 PM To: David

Re: [R] Scientific Notation

2018-10-14 Thread David L Carlson
You probably need to read up on the scipen= argument in ?options. What is displayed at the console is not what is stored: > x <- 1619052826499 > print(x) [1] 1.619053e+12 > dput(x) 1619052826499 > options(scipen=10) > print(x) [1] 1619052826499 --------

Re: [R] heatmap.2, adding a legend at bottom

2018-10-04 Thread David L Carlson
ot;Legend", xpd=TRUE) -------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of Ding, Yuan Chun Sent: Thursday, October 4, 2018 1:19 PM To: r-help@r-project.org Subject: Re: [R] heatmap.2, adding a lege

Re: [R] cut{base}: is it a bug?

2018-09-24 Thread David L Carlson
, breaks= bks, right=FALSE, dig.lab=10L)) > levels(f) <- lvls > levels(f) [1] "[0.6,0.8)" "[0.8,1)" "[1,1.2)" "[1.2,1.4)" "[1.4,1.6)" "[1.6,1.8)" [7] "[1.8,2)" "[2,2.2)" ------

Re: [R] cut{base}: is it a bug?

2018-09-24 Thread David L Carlson
on a point of division between two intervals." -------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: Jeff Newmiller Sent: Monday, September 24, 2018 10:41 AM To: r-help@r-project.org; D

Re: [R] cut{base}: is it a bug?

2018-09-24 Thread David L Carlson
5 [1.99,2.19]6 ------------ David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of Jose Claudio Faria Sent: Monday, September 24, 2018 9:32 AM To: r-help@r-project.org Subject: [R] cut{

Re: [R] tibble question with a mean

2018-09-20 Thread David L Carlson
> xt[, 2:3] %>% colMeans y z 2.500 -0.4401625 > xt[2] %>% colMeans y 2.5 > t(xt[, 2]) %>% mean [1] 2.5 --------- David L. Carlson Department of Anthropology Texas A University -Original Message- From: R-help [mailt

Re: [R] How to vectorize this function

2018-09-20 Thread David L Carlson
instead of the loop. -------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of Lynette Chang Sent: Thursday, September 20, 2018 10:09 AM To: r-help@r-project.org Subject: [R] How to vectorize this func

Re: [R] For loop with multiple iteration indexes

2018-09-11 Thread David L Carlson
002371 -0.37492894 0.46477742 -0.37972866 Change sapply() to lapply() to get list output. -------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of David Disabato Sent

Re: [R] Equal Standard Error bar

2018-09-04 Thread David L Carlson
the plot you included with your message? -------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of Ogbos Okike Sent: Tuesday, September 4, 2018 2:35 PM To: r-help Sub

Re: [R] Display time of PDF plots

2018-09-03 Thread David L Carlson
will get halos when you zoom in. You can always preserve a vector version for publication. If you have Adobe Acrobat (not Reader), you can Save As Other | Image | tiff (or png) and set the resolution before exporting. David L. Carlson Department of Anthropology Texas

Re: [R] Transforming data for nice output table

2018-08-21 Thread David L Carlson
Another approach to adding GW_Elevation to the year value, but the table is more compact with just the year. dta <- read.csv("http://doylesdartden.com/R/ExampleData.csv;) Years <- paste("GW_Elevation", dta$Year) xtabs(GW_Elevation~Location+Years, dta) David

Re: [R] R Codes for Introduction to Data Mining

2018-08-21 Thread David L Carlson
There are some materials at https://www-users.cs.umn.edu/~kumar001/dmbook/index.php Michael Hahsler has code examples at https://mhahsler.github.io/Introduction_to_Data_Mining_R_Examples/ https://github.com/mhahsler/Introduction_to_Data_Mining_R_Examples David L. Carlson Department

Re: [R] Request for R Assistance: Downloading Data

2018-08-19 Thread David L Carlson
The load() function is only used for binary files that R creates with the save() function. You are trying to assign the data to an object (variable) called LGG Drug. R does not allow spaces in variable names. You could try LGGDrug, LGG_Drug, or LGG.Drug. Same issue with GBM Drug. David L

Re: [R] [FORGED] Re: bar plot add space to group data

2018-08-19 Thread David L Carlson
() function would be easier to read, but it works the same your way. Now we just need legend=TRUE and we can position the legend in the top right with the args.legend= argument. The legend overlaps the bars a bit so I increased the y-axis to 35. A .png file is attached. David L. Carlson Depar

Re: [R] bar plot add space to group data

2018-08-17 Thread David L Carlson
of the space= argument useful. David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of c...@disroot.org Sent: Friday, August 17, 2018 6:56 AM To: r-help@r-project.org

Re: [R] Deleting a specific value in a column of a data frame

2018-06-23 Thread David L Carlson
A B # 1 0.9148060 0.4577418 # 2 0.9370754 0.7191123 # 4 0.8304476 0.2554288 # 5 0.6417455 0.4622928 # 8 0.134 0.1174874 # 9 0.6569923 0.4749971 # 10 0.7050648 0.5603327 Notice that whichever one we use, the row numbers match the original data frame. David L. Carlson

Re: [R] KNN

2018-06-21 Thread David L Carlson
with the larger magnitudes will determine the groups more than the variables with the smaller magnitudes. David L. Carlson Department of Anthropology Texas A University -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Jeff Reichman Sent: Thursday, June 21, 2018 11

Re: [R] Kendall tau a, b, or c

2018-06-15 Thread David L Carlson
Also look at the DescTools package for functions KendallTauA, KendallTauB, StuartTauC(). David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help On Behalf Of Jeff Reichman

Re: [R] Printing left-justified character strings

2018-06-05 Thread David L Carlson
I think the OP does not realize that head() and tail() do not print anything. They extract the first or last values/rows and if they are not assigned to an object, they automatically go to print(). Redefining print.data.frame would also fix that problem. David L. Carlson Department

Re: [R] Regroup and create new dataframe

2018-06-01 Thread David L Carlson
No html!, Copy the list using Reply-All. The data frame group_PrivateLabel does not contain variables called Product_Name or Region. David C From: nguy2952 University of Minnesota Sent: Friday, June 1, 2018 2:13 PM To: David L Carlson Subject: Re: [R] Regroup and create new dataframe Hi

Re: [R] Regroup and create new dataframe

2018-06-01 Thread David L Carlson
sent reasonably close? What should it look like after it is transformed? David C From: nguy2952 University of Minnesota Sent: Friday, June 1, 2018 1:57 PM To: David L Carlson Subject: Re: [R] Regroup and create new dataframe Hi, This is not an assignment for school. This is a project at WORK

Re: [R] Regroup and create new dataframe

2018-06-01 Thread David L Carlson
, "West")), .Names = c("Year", "Product", "Sales", "Region"), row.names = c(NA, -15L), class = "data.frame") It is not clear what you want in your new data frame. This one has 5 years of data for each tape brand and you seem to want one ro

Re: [R] Forecasting tutorial "Basic Forecasting"

2018-05-15 Thread David L Carlson
The tutorial is from the mathewanalytics.com website, but this post is missing. Have you contacted the author at mathewanalyt...@gmail.com? David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original

Re: [R] BoxPlot Adding Mean and Median Values

2018-05-09 Thread David L Carlson
all of the R code you are using. David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help <r-help-boun...@r-project.org> On Behalf Of Jayaganesh Anbuganapathy Sent: Tuesday,

Re: [R] Converting a list to a data frame

2018-05-02 Thread David L Carlson
Typo: dat[[z]] should be x[[z]]: x2 <- do.call(rbind, lapply(names(x), function(z) data.frame(type=z, x[[z]]))) x2 type x y 1A 1 3 2A 2 4 3B 5 7 4B 6 8 David C -Original Message- From: R-help <r-help-boun...@r-project.org> On Behalf Of David L Car

Re: [R] using apply

2018-05-02 Thread David L Carlson
.frame") # Generate the row indices that we need so we can vectorize the logical operation: idxa <- rep(1:4, each=2) idxb <- rep(1:2, 4) ab <- (a[idxa, ] & b[idxb, ]) == b[idxb, ] c <- cbind(idxa, idxb)[apply(ab, 1, all), ] c # idxa idxb # [1,]21 # [2,]22 #

Re: [R] Converting a list to a data frame

2018-05-02 Thread David L Carlson
Or add the type column first and then rbind: x <- list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8)) x2 <- do.call(rbind, lapply(names(x), function(z) data.frame(type=z, dat[[z]]))) ---- David L Carlson Department of Anthropology

Re: [R] How to replace numeric value in the column contains Text (Factor)?

2018-04-18 Thread David L Carlson
iables: # $ Sites : Factor w/ 5 levels "Site1","Site2",..: 1 2 3 4 5 # $ temp : num 14 15 12 12.5 17 # $ precip: Factor w/ 4 levels "20","high","low",..: 2 3 4 1 1 David L Carlson Department of Anthropology T

Re: [R] Problem with regression line

2018-04-18 Thread David L Carlson
dPressure~Age (which makes more sense than predicting age from blood pressure) or change the plot command to plot(BloodPressure, Age, ...) and change the xlab to ylab and ylab to xlab). ---- David L Carlson Department of Anthropology Texas A University College Stat

Re: [R] Reasons to Use R in a Public Administrations and Ideas for a Short Training

2018-04-18 Thread David L Carlson
to debug. David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help <r-help-boun...@r-project.org> On Behalf Of Lorenzo Isella Sent: Wednesday, April 18, 2018 8:47 AM To: r-

Re: [R] nMDS with R: missing values

2018-04-18 Thread David L Carlson
Sent: Wednesday, April 18, 2018 3:42 AM To: David L Carlson <dcarl...@tamu.edu> Subject: RE: nMDS with R: missing values Dear Prof Carlson, Thank you for your reply. I'm using 'vegan' with 'vegdist' and 'bray'. I have a selection of datasets that cover different time periods (converted to z

Re: [R] nMDS with R: missing values

2018-04-17 Thread David L Carlson
be useful to know if the missing values are concentrated in particular rows or columns so that eliminating a few rows and columns could substantially reduce the percentage of missing values. David L Carlson Department of Anthropology Texas A University

Re: [R] convert numeric variables to factor

2018-04-09 Thread David L Carlson
Try the help files: ?factor David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help <r-help-boun...@r-project.org> On Behalf Of Saif Tauheed Sent: Monday, April 9, 2018 11

Re: [R] how to add a child to a child in XML

2018-03-22 Thread David L Carlson
pace) == 0 && !missing(namespace), fixNamespaces = c(dummy = TRUE, default = TRUE)) ------------ David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help <r-help-boun...@r-project.o

Re: [R] Vary an equation using values from a sequence

2018-03-21 Thread David L Carlson
3456789 1011 [3,]3456789 10 1112 [4,]456789 10 11 1213 [5,]56789 10 11 12 1314 ------------ David L Carlson Department of Anthropol

Re: [R] couple of how-to-do it in R questions regarding corelations and mean and SD of likert items

2018-03-06 Thread David L Carlson
ble: Petal.Width meansd n setosa 0.246 0.105 50 versicolor 1.326 0.198 50 virginica 2.026 0.275 50 ------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-h

Re: [R] stem - strange leaves

2018-02-16 Thread David L Carlson
In addition to stem() in the graphics package, there are other implementations of stem-and-leaf plots that add additional features such as stem.leaf() in package aplpack which will includes a function to produce back to back stem and leaf plots. David L

Re: [R] substr gives empty output

2018-01-22 Thread David L Carlson
There is also a way to do this without a loop: > strsplit(x, "") [[1]] [1] "t" "e" "s" "t" "i" "n" "g" # Or if you just want the vector > strsplit(x, "")[[1]] [1] "t" "e" "s

Re: [R] Confidence intervals around the MIC (Maximal information coefficient)

2017-12-10 Thread David L Carlson
s a symmetric matrix. Just like cor() David L. Carlson Department of Anthropology Texas A University -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of varin sacha via R-help Sent: Sunday, December 10, 2017 11:07 AM To: Rui Barradas <ruipbarra...@

Re: [R] ks.test() with 2 samples vs. 1 sample an distr. function

2017-11-15 Thread David L Carlson
, but ks.test() just sees that you have provided two samples, not one sample and values along a cumulative distribution. David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help

Re: [R] Help Converting Calendars

2017-11-08 Thread David L Carlson
] - dates[1]) Time difference of 2 days # But > with(myData, p_dates[3] - p_dates[1]) Error in p_dates[3] - p_dates[1] : non-numeric argument to binary operator - David L. Carlson Department of Anthropology Texas A University -Original Message- From: R-help [mailto

Re: [R] Function to save results

2017-11-01 Thread David L Carlson
handled by 'cat' Please let me know, if I have used the function in right way?. Thank you Priya On Wednesday, 1 November 2017 9:32 PM, David L Carlson <dcarl...@tamu.edu> wrote: Let's try a simple example. > # Create a script file of commands > # Note we must print the resu

Re: [R] Function to save results

2017-11-01 Thread David L Carlson
7403447 1.79825459 The decimal point is at the | -2 | 5 -2 | 4 -1 | -1 | 432000 -0 | 87755 -0 | 442110 0 | 001244 0 | 556789 1 | 113 1 | 5788 > # Success Depending on your operating system, you may also be able to save the output with File | Save to

Re: [R] Count non-zero values in excluding NA Values

2017-10-30 Thread David L Carlson
32 ---- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Engin YILMAZ Sent: Sunday, October 29, 2017 1:49 PM To: Ek Esawi <esaw...@gmail.c

Re: [R] as.data.frame doesn't set col.names

2017-10-24 Thread David L Carlson
created when you used one of the read.*() functions. Use str(samples) to see what you are dealing with. David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help [mailto:r-help

Re: [R] looping using 'diverse' package measures

2017-10-19 Thread David L Carlson
4 1 20014 1 20050 0 4391076 19990 0 20000 0 20010 0 20059 1 You should read these manual pages: ?dput ?aggregate ?xtabs ?ftable David L Carlson Depar

Re: [R] creating tables with replacement

2017-10-18 Thread David L Carlson
les by hand > write.csv(dat1[Samples$A[ , 1:10], ], row.names=FALSE, file="Test.csv") -------- David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-

Re: [R] changing "," to "." in data.frame

2017-10-11 Thread David L Carlson
Minor modification: fff <- function(x) as.numeric(chartr(",", ".", x)) BX <- sapply(AX, fff) Or this keeps the original data frame: AX[, 1:2] <- sapply(AX[, 1:2], fff) -------- David L Carlson Department of Anthropology Texas A U

Re: [R] Boxplot, formula interface, and labels.

2017-09-28 Thread David L Carlson
Just change the separator: data(Titanic) Titanic.df <- as.data.frame(Titanic) boxplot(Freq~Class*Sex, Titanic.df, cex.axis=.6, sep="\n") See attached .png. ---- David L Carlson Department of Anthropology Texas A University College Station,

Re: [R] Random Variable Generation

2017-09-25 Thread David L Carlson
dom number: > rnd() [1] 4.036111 > rnd() [1] 3.88048 > rnd() [1] 3.984268 > rnd() [1] 3.808441 > rnd() [1] 4.219925 ------------ David L Carlson Department of Anthropology Texas A University College Station, TX 77843-4352 -Original Message- From

  1   2   3   4   5   6   7   8   9   10   >