[R] Would you please help me to create a table in R?

2015-12-17 Thread Marna Wagley
Hi R users, I am struggling to create a table in R. I did in Excel but I have a lots of data and thought it might be easy in R but I am new in R. How to get "output table" for this example data? This is an example. # raw.data<-structure(list(Time1 = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,

[R] How do we do correlation for big matrices?

2015-12-26 Thread Marna Wagley
Hi R users, I have a very big two matrices of 12 columns and over 0.5 million columns (50,4710) and trying to get correlation value between two tables but I could not compute it because of big files. Would you give me any suggestion on how I can do the correlations for the big files? I used the

Re: [R] Would you please help me to create a table in R?

2015-12-18 Thread Marna Wagley
.@gmail.com> wrote: > Hi Marna, > A bit hard to understand. If raw.data is a record of 11 individuals > released at site A at Time 1 and recaptured at either A or B or neither at > Time2 or Time3, it doesn't seem to bear any consistent relationship to the > numeric coding in table.f

Re: [R] to change the size of the line in the plot created in ggplot2

2015-12-24 Thread Marna Wagley
Hi Giorgio, Thank you very much for the code and the link. I read it and also used but this code changed the line into "dashed" for all variables. As I mentioned earlier, I wanted to change for only one variable among 7 variables (for only one variable). Thanks MW On Thu, Dec 24, 2015 at 4:10

[R] to change the size of the line in the plot created in ggplot2

2015-12-24 Thread Marna Wagley
Hi R user, I was trying to make a figure for each of four sites. Each site has 7 classes, among the 7 classes, one is average. I am wondering how I can change the color and size of the line that was average value. I want to highlight average value. Similarly, I have been using smooth function

[R] replace text in table R?

2016-03-08 Thread Marna Wagley
Hi R Users, I have been struggling to replace texts in a table by new text. but it seems crazy as of I am doing it manually in R. I have very big files and some of the text has to be replaced by another class based on another file if the name corresponds. I was able to perform following example

[R] calculate sampel size?

2016-04-14 Thread Marna Wagley
Hi R user, Can we calculate sample size when only mean and SE are given? Let say one example, I have mean with SE is 0.54+-0.0517 (mean+-SE). Is there any way to find the samples (sample size n) in that condition in R? i think this question is not related to R, I hope you won't mind. Thanks

[R] How can I add text in plot and x axis of figures created in ggplot2?

2016-08-31 Thread Marna Wagley
Hi R users, I have created four figures using ggplot2, but I am having trouble to add "r2=XXX, p=XX" value on the upper left in each figure and also unit of X axis of each figure are different. I was also trying to write following : 1. "rainfall (mm/year") on X axix for fig A. 2. "temp (degree

Re: [R] can we visualize water flows with 3d in R?

2016-10-14 Thread Marna Wagley
here? >> >> Duncan Murdoch >> >> >> Tom >> >> >> On Wed, Oct 12, 2016 at 6:12 PM, David Winsemius >> <dwinsem...@comcast.net <mailto:dwinsem...@comcast.net> >> <mailto:dwinsem...@comcast.net <mail

[R] can we visualize water flows with 3d in R?

2016-10-12 Thread Marna Wagley
Hi R Users, Is it possible to visualize river flow in 3D (latitude, longitude with respect to depth)? The example of my data looks like. Any suggestions? > dat1 long lat depth flow 1 1015.9 857 1.00 1.50 2 1015.9 857 1.25 1.23 3 1015.9 857 0.50 2.00 4 1015.9 858 0.10 1.95 5 1015.9 858

[R] how to show a plot without overlaying the text on top of the another text?

2016-12-13 Thread Marna Wagley
Hi R user, I have created using metaNMDS (Nonmetirc Multidimensional Scaling, MDS) to show species composition but some of the species are concentrated at some of the sites so that the name of the species are overlaid and it was almost impossible to read the species name in the figure. I was

[R] how to randomly select the samples with different probabilities for different classes?

2016-12-07 Thread Marna Wagley
Hi R user, I have samples with covariates for different classes, I wanted to choose the samples of different groups with different probabilities. For example, I have a 22 samples size with 3 classes, groupA has 8 samples groupB has 8 samples groupC has 6 samples I want to select a total 14

[R] Any help on R code interpretation?

