1

I would like to create a sample table for r in stack overflow. I have tried putting this in the Code field but it is not posting. Will it merely display the code or can I make it run the code to make a little sample table?

0

1 Answer 1

5

At the moment, stack snippets only support HTML, CSS and JavaScript although it may support more languages in the future. If you paste an unsupported language into the box, more than likely it will display the code in plain text, i.e:

def preProBuildWordVocab(sentence_iterator, word_count_threshold):
# count up all word counts so that we can threshold
# this shouldnt be too expensive of an operation
print 'preprocessing word counts and creating vocab based on word count threshold %d' % (word_count_threshold, )
t0 = time.time()
word_counts = {}
nsents = 0
for sent in sentence_iterator:
nsents += 1
for w in sent['tokens']:
word_counts[w] = word_counts.get(w, 0) + 1
vocab = [w for w in word_counts if word_counts[w] >= word_count_threshold]
print 'filtered words from %d to %d in %.2fs' % (len(word_counts), len(vocab), time.time() - t0)

If you want to display a table that's generated by your program, run the program elsewhere and then paste the table into your question. You can refer to Is there any markdown to create tables? on considerations to take when formatting the table.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .