cufu_funword: cufu_funword

Usage Arguments Value Note Author(s) Examples

View source: R/customized functions.R

Usage

1
cufu_funword(feature,fnames,short_fnames)

Arguments

feature

featured words in Correspondence analysis

fnames

the file names of corpora.

short_fnames

the short file names of corpora 'short_names(fnames)'

Value

words matrix

Note

This package is built to simplify the code in the final report of Methods of Corpus Linguistics

Author(s)

Christine Zhao

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## The function is currently defined as
function(feature,fnames,short_fnames){

  # build a data.frame df with in its row names the features
  df <- data.frame(row.names = feature)

  for (i in 1:length(fnames)) {
    fname <- fnames[[i]]             # identify i-th filename
    short_fname <- short_fnames[[i]] # identify i-th short filename
    flist <- freqlist(fname)         # build frequency list for file
    flist <- flist[feature]         # filter that list to just features
    df[[short_fname]] <- flist        # add column to d named after filename
  }

  df <- df 
    as.matrix() 
    t()
    drop_empty_rc()

  return(df)
}

Christine-Z/cufu documentation built on Jan. 4, 2022, 12:01 a.m.