2016-12-22 Thread Marna Wagley
HI R user, I was looking a r code and saw "%*%t", what does it("%*%t") mean?. The example is given below. For example: here is the code where "%*%t" has been used. when I run the formula but did not run in my data. prediction=plogis(as.matrix(mod7)%*%t(with(subset(data,site!='AB'),cbind(1,

[R] creating tables with replacement

2017-10-18 Thread Marna Wagley
Hi R User, I am new in R and trying to create tables with selecting rows randomly (but with replacement) for each group but each group should have same number as original. Is it possible to create it using the following example data set? Your help is highly appreciated.

Re: [R] creating tables with replacement

2017-10-18 Thread Marna Wagley
ty > College Station, TX 77843-4352 > > > -----Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of PIKAL Petr > Sent: Wednesday, October 18, 2017 3:38 AM > To: Marna Wagley <marna.wag...@gmail.com>; r-help mailing list < > r-

[R] How to create separate legend for each plot in the function of facet_wrap in ggplot2?

2017-11-10 Thread Marna Wagley
Hi R users, I need to create more than 20 figures (one for each group) in one page. I have a common legend for 20 figures using the facet_wrap. However the range of the values among the groups are very wide. For example one group has the value of 0 to 3, but the values of some of the groups has

[R] create a loop

2017-10-20 Thread Marna Wagley
Hi R Users, I do have very big data sets and wanted to run some of the analyses many times with randomization (1000 times). I have done the analysis using an example data but it need to be done with randomized data (1000 times). I am doing manually for 1 times but taking so much time, I wonder

Re: [R] how can I convert a long to wide matrix?

2018-05-01 Thread Marna Wagley
9/8/16 9/9/16 9/15/17 A B 2 id_YB1 9/7/16 9/15/16 A B Thanks On Tue, May 1, 2018 at 3:32 PM, Jim Lemon <drjimle...@gmail.com> wrote: > Hi Marna, > Try this: > > library(prettyR) > stretch_df(dat,idvar="ID",to.stre

Re: [R] how can I convert a long to wide matrix?

2018-05-01 Thread Marna Wagley
orrect number > of observations. I think you may be mixing up case ID with location of > observation. > > Jim > > > On Wed, May 2, 2018 at 8:48 AM, Marna Wagley <marna.wag...@gmail.com> > wrote: > > Hi Jim, > > Thank you very much for your suggestio

[R] how can I convert a long to wide matrix?

2018-05-01 Thread Marna Wagley
Hi R user, I was trying to convert a long matrix to wide? I have an example and would like to get a table (FinalData1): FinalData1 B1B2 id_X "A" "B" id_Y "A" "B" but I got the following table using the following code. FinalData1 B1 B2 id_X "A" "A" id_Y "A" "B"

Re: [R] loop for comparing two or more groups using bootstrapping

2018-09-11 Thread Marna Wagley
Thank you Jim, it worked. I am very grateful for your help. Thanks KG On Tue, Sep 11, 2018 at 3:51 PM Jim Lemon wrote: > Hi Kristi, > My fault, I only worked out how to assign the values to the names and pick > out the columns of daT for the calculations. I think this does what you > want, but

[R] repeating functions for different folders?

2018-04-12 Thread Marna Wagley
Hi R users, I need to run a analysis using a data for each folder. I do have several folders. Each folder contains several files but these files name are similar to the files that is saved into another folders. I need to repeat the analysis for every folder and would like to save the output in

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

2018-04-18 Thread Marna Wagley
Hi R user, Would you mind to help me on how I can change a value in a specific column and row in a big table? but the column of the table is a factor (not numeric). Here is an example. I want to change dat[4:5,3]<-"20" but it generated NA> do you have any suggestions for me?

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

2018-04-18 Thread Marna Wagley
--- > 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 Marna Wagley > Sent: Wednesday, April 18, 2018 12:56 PM > T

[R] Monte Carlo simulation for ratio and its CI

2019-03-25 Thread Marna Wagley
Hi R User, I was trying to calculate ratios with confidence interval using Monte Carlo simulation but I could not figure it out. Here is the example of my data (see below), I want to calculate ratios (dat$v1/dat$v3 & dat$v2/dat$v3) and its confidence intervals using a 100 randomly selected data

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

2019-03-26 Thread Marna Wagley
ow a "confidence interval" should be calculated, but > that is another off topic discussion for which stats.stackexchange.com is > a more appropriate venue. > > Cheers, > Bert > > Bert Gunter > > "The trouble with having an open mind is that people keep coming al

[R] create a table for time difference (from t3 to t1, so on..)

2019-05-03 Thread Marna Wagley
Hi R User. I have a date set in which I wanted to find the duration (period) between released time and detection time for each individual. Is there any simplest way to create a matrix? I appreciate your help. Thanks, MW -- Here is the example data, dAT<-structure(list(Id =

[R] How to create Pivot table in r?

2019-07-05 Thread Marna Wagley
Hi R users, I was trying to create a pivot table (cross tabulated) by Site1date (rows) and Site2 date (columns), and spent substantial time but no luck to create it. Is there any possibility to create it? I would be very grateful to your help. "daT1" is row data, in which three columns

Re: [R] How to create Pivot table in r?

2019-07-05 Thread Marna Wagley
= c(NA, -18L )) daT1$site1 <- as.Date(daT1$site1, format = "%d-%b-%Y") daT1$site2 <- as.Date(daT1$site2, format = "%d-%b-%Y") AA<-xtabs(~ site2 + site1, daT1) AA Once again, I am very grateful to you. Thanks On Fri, Jul 5, 2019 at 1:57 AM wrote: > Hello, &

Re: [R] How to create Pivot table in r?

2019-07-05 Thread Marna Wagley
ot;9-Mar-2015"), class = > "factor")), .Names = c("ID", > "site1", "site2"), class = "data.frame", row.names = c(NA, -18L > )) > > daT1 > sapply(daT1, class) ## factors interfere with what you want. > > ## make ID "char

Re: [R] creating a line plot for time series data for several years

2019-09-05 Thread Marna Wagley
= year)) + >theme_bw() > > Ab + facet_grid(year ~ .) + >theme(axis.text.x = element_text(angle = 90, > hjust = 1, > size = 4)) > > > Hope this helps, > > Rui Barradas > > Às 21:37 de 04

[R] creating a line plot for time series data for several years

2019-09-04 Thread Marna Wagley
Hi R Users, I have been getting a trouble to create a time series plot (line) as I was trying to create a line graph for each year using month and date (in x axis). I would like to put only one x axis (month and date) for three years using the facet_grid, but it has not been creating a lineplot

[R] how to split a column by tab ?

2019-09-09 Thread Marna Wagley
Hi R User, I was trying to split a column by tabs, I tried to split with several ways, but I could not split it. Is there any possibilities? The data example and the code I used daT1<-c("Column number 12345678 9 10 10 10 10 10 10 10", "comes

[R] how to create a pivot table in r?

2020-02-05 Thread Marna Wagley
Hi R users, I was trying to create a pivot table for the following data, in which I wanted to put "id" in rows and "ObsSite" in columns and "Obsdate" is in the cells. I used the following code but it took only one date among the two dates. For example, the animal (Id2) which was observed in the

Re: [R] how to create a pivot table in r?

2020-02-06 Thread Marna Wagley
NULL List,1 > id4 NULL List,1 NULL NULL > id5 NULL NULL List,1 NULL > id6 List,1 NULL NULL NULL > id7 NULL NULL List,1 NULL > > M <- with(daT, tapply(as.character(ObsDate), list(id, ObsSite), list, > simplify=FALSE)) > > M[["id2", "sit

Re: [R] how to create a pivot table in r?

2020-02-14 Thread Marna Wagley
/8/14", "NULL"), class = "factor"), site5 = structure(c(3L, 3L, 3L, 1L, 3L, 2L), .Label = c("6/13/14", "6/25/13", "NULL"), class = "factor"), site7 = structure(c(2L, 1L, 3L, 3L, 3L, 3L), .Label = c("5/17/14&

[R] Secondary y axis in ggplot2: did not respond when change its y-axis value

2021-01-07 Thread Marna Wagley
Hi R users, I was trying to plot a graph with a secondary axis, and used the following code for the data but the secondary line and secondary y -axis value did not match. I would like to show both lines in one graph. Any suggestions? library(ggplot2) library(reshape2) daT<-structure(list(x =

Re: [R] Secondary y axis in ggplot2: did not respond when change its y-axis value

2021-01-08 Thread Marna Wagley
;y2"), > aes(y = value*diff(rng) + rng[1])) + >facet_wrap(~group) + >scale_y_continuous(sec.axis = sec_axis(~ .*0.0001)) > > > Hope this helps, > > Rui Barradas > > Às 01:01 de 08/01/21, Marna Wagley escreveu: > > Hi R users, > >

[R] How to generate SE for the proportion value using a randomization process in R?

2021-01-22 Thread Marna Wagley
Hi All, I was trying to estimate standard error (SE) for the proportion value using some kind of randomization process (bootstrapping or jackknifing) in R, but I could not figure it out. Is there any way to generate SE for the proportion? The example of the data and the code I am using is

Re: [R] How to generate SE for the proportion value using a randomization process in R?

2021-01-22 Thread Marna Wagley
d(b$t) # bootstrapped estimate of the SE of the sample prop. > hist(b$t, freq = FALSE) > > > Hope this helps, > > Rui Barradas > > Às 21:57 de 22/01/21, Marna Wagley escreveu: > > Hi All, > > I was trying to estimate standard error (SE) for the proporti

Re: [R] How to generate SE for the proportion value using a randomization process in R?

2021-01-23 Thread Marna Wagley
Yes Rui, I can see we don't need to divide by square root of sample size. The example is great to understand it. Thank you. Marna On Sat, Jan 23, 2021 at 12:28 AM Rui Barradas wrote: > Hello, > > Inline. > > Às 07:47 de 23/01/21, Marna Wagley escreveu: > > Dear Rui, > &

Re: [R] How to generate SE for the proportion value using a randomization process in R?

2021-01-28 Thread Marna Wagley
l now return a matrix of indices with R > = 1000 rows and 19 columns. > > Hope this helps, > > Rui Barradas > > > Às 19:29 de 28/01/21, Marna Wagley escreveu: > > Hi Rui, > > I am sorry for asking you several questions. > > > > In the given example,

Re: [R] How to generate SE for the proportion value using a randomization process in R?

2021-01-28 Thread Marna Wagley
aT) bootprop <- function(data, index){ d <- data[index, ] sum(d[["BothTimes"]], na.rm = TRUE)/sum(d[["Time1"]], na.rm = TRUE) } R <- 3 set.seed(2020) b <- boot(daT, bootprop, R) b b$t0 # original b$t sd(b$t) # bootstrapped estimate of the SE of the samp

[R] extraction of last observation date from many observations in each row/column

2021-04-02 Thread Marna Wagley
Dear R-Users, I have a dataset containing more than two observation dates in some of the columns and sites but I wanted to extract only the last date of the observation. Is there any easiest way to get that last observation in each column/row? Here is the example data: daT<-structure(list(ID =

[R] Conditional extraction of values in a data.frame in r

2021-04-22 Thread Marna Wagley
Hi R Users, I have been struggling to extract the data based on conditional values in different columns. I have a very big dataset (rows) and a couple of columns. here an example of the dataset is: daT<-structure(list(ID = c("id1", "id2", "id3", "id4", "id5", "id6", "id7"), First_detectiondate =

[R] assigning suitability index value

2021-08-10 Thread Marna Wagley
Hi R Users, I have two tables, one is temperature data (temp) and another table is a suitability index. I wanted to assign the suitability index value in the temperature data (temp) based on Table 2 (or graph, which is a suitability curve), but I could not figure it out. Are there any suggestions

Re: [R] assigning suitability index value

2021-08-11 Thread Marna Wagley
code was usable but messed up... please set your email program to > send plain text email so your formatting does not mess with your code. > > > On August 10, 2021 10:30:57 PM PDT, Marna Wagley > wrote: > >Hi R Users, > >I have two tables, one is temperature data (temp) a

Re: [R] able to estimate in the excel but not in R, any suggestion?

2021-12-22 Thread Marna Wagley
; Thanks > > Jim Holtman > Data Munger Guru > > What is the problem that you are trying to solve? > Tell me what you want to do, not how you want to do it. > > On Wed, Dec 22, 2021 at 10:23 PM Marna Wagley > wrote: > > > > Hi R users, > > I was try

[R] able to estimate in the excel but not in R, any suggestion?

2021-12-22 Thread Marna Wagley
Hi R users, I was trying to estimate some values in r but could not figure out how to write the script in r. Although I was able to estimate it correctly in the excel. For example I have the following data set. daT<-structure(list(sd = c(0.481, 0.682, 0.741, 0.394, 0.2, 0.655, 0.375), mcd =

[R] extracting bootstrap statistics by group with loop

2021-10-31 Thread Marna Wagley
Hi R users, I was trying to extract the bootstrap mean and its SE by group but I have been doing it by separating the group manually. The data set is big so doing it manually is a kind of tedious task. I am wondering whether there is a possibility to do it by creating a loop. I am weak in writing

Re: [R] extracting bootstrap statistics by group with loop

2021-11-01 Thread Marna Wagley
ot_mean_se, > >> statistic = bootprop, R = R) > >> boot_year > >> boot_year_area > >> > >> boot_year <- do.call(rbind, boot_year) > >> > >> d <- dimnames(boot_year_area) > >> boot_year_area <- cbind

[R] How to convert category (or range/group) into continuous ?

2022-01-16 Thread Marna Wagley
Hi R users, I first categorized the continuous data into groups (ranges or category) but now I would like to change the category into a continuous data and plot it. For example I have attached the data in which you can see two columns named "group" and "value". The group column contains a range