Re: [R] Error message

2024-03-22 Thread Val
.OT On Fri, Mar 22, 2024 at 2:36 PM Ivan Krylov wrote: > > В Fri, 22 Mar 2024 14:31:17 -0500 > Val пишет: > > > How do I get the first few bytes? > > What does file.info('X1.RData') say? > > Do you get any output if you run print(readBin('X1.RData', raw(), 128))? &g

Re: [R] Error message

2024-03-22 Thread Val
Yes, X1.RData is large(more than 40M rows) . How do I get the first few bytes? On Fri, Mar 22, 2024 at 2:20 PM Ivan Krylov wrote: > > В Fri, 22 Mar 2024 14:02:09 -0500 > Val пишет: > > > X2.R > > load("X1.RData") > > > > I am getting th

[R] Error message

2024-03-22 Thread Val
Hi all, I am creating an X1.RData file using the R 4.2.2 library. x1.R save(datafilename, file="X1.RData") When I am trying to load this file using another script X2.R load("X1.RData") I am getting this error message: Error in load("X1.RData", : bad restore file magic number (file

Re: [R] Multiply

2023-08-04 Thread Val
= multiplication) On Fri, Aug 4, 2023 at 10:59 AM wrote: > > Val, > > A data.frame is not quite the same thing as a matrix. > > But as long as everything is numeric, you can convert both data.frames to > matrices, perform the computations needed and, if you want, convert it bac

[R] Multiply

2023-08-04 Thread Val
Hi all, I want to multiply two data frames as shown below, dat1 <-read.table(text="ID, x, y, z A, 10, 34, 12 B, 25, 42, 18 C, 14, 20, 8 ",sep=",",header=TRUE,stringsAsFactors=F) dat2 <-read.table(text="ID, weight, weiht2 A, 0.25, 0.35 B, 0.42, 0.52 C, 0.65,

Re: [R] Correlate

2022-08-26 Thread Val
Thank you John for your help and advice. On Fri, Aug 26, 2022 at 11:04 AM John Fox wrote: > > Dear Val, > > On 2022-08-26 10:41 a.m., Val wrote: > > Hi John and Timothy > > > > Thank you for your suggestion and help. Using the sample data, I did > > carry o

Re: [R] Correlate

2022-08-22 Thread Val
ise error rate previously mentioned. > > Large datasets can be very messy. > > > Tim > > -Original Message- > From: Bert Gunter > Sent: Monday, August 22, 2022 12:07 PM > To: Ebert,Timothy Aaron > Cc: Val ; r-help@R-project.org (r-help@r-project.org) > >

[R] Correlate

2022-08-22 Thread Val
Hi all, I have a data set with ~250 variables(columns). I want to calculate the correlation of one variable with the rest of the other variables and also want the p-values for each correlation. Please see the sample data and my attempt. I have got the correlation but unable to get the

Re: [R] Row exclude

2022-01-30 Thread Val
ary since R would not get > confused, but length(unique(c(BadName, BadAge, BadWeight)) indicates how > many lines are being removed. > > David > > On Sat, Jan 29, 2022 at 8:32 PM Val wrote: > >> Thank you David for your help. I just have one question on this. Wh

Re: [R] Row exclude

2022-01-29 Thread Val
Hi all, Thank you so much for the useful help and many options that you gave me. Sorry for the delay response, I was away for a while On Sat, Jan 29, 2022 at 3:35 PM Avi Gross via R-help wrote: > Rui has indeed improved my first attempt in several ways so my comments > are now focused on

Re: [R] Linear

2022-01-26 Thread Val
along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > On Wed, Jan 26, 2022 at 7:37 AM Val wrote: > > > > Hi all, > > > > I am trying to get the lsmeans for one of the factors fitted in t

[R] Linear

2022-01-26 Thread Val
Hi all, I am trying to get the lsmeans for one of the factors fitted in the following model Model1 = lm(Yld ~ A + B + C, data = dat2) M_lsm = as.data.frame(lsmeans(Model1, "C")), My problem is, I am getting this error message. "Error: The rows of your requested reference grid would be 81412,

Re: [R] Date

2021-11-05 Thread Val
r if you make a reproducible example. > > On November 4, 2021 5:30:22 PM PDT, Val wrote: > >Jeff, > > > >The date from y data file looks like as follow in the Linux environment, > >My_date > >2019-09-16 > >2021-02-21 > >2021-02-22 > >2017-10-11 &

Re: [R] Date

2021-11-04 Thread Val
hing R does, but is something > Excel does constantly. > > Compare what your data file looks like using a text editor with what R has > imported. Absolutely do not use a spreadsheet program to do this. > > On November 4, 2021 2:43:25 PM PDT, Val wrote: > >IHi All, l, &

[R] Date

2021-11-04 Thread Val
IHi All, l, I am reading a csv file and one of the columns is named as "mydate" with this form, 2019-09-16. I am reading this file as dat=read.csv("myfile.csv") the structure of the data looks like as follow str(dat) mydate : chr "09/16/2019" "02/21/2021" "02/22/2021" "10/11/2017"

Re: [R] by group

2021-11-01 Thread Val
tp://tidyr.tidyverse.org/> instead. > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Mon, Nov 1

Re: [R] by group

2021-11-01 Thread Val
group_by(Year, Sex) : object 'Year' not found Why I am getting this? On Mon, Nov 1, 2021 at 7:07 PM Avi Gross via R-help wrote: > > Understood Val. So you need to save the output in something like a data.frame > which can then be saved as a CSV file or whatever else makes sense to be re

Re: [R] by group

2021-11-01 Thread Val
Thank you all! I can assure you that this is not HW. This is a sample of my large data set and I want a simple and efficient approach to get the desired output in that particular format. That file will be saved and used as an input file for another external process. val On Mon, Nov

[R] by group

2021-11-01 Thread Val
Hi All, How can I generate mean by group. The sample data looks like as follow, dat<-read.table(text="Year Sex wt 2001 M 15 2001 M 14 2001 M 16 2001 F 12 2001 F 11 2001 F 13 2002 M 14 2002 M 18 2002 M 17 2002 F 11 2002 F 15 2002 F 14 2003 M 18 2003 M 13 2003 M 14 2003 F 15 2003 F 10 2003 F 11

Re: [R] Read

2021-02-22 Thread Val
22 B32 D34 NA >> 4 4 D44 NANA >> 551 D53 NANA >> 660 D62 NANA >> > >> >> 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

Re: [R] Read

2021-02-22 Thread Val
that some column names and column > values are separated by single spaces (e.g., between x1 and x2) and > some by multiple spaces (e.g., between x3 and x4. Did the mail mess > up the spacing or is there some other way to tell where the omitted > values are? > > -Bill > > On

Re: [R] Read

2021-02-22 Thread Val
> > Since the columns in the file are separated by a space character, " ", > add the read.table argument sep=" ". > > -Bill > > On Mon, Feb 22, 2021 at 2:21 PM Val wrote: > > > > Hi all, I am trying to read a messy data but facing difficult

[R] Read

2021-02-22 Thread Val
Hi all, I am trying to read a messy data but facing difficulty. The data has several columns separated by blank space(s). Each column value may have different lengths across the rows. The first row(header) has four columns. However, each row may not have the four column values. For

Re: [R] Undesired result

2021-02-17 Thread Val
Very helpful and thank you so much! On Wed, Feb 17, 2021 at 12:50 PM Duncan Murdoch wrote: > > On 17/02/2021 9:50 a.m., Val wrote: > > HI All, > > > > I am reading a data file which has different date formats. I wanted to > > standardize to one format and u

[R] Undesired result

2021-02-17 Thread Val
HI All, I am reading a data file which has different date formats. I wanted to standardize to one format and used a library anytime but got undesired results as shown below. It gave me year 2093 instead of 1993 library(anytime) DFX<-read.table(text="name ddate A 19-10-02 D 11/19/2006 F

[R] create

2021-01-27 Thread Val
Hi all, I have a sample of data as shown below, dt <-read.table(text="name Item check A DESK NORF B RANGE GARRA C CLOCKPALM D DESK RR E ALARMDESPRF H DESK RF K DESK CORR K WARF CORR G NONE RF ",header=TRUE, fill=T) I want create another

Re: [R] Split

2020-09-23 Thread Val
if($3 ~ find_char) { { split ($3, F, "_") } > { print $1, $2, "1", F[1], > F[2] } > } > else { print $1, $2, "0", $3, &

Re: [R] Split

2020-09-22 Thread Val
gt;> Therefore it's the method cbind.data.frame that is called and the result >> is also a df, though tmp is a "matrix". >> >> >> Hope this helps, >> >> Rui Barradas >> >> >> Às 20:07 de 22/09/20, Rui Barradas escreveu: >> > He

[R] Split

2020-09-22 Thread Val
HI All, I am trying to create new columns based on another column string content. First I want to identify rows that contain a particular string. If it contains, I want to split the string and create two variables. Here is my sample of data. F1<-read.table(text="ID1 ID2 text A1 B1 NONE A1

[R] date

2020-09-21 Thread Val
Hi All, I am trying to sort dates within a group. My sample data is df <-read.table(text="ID date A1 09/17/04 A1 01/27/05 A1 05/07/03 A2 05/21/17 A2 09/12/16 A3 01/25/13 A4 09/27/19",header=TRUE,stringsAsFactors=F) df$date2 = as.Date(strptime(df$date,format="%m/%d/%y")) df$date

[R] sort

2020-05-14 Thread Val
HI All, I have a sample of data frame DF1<-read.table(text="name ddate A 2019-10-28 A 2018-01-25 A 2020-01-12 A 2017-10-20 B 2020-11-20 B 2019-10-20 B 2017-05-20 B 2020-01-20 c 2009-10-01 ",header=TRUE) 1. I want sort by name and ddate on decreasing order and the

Re: [R] Label

2020-04-03 Thread Val
1,prop=0.5,miny=0,offset=0,...) Thank you. On Thu, Apr 2, 2020 at 9:38 PM Jim Lemon wrote: > > Hi Val, > > library(plotrix) > barpos<-barplot(dat$count, names.arg=c("A", "B", "C","D"), > col="blue", > ylim

[R] Label

2020-04-02 Thread Val
Hi all, I have a sample of data set, dat <- read.table(header=TRUE, text='Lab count A 24 B 19 C 30 D 18') barplot(dat$count, names.arg=c("A", "B", "C","D"), col="blue", ylim = c(0,30), ylab = "Count", xlab = "Grade") I want add the number of counts at the top of

Re: [R] Mixed format

2020-01-24 Thread Val
the > > regular commentators here, that I submit > > this a little nervously! > > Thanks! > > Rui Barradas > > > > Many thanks to all who teach me so much here, lovely, if I am correct, to > > contribute for a change! > > > > Chris >

[R] Mixed format

2020-01-20 Thread Val
Hi All, I have a data frame where one column is a mixed date format, a date in the form "%m-%d-%y" and "%m/%d/%Y", also some are not in date format. Is there a way to delete the rows that contain non-dates and standardize the dates in one date format like %m-%d-%Y? Please see my sample data

[R] date

2019-12-17 Thread Val
Hi All, I wanted to to convert character date mm/dd/yy to -mm-dd The sample data and my attempt is shown below gs <-read.table(text="ID date A1 09/27/03 A2 05/27/16 A3 01/25/13 A4 09/27/19",header=TRUE,stringsAsFactors=F) Desired output ID date d1 A1 09/27/03

[R] Conditions

2019-11-26 Thread Val
HI All, I am having a little issue in my ifelse statement, The data frame looks like as follow. dat2 <-read.table(text="ID d1 d2 d3 A 0 25 35 B 12 22 0 C 0 0 31 E 10 20 30 F 0 0 0",header=TRUE,stringsAsFactors=F) I want to create d4 and set the value based on the following conditions. If

Re: [R] File conca.

2019-11-05 Thread Val
t; Help with such operations is rather tricky as only you know exact structrure > of your folders. > > see some hints in line > > > -Original Message- > > From: R-help On Behalf Of Val > > Sent: Tuesday, November 5, 2019 4:33 AM > > To: r-help@R-project.o

[R] File conca.

2019-11-04 Thread Val
Hi All, I have data files in several folders and want combine all these files in one file. In each folder there are several files and these files have the same structure but different names. First, in each folder I want to concatenate(rbind) all files in to one file. While I am reading

[R] If statement

2019-09-12 Thread Val
Hi all, I am trying to use the if else statement and create two new columns based on the existing two columns. Below please find my sample data, dat1 <-read.table(text="ID a b c d A private couple 25 35 B private single 24 38 C none single28 32 E none none 20 36

Re: [R] new_index

2019-09-07 Thread Val
Thank you Jeff and all. I wish to go back to my student life. ID is not necessary in dat2, sorry for that. On Sat, Sep 7, 2019 at 5:10 PM Jeff Newmiller wrote: > > Val has been posting to this list for almost a decade [1] so seems unlikely > to be a student... but in all this tim

Re: [R] new_index

2019-09-07 Thread Val
Hi all Correction for my previous posting. dat2 should be read as dat2 <-read.table(text="ID, weight A, 0.25 B, 0.42 C, 0.65 ",sep=",",header=TRUE,stringsAsFactors=F) On Sat, Sep 7, 2019 at 1:46 PM Val wrote: > > Hi All, > > I have two data frames with

[R] new_index

2019-09-07 Thread Val
Hi All, I have two data frames with thousand rows and several columns. My samples of the data frames are shown below dat1 <-read.table(text="ID, x, y, z ID , x, y, z A, 10, 34, 12 B, 25, 42, 18 C, 14, 20, 8 ",sep=",",header=TRUE,stringsAsFactors=F) dat2 <-read.table(text="ID, x, y, z

Re: [R] read

2019-08-09 Thread Val
eley Breathed in his "Bloom County" comic strip ) > > > On Thu, Aug 8, 2019 at 7:11 PM Jeff Newmiller > wrote: >> >> Val 1 >> Bert 0 >> >> On August 8, 2019 5:22:13 PM PDT, Bert Gunter wrote: >> >read.table() does not have a "text&quo

Re: [R] read

2019-08-08 Thread Val
7:24 PM Anaanthan Pillai wrote: > > data <- read.table(header=TRUE, text=' > name prof > A 4.5 > B 3.2 > C 5.5 > ') > > On 9 Aug 2019, at 8:11 AM, Val wrote: > > > > Hi all, > > > > I am trying to red data where single and double quot

[R] read

2019-08-08 Thread Val
Hi all, I am trying to red data where single and double quotes are embedded in some of the fields and prevented to read the data. As an example please see below. vld<-read.table(text="name prof A '4.5 B "3.2 C 5.5 ",header=TRUE) Error in read.table(text = "name prof \n

Re: [R] create

2019-04-13 Thread Val
at 10:42 PM Jeff Newmiller wrote: > > Looks to me like your initial request contradicts your clarification. Can you > explain this discrepancy? > > On April 13, 2019 8:29:59 PM PDT, Val wrote: > >Hi Bert and Jim, > >Thank you for the suggestion. > >How

Re: [R] create

2019-04-13 Thread Val
Hi Bert and Jim, Thank you for the suggestion. However, those missing values should not be replaced by 0's. I want exclude those missing values from the calculation and create the index using only the non-missing values. On Sat, Apr 13, 2019 at 10:14 PM Jim Lemon wrote: > >

[R] create

2019-04-13 Thread Val
Hi All, I have a data frame with several columns and I want to create another column by using the values of the other columns. My problem is that some the row values for some columns have missing values and I could not get the result I waned . Here is the sample of my data and my

Re: [R] Select

2019-02-11 Thread Val
lt;- sample( nrow( mydat ) ) > mydat[ idx[ seq.int( which( 40 < cumsum( mydat[ idx, > "count" ] ) )[ 1 ] ) ], ] > } > ) > > > On Mon, 11 Feb 2019, Val wrote: > > > Sorry Jeff and David for not being clear! > >

Re: [R] Select

2019-02-11 Thread Val
LLY works? > > On February 11, 2019 3:00:15 PM PST, Val wrote: > >Thank you David. > > > >However, this will not work for me. If the group ID selected then all > >of its observation should be included. > > > >On Mon, Feb 11, 2019 at 4:51 PM David L Carlso

Re: [R] Select

2019-02-11 Thread Val
lson > 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] Select

[R] Select

2019-02-11 Thread Val
Hi all, I have a data frame with tow variables group and its size. mydat<- read.table( text='group count G1 25 G2 15 G3 12 G4 31 G5 10' , header = TRUE, as.is = TRUE ) I want to select group ID randomly (without replacement) until the sum of count reaches 40. So, in the first case, the

Re: [R] character comp

2019-02-09 Thread Val
mydataframe[-1], nchar) %*% c(1, -1)) >> >> >> Hope this helps, >> >> Rui Barradas >> >> Às 18:05 de 09/02/2019, Val escreveu: >> > Hi All, >> > In a given data frame I want to compare character values of two columns. >> > My sample data

Re: [R] character comp

2019-02-09 Thread Val
Hi Erin, Yes, it is always A's. On Sat, Feb 9, 2019 at 12:22 PM Erin Hodgess wrote: > > Will it always be A’s or will there be a mix please? > > On Sat, Feb 9, 2019 at 11:06 AM Val wrote: >> >> Hi All, >> In a given data frame I want to compare character value

[R] character comp

2019-02-09 Thread Val
Hi All, In a given data frame I want to compare character values of two columns. My sample data looks like as follow, mydataframe <- read.table( text='ID var1 var2 R1 AA AAA R2 AAA AAA R3A R4 AA A R5 A AAA', header = TRUE, as.is = TRUE ) For each ID, I want

Re: [R] Read

2018-11-10 Thread Val
read.csv( "dat.csv", header=TRUE, nrow=1) > names( dsh ) <- names( dshh ) > > On Fri, 9 Nov 2018, Val wrote: > > > HI all, > > I am trying to read a csv file, but have a problem in the row names. > > After reading, the name of the first column is now &q

[R] Read

2018-11-09 Thread Val
HI all, I am trying to read a csv file, but have a problem in the row names. After reading, the name of the first column is now "row.names" and all other column names are shifted to the right. The value of the last column become all NAs( as an extra column). My sample data looks like as follow,

[R] select and hold missing

2018-09-12 Thread Val
I have a data dfc <- read.table( text= 'week v1 v2 w1 11 11 w1 .42 w1 31 32 w2 31 52 w2 41 . w3 51 82 w2 11 22 w3 11 12 w4 21 202 w1 31 72 w2 71 52', header = TRUE, as.is = TRUE, na.strings=c("",".","NA") ) I want to create this new variable diff =

Re: [R] exclude

2018-05-17 Thread Val
le with having an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > On Thu, May 17, 2018 at 5:48 PM, Val <valkr...@gmail.com> wrote: > >> Hi All, >>

[R] exclude

2018-05-17 Thread Val
Hi All, I have a sample of data set show as below. tdat <- read.table(textConnection("stat year Y AL 200325 AL 200313 AL 200421 AL 200620 AL 200712 AL 200916 AL 201015 FL 200663 FL 200714 FL 200725 FL 200964 FL 200947 FL 201048 NY 200350 NY

Re: [R] include

2018-02-25 Thread Val
showing > your (failed) attempts at solving your own problems so we can help you work > on your specific weaknesses and become self-sufficient? > -- > Sent from my phone. Please excuse my brevity. > > On February 25, 2018 7:55:55 AM PST, Val <valkr...@gmail.com> wrote: &g

Re: [R] include

2018-02-25 Thread Val
PM, Jim Lemon <drjimle...@gmail.com> wrote: > Hi Val, > My fault - I assumed that the NA would be first in the result produced > by "unique": > > mydat <- read.table(textConnection("Col1 Col2 col3 > Z1 K1 K2 > Z2 NA NA > Z3 X1 NA > Z4 Y1 W1"),

Re: [R] include

2018-02-24 Thread Val
Thank you so much Jim! On Sat, Feb 24, 2018 at 6:38 PM, Jim Lemon <drjimle...@gmail.com> wrote: > Hi Val, > My fault - I assumed that the NA would be first in the result produced > by "unique": > > mydat <- read.table(textConnection("Col1 Col2 col3 >

Re: [R] include

2018-02-24 Thread Val
wrote: > hi Val, > Your problem seems to be that the data are read in as a factor. The > simplest way I can think of to get around this is: > > mydat <- read.table(textConnection("Col1 Col2 col3 > Z1 K1 K2 > Z2 NA NA > Z3 X1 NA > Z4 Y1 W1"),header = TRUE,str

Re: [R] include

2018-02-24 Thread Val
),mydat) Col1 Col2 col3 1 2 X1 3 Y1 4 K2 5 W1 6 Z1 K1 K2 7 Z2 8 Z3 X1 9 Z4 Y1 W1 I could not find K1 in the first col1. Is that possible to fix this? On Sat, Feb 24, 2018 at 5:59 PM, Val <valkr...@gmail.com> wrote: > Thank you Jim and all,

Re: [R] include

2018-02-24 Thread Val
rocessed right to left so >> x2 <- x[!is.na(x1)] <- 0 >> is equivalent to >> x[!is.na(x1)] <- 0 >> x2 <- 0 >> > > That's not right in general, is it? I'd think that should be > > x[!is.na(x1)] <- 0 > x2 <- x1 >

Re: [R] include

2018-02-24 Thread Val
Thank you Jim I wanted a final data frame after replacing the NA's to "0" x1 = rbind(unique(preval),mydat) x2 <- x1[is.na(x1)] <- 0 x2 but I got this, [1] 0 why I am getting this? On Sat, Feb 24, 2018 at 12:17 AM, Jim Lemon <drjimle...@gmail.com> wrote: > Hi Va

[R] include

2018-02-23 Thread Val
Hi All, I am reading a file as follow, mydat <- read.table(textConnection("Col1 Col2 col3 Z2 NA NA Z3 X1 NA Z4 Y1 W1"),header = TRUE) 1. "NA" are missing should be replace by 0 2. value that are in COl2 and Col3 should be included in col1 before they appear in col2 and col3. So the output

Re: [R] find unique and summerize

2018-02-04 Thread Val
t;) > b <- strsplit(mydata$ID, "[[:digit:]]+") > > a <- sapply(a, `[`, 1) > c <- sapply(a, `[`, 2) > b <- sapply(b, function(x) x[x != ""]) > > c2 <- sprintf("%010d", as.integer(c)) > > newID <- paste0(a, b, c2) > > > Hope this h

Re: [R] find unique and summerize

2018-02-03 Thread Val
;- sub("^(\\d+).*", "\\1", mydata$ID) > Country <- sub("^\\d+(.*)", "\\1", mydata$ID) > > tbl1 <- table(Country, IDNum) > addmargins(tbl1) > > tbl2 <- xtabs(Y ~ Country + IDNum, mydata) > addmargins(tbl2) > > > Hope this he

[R] find unique and summerize

2018-02-02 Thread Val
Hi all, I have a data set need to be summarized by unique ID (count and sum of a variable) A unique individual ID (country name Abbreviation followed by an integer numbers) may have observation in several countries. Then the ID was changed by adding the country code as a prefix and new ID

Re: [R] match and new columns

2017-12-13 Thread Val
t 7:23 PM, William Dunlap <wdun...@tibco.com> wrote: > Use the stringsAsFactors=FALSE argument to read.table when > making your data.frame - factors are getting in your way here. > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Wed, Dec 13, 2017 at 3:02 PM, V

Re: [R] match and new columns

2017-12-13 Thread Val
.pt> wrote: > Hello, > > Here is one way. > > tdat$D <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$B], 0) > tdat$E <- ifelse(tdat$B %in% tdat$A, tdat$A[tdat$C], 0) > > > Hope this helps, > > Rui Barradas > > > On 12/13/2017 9:36 PM, Val wrote: > &

[R] match and new columns

2017-12-13 Thread Val
Hi all, I have a data frame tdat <- read.table(textConnection("A B C Y A12 B03 C04 0.70 A23 B05 C06 0.05 A14 B06 C07 1.20 A25 A23 A12 3.51 A16 A25 A14 2,16"),header = TRUE) I want match tdat$B with tdat$A and populate the column values of tdat$A ( col A and Col B) in the newly created columns

[R] family

2017-11-17 Thread Val
Hi all, I am reading a huge data set(12M rows) that contains family information, Offspring, Parent1 and Parent2 Parent1 and parent2 should be in the first column as an offspring before their offspring information. Their parent information (parent1 and parent2) should be set to zero, if unknown.

[R] remove

2017-06-10 Thread Val
Hi all, I have a date issue and would appreciate any help. I am reading a field data and n one of the columns I am expecting a date but has non date values such as character and empty. space. Here is a sample of my data. KL <- read.table(header=TRUE, text='ID date 711 Dead 712 Uknown 713

Re: [R] New var

2017-06-04 Thread Val
; -1), tf1 = c(0, 0, 0, 1, 0, 1), tf2 = c(0, 0, 0, -1, 0, -1), > tf3 = c(0, 1, 0, -1, 1, -1), tf4 = c(0, -1, 0, -1, -1, -1 > ), tf5 = c(0, -1, 1, -1, -1, -1), tm1 = c(0, 0, 0, 1, 0, > 1), tm2 = c(0, 0, 0, -1, 0, -1), tm3 = c(0, 1, 0, -1, 1, > -1), tm4 = c(0, -1, 0, -1, -1,

Re: [R] New var

2017-06-03 Thread Val
st to me. > > Cheers, > Bert > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On F

[R] New var

2017-06-02 Thread Val
Hi all, I have a data set with time interval and depending on the interval I want to create 5 more variables . Sample data below obs, Start, End 1,2/1/2015, 1/1/2017 2,4/11/2010, 1/1/2011 3,1/4/2006, 5/3/2007 4,10/1/2007, 1/1/2008 5,6/1/2011, 1/1/2012 6,10/15/2004,12/1/2004 First, I want

[R] missing and replace

2017-04-26 Thread Val
HI all, I have a data frame with three variables. Some of the variables do have missing values and I want to replace those missing values (1represented by NA) with the mean value of that variable. In this sample data, variable z and y do have missing values. The mean value of y and z are152. 25

[R] combination

2017-04-12 Thread Val
Hi all, I have two variables x and y. X has five observation and y has three. I want combine each element of x to each element of y values to produce 15 observation. Below is my sample data and desired output data x Y 1 A 2 B 3 C 4 5 Output 1 A 1 B 1 C 2 A 2 B 2 C 3 A 3 B 3 C

[R] create new

2017-03-24 Thread Val
Hi all, I have several variables in a group and one group contains three variables. Sample of data ( Year, x1, x3 and x2) mydat <- read.table(header=TRUE, text=' Year x1 x3 x2 Year1 10 120 Year2 0 150 Year3 0 020 Year4 25 0 12 Year5 15 25 12 Year6 0 16 14

[R] screen

2017-03-15 Thread Val
HI all, I have some data to be screened based on the recording flag (obs). Some family recorded properly (1) and others not (0). Th 0 = improper and 1 = proper The recording period starts week1. All families may not start in the same week in recording properly an observation, DF2 <-

[R] replace

2017-03-13 Thread Val
HI all, if first name is Alex then I want concatenate the second column to Alex to produce Alex and the second column value DF1 <- read.table(header=TRUE, text='first YR Alex2001 Bob 2001 Cory2001 Cory2002 Bob 2002 Bob 2003 Alex2002 Alex2003 Alex2004')

Re: [R] [FORGED] if and

2017-02-27 Thread Val
> > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Mon, Feb 27, 2017 at 6:16 PM, Rolf Turner <r.tur...@auckland.ac.nz>

[R] if and

2017-02-27 Thread Val
Currently I have about six or more scripts that do the same job. I thought it might be possible and more efficient to use one script by using IF ELSE statements. Here is an example but this will be expandable for several countries ans year-months Year-month = FEB2015, FEB2012, Feb2010

Re: [R] remove

2017-02-12 Thread Val
ob1 John Bob2 John Bob3 John Cory1 Jack Cory2 - Thank you again! On Sun, Feb 12, 2017 at 7:28 PM, Val <valkr...@gmail.com> wrote: > Sorry Jeff, I did not finish my email. I accidentally touched the send > button. > My question was the > whe

Re: [R] remove

2017-02-12 Thread Val
!. On Sun, Feb 12, 2017 at 6:31 PM, Jeff Newmiller <jdnew...@dcn.davis.ca.us> wrote: > Your question mystifies me, since it looks to me like you already know the > answer. > -- > Sent from my phone. Please excuse my brevity. > > On February 12, 2017 3:30:49 PM PST, Val <valk

Re: [R] remove

2017-02-12 Thread Val
t to investigate the data.table or sqlite packages, either of which can > be combined with dplyr to get a standardized syntax for managing larger > amounts of data. However, most people actually aren't running out of memory > so in most cases the extra horsepower isn't actually needed. >

Re: [R] [FORGED] Re: remove

2017-02-12 Thread Val
>first week last >> 1 Bob1 John >> 2 Bob2 John >> 3 Bob3 John >> 4 Cory1 Jack >> 5 Cory2 Jack >> >> which is the desired output. If there is a "basic stuff" way to do this >> I'd like to see it. Perhap

Re: [R] remove

2017-02-12 Thread Val
our data set is really big (running out of memory big) then you might > want to investigate the data.table or sqlite packages, either of which can > be combined with dplyr to get a standardized syntax for managing larger > amounts of data. However, most people actually aren't running out of m

[R] remove

2017-02-11 Thread Val
Hi all, I have a big data set and want to remove rows conditionally. In my data file each person were recorded for several weeks. Somehow during the recording periods, their last name was misreported. For each person, the last name should be the same. Otherwise remove from the data.

Re: [R] output

2017-01-17 Thread Val
essage of Error in read.table(file = file, header = header, sep = sep, quote = quote, : no lines available in input Thank you in advance On Tue, Dec 13, 2016 at 5:07 PM, Val <valkr...@gmail.com> wrote: > Marc, > Thank you so much! That was helpful comment. > > > On Mon, D

[R] output

2016-12-12 Thread Val
Hi all, I have a data frame with more than 100,000 rows. datx <- function(n,mean,sd) { mean+sd*scale(rnorm(n)) } dat <- datx(11,10,2) 1) WriteXLS(dat, "test4.xls", row.names=FALSE) Error in WriteXLS(dat, "test4.xls", row.names = FALSE) : One or more of the data frames named in 'x' exceeds

[R] data

2016-12-03 Thread Val
Hi all, I am trying to read and summarize a big data frame( >10M records) Here is the sample of my data state,city,x 1,12,100 1,12,100 1,12,200 1,13,200 1,13,100 1,13,100 1,14,200 2,21,200 2,21,200 2,21,100 2,23,100 2,23,200 2,34,200 2,34,100 2,35,100 I want get the total count by state, and

Re: [R] files

2016-11-29 Thread Val
les(pattern="^test") > myfiles <- lapply(filelist, read.csv) > myfiles <- do.call(rbind, myfiles) > > > > On Tue, Nov 29, 2016 at 9:11 PM, Val <valkr...@gmail.com> wrote: >> Hi all, >> >> In one folder I have several files and I want &g

[R] files

2016-11-29 Thread Val
Hi all, In one folder I have several files and I want combine/concatenate(rbind) based on some condition . Here is the sample of the files in one folder test.csv test123.csv test456.csv Adat.csv Adat123.csv Adat456.csv I want to create 2 files as follows test_all =

Re: [R] read

2016-11-28 Thread Val
Hi Jeff and John, Thank you for your response. In each folder, I am expecting a single file name (either dat or dat.csv).v so will this work? Is the following correct? fns <- list.files(mydir) if (is.element(pattern="dat(\\.[^.]+)$",fns )) Thank you again. On Mon, Nov 28, 2016 at 7:20

[R] Variable

2016-11-24 Thread Val
Hi all, I am trying to get shell variable(s) into my R script in Linux . How do I get them? my shell script is t1.sh #!bin/bash Name=Alex; export Name Age=25; export Age How do get the Name and Age variables in my R script? My R script is test.R print " Your Name is $Name and

  1   2   >