Categories

shrivel data

Here’s a snippet of R code showing how to extract info from the shrivel character data (a file is below…

df <- data.frame(shrivel.txt =c("x", "xoxx", "xxxx", "oooo", "xoooo"))
df      # start off with this data frame
str(df)

df$shrivel.count <- nchar(as.character(df$shrivel.txt)) #add column

vx <- gsub("o", "", df$shrivel.txt)  # replace o with ""
vx
df$shrivel.xs <- nchar(vx)           # make a new column in df

vo <- gsub("x", "", df$shrivel.txt)  # replace x with ""
vo
df$shrivel.os <- nchar(vo)           # make a new column in df

str(df)
df      # final data frame

codeForAllegra.r

twitterpinterestmail

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>