def read_rdb(filename):
    """
    Reads an .rdb file and returns a dictionary with the headers as keys and data as lists ('output'), and also a list of headers ('keys').

    use: table = pyrdb.read_rdb(file)[0] for data
    use: table = pyrdb.read_rdb(file)[1] to get the keys by order
    """
    f = open(filename, 'r')
    data = f.readlines()
    f.close()
    key = str.split(data[0][:-1], '\t')
    output = {}
    for i in range(len(key)):
        output[key[i]] = []
    for line in data[2:]:
        qq = str.split(line[:-1], '\t')
        for i in range(len(key)):
            try:
                value = float(qq[i])
            except ValueError:
                value = qq[i]
            output[key[i]].append(value)
    return output, key
