-2

I am trying to plot a u vector using the R language. I have obtained U throught SVD applied to some training data. I have downloaded the useful library for tm and ggplot2. I want to plot the 2 dimensions of the vector U , which results from SVD of the Dokument Terms matrix. Which is obtained through my training Data here is my code:

#Read the training files:
#load the text mining package
library(tm)
library(ggplot2)


#Load the names of the training documents
myfiles = DirSource("C:\\Users\\Sondos\\Downloads\\HW-07-data\\HW-07-data\\training",pattern="^c.*")
#create a corpus and read the files
training=Corpus(myfiles )
# to get an impression of the training object type
training
# to get a deeper look into the documents type
#inspect(training)
#to convert the documents to a document term matrix use
dtm = DocumentTermMatrix(training,control=list(tolower=F))

m = as.matrix(dtm)

s=svd(m)
#store vector U 
k = s$u


plot.new()
points(1:length(k2), k2)

The problem is that I cannot see the plot. Any one has an idea about this?

Marzo
  • 43
  • 1
  • 2
  • 9

1 Answers1

0

points adds points to an existing plot. Try plot(k2). There should be no need to call plot.new explicitly.

David_B
  • 926
  • 5
  • 